summary refs log tree commit diff
path: root/tests/storage/test__base.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-08-06 13:37:56 +0100
committerErik Johnston <erik@matrix.org>2015-08-06 13:37:56 +0100
commitf596ff402e49c963b94c398cfb9dbc9d92046b82 (patch)
treecfaaa4e7f18a6379562bcae641cffad37d6b4327 /tests/storage/test__base.py
parentMerge branch 'erikj/cached_keyword_args' of github.com:matrix-org/synapse int... (diff)
parentMerge branch 'erikj/cached_keyword_args' into erikj/cache_deferreds (diff)
downloadsynapse-f596ff402e49c963b94c398cfb9dbc9d92046b82.tar.xz
Merge branch 'erikj/cache_deferreds' into erikj/dictionary_cache
Diffstat (limited to 'tests/storage/test__base.py')
-rw-r--r--tests/storage/test__base.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/storage/test__base.py b/tests/storage/test__base.py
index 8c3d2952bd..8fa305d18a 100644
--- a/tests/storage/test__base.py
+++ b/tests/storage/test__base.py
@@ -17,6 +17,8 @@
 from tests import unittest
 from twisted.internet import defer
 
+from synapse.util.async import ObservableDeferred
+
 from synapse.storage._base import Cache, cached
 
 
@@ -178,19 +180,20 @@ class CacheDecoratorTestCase(unittest.TestCase):
         self.assertTrue(callcount[0] >= 14,
             msg="Expected callcount >= 14, got %d" % (callcount[0]))
 
-    @defer.inlineCallbacks
     def test_prefill(self):
         callcount = [0]
 
+        d = defer.succeed(123)
+
         class A(object):
             @cached()
             def func(self, key):
                 callcount[0] += 1
-                return key
+                return d
 
         a = A()
 
-        a.func.prefill("foo", 123)
+        a.func.prefill("foo", ObservableDeferred(d))
 
-        self.assertEquals((yield a.func("foo")), 123)
+        self.assertEquals(a.func("foo").result, d.result)
         self.assertEquals(callcount[0], 0)