コード例 #1
0
ファイル: test_context.py プロジェクト: pombredanne/ava-srv
 def setUp(self):
     self.context = Context(None)
コード例 #2
0
ファイル: test_context.py プロジェクト: pombredanne/ava-srv
class CoreContextTest(unittest.TestCase):

    def setUp(self):
        self.context = Context(None)

    def test_send_signal(self):
        SIGNAL = 'my-first-signal'

        receiver = Receiver()
        self.context.connect(receiver, signal=SIGNAL)
        self.context.send(signal=SIGNAL)
        self.assertTrue(receiver.called)

    def test_connect_and_then_disconnect(self):
        SIGNAL = 'my-second-signal'
        receiver = Receiver()
        self.context.connect(receiver)
        self.context.send(signal=SIGNAL)
        self.assertTrue(receiver.called)
        receiver.called = False
        self.context.disconnect(receiver)
        self.context.send(signal=SIGNAL)
        self.assertFalse(receiver.called)