Created
January 11, 2013 12:44
-
-
Save hellais/4510391 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twisted.trial import unittest | |
from storm.twisted.transact import transact, Transactor | |
from storm.twisted.testing import FakeThreadPool | |
class Antani(object): | |
@transact | |
def antani(self): | |
return "foobar" | |
class TestAntani(unittest.TestCase): | |
def setUp(self): | |
self.threadpool = FakeThreadPool() | |
self.transactor = Transactor(self.threadpool) | |
def test_antani(self): | |
def cb(result): | |
print "callback" | |
print result | |
self.assertEqual(result, "foobar") | |
def eb(failure): | |
print "errback" | |
print failure | |
a = Antani() | |
a.transactor = self.transactor | |
d = a.antani() | |
d.addCallback(cb) # never called | |
d.addErrback(eb) # never called | |
return d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment