コード例 #1
0
    def testonGlobalMsgDirect(self):
        app = ApplicationClass()

        output = []
        listener = lambda *args: output.append(args)
        app.signals['outgoing_msg'] += listener

        expect =  [('p2', 'test global'), ('p1', 'test global'), ('#log', 'test global'), ('#main', 'test global')]
        app.on_global_msg('test global')
        self.assertEqual(output, expect)
コード例 #2
0
    def testDoCommand(self):
        app = ApplicationClass()
        app.database.expects('commit')

        output = []
        listener = lambda *args: output.append(args)
        app.signals['command'] += listener

        expect = [('fakey', 'fakecommand', ['arg1', 'arg2'])]
        app.do_command('fakey', 'fakecommand', ['arg1', 'arg2'])
        self.assertEqual(output, expect)
コード例 #3
0
    def testOnGameMsgDirect(self):
        app = ApplicationClass()
        
        # XXX dammit this just does not work for some reason
        # listener = fudge.Fake(expect_call=True)
        # app.signals['outgoing_msg'] += listener

        # Fine then, we'll make our own
        output = []
        listener = lambda *args: output.append(args)
        app.signals['outgoing_msg'] += listener

        expect = [('f1', 'test message'), ('f2', 'test message'), ('#log', 'test message')]
        app.on_game_msg('test message')
        self.assertEqual(output, expect)