Example #1
0
 def test_shared_visibility(self):
     """Visibilité des attributs partagés"""
     ctx = Context(42)
     ctx._connection = ConnectionStub()
     yield ctx.setShared("foo", "bar")
     ctx2 = Context(43)
     ctx2._connection = ConnectionStub()
     foo = yield ctx2.getShared("foo")
     self.assertEquals(foo, "bar")
     yield ctx.deleteShared("foo")
     foo = yield ctx2.getShared("foo")
     self.assertEquals(foo, None)
Example #2
0
 def test_deleteshared_unicode(self):
     """Delete partagé sur le contexte (support d'unicode)"""
     ctx = Context(42)
     ctx._connection = MemcachedConnectionStub()
     def check(x):
         print repr(ctx._connection._cache.delete.call_args)
         key = ctx._connection._cache.delete.call_args[0][0]
         self.assertTrue(
             isinstance(key, str),
             "Toutes les clés doivent être des str, pas d'unicode")
         self.assertEquals('shared%3A%C3%A9+%C3%A0+%C3%A8', key)
     d = ctx.deleteShared(u"é à è")
     d.addCallback(check)
     return d