Add additional test for get_torrents_status and fix the other one to properly invalidate the cache

time from startup before proceeding
This commit is contained in:
Andrew Resch 2010-08-18 12:15:16 -07:00
parent 48d016e97d
commit 7d64f057c7
1 changed files with 9 additions and 0 deletions

View File

@ -112,8 +112,17 @@ class SessionProxyTestCase(unittest.TestCase):
return d return d
def test_get_torrent_status_key_not_updated(self): def test_get_torrent_status_key_not_updated(self):
time.sleep(self.sp.cache_time + 0.1)
self.sp.get_torrent_status("a", ["key1"]) self.sp.get_torrent_status("a", ["key1"])
client.core.torrents["a"]["key2"] = 99 client.core.torrents["a"]["key2"] = 99
d = self.sp.get_torrent_status("a", ["key2"]) d = self.sp.get_torrent_status("a", ["key2"])
d.addCallback(self.assertEquals, {"key2": 99}) d.addCallback(self.assertEquals, {"key2": 99})
return d return d
def test_get_torrents_status_key_not_updated(self):
time.sleep(self.sp.cache_time + 0.1)
self.sp.get_torrents_status({"id": ["a"]}, ["key1"])
client.core.torrents["a"]["key2"] = 99
d = self.sp.get_torrents_status({"id": ["a"]}, ["key2"])
d.addCallback(self.assertEquals, {"a": {"key2": 99}})
return d