From 0ff00dff6f7cc44cf54759071f975693493f0507 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 11 May 2016 16:41:52 -0700 Subject: [PATCH] test loading the cache --- src/allmydata/test/test_introducer.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/allmydata/test/test_introducer.py b/src/allmydata/test/test_introducer.py index af04d1577..4feb2aa0c 100644 --- a/src/allmydata/test/test_introducer.py +++ b/src/allmydata/test/test_introducer.py @@ -1016,6 +1016,7 @@ class Announcements(unittest.TestCase): with cache_filepath.open() as f: return yaml.safe_load(f) + @defer.inlineCallbacks def test_client_cache(self): basedir = "introducer/ClientSeqnums/test_client_cache_1" fileutil.make_dirs(basedir) @@ -1080,6 +1081,22 @@ class Announcements(unittest.TestCase): set([a["ann"]["anonymous-storage-FURL"] for a in announcements])) + # test loading + ic2 = IntroducerClient(None, "introducer.furl", u"my_nickname", + "my_version", "oldest_version", {}, fakeseq, + ic._cache_filepath) + announcements = {} + def got(key_s, ann): + announcements[key_s] = ann + ic2.subscribe_to("storage", got) + ic2._load_announcements() # normally happens when connection fails + yield flushEventualQueue() + + self.failUnless(pub1 in announcements) + self.failUnlessEqual(announcements[pub1]["anonymous-storage-FURL"], + furl2) + self.failUnlessEqual(announcements[pub2]["anonymous-storage-FURL"], + furl3) class YAMLUnicode(unittest.TestCase): def test_convert(self):