示例#1
0
 def test_respond (self):
     msg = Message(self.connection, "this is a test")
     msg.respond("how did it go?")
     msg.respond("okay?")
     self.assertEquals(len(msg.responses), 2, "message queues responses")
     self.assertEquals(msg.responses[0].text, "how did it go?", "it went well")
     self.assertEquals(msg.responses[1].text, "okay?", "sure enough")
 def test_respond(self):
     msg = Message(self.connection, "this is a test")
     msg.respond("how did it go?")
     msg.respond("okay?")
     self.assertEquals(len(msg.responses), 2, "message queues responses")
     self.assertEquals(msg.responses[0].text, "how did it go?",
                       "it went well")
     self.assertEquals(msg.responses[1].text, "okay?", "sure enough")
示例#3
0
    def test_flush_responses (self):
        msg = Message(self.connection, "this is a test")
        self.router.start()
        msg.respond("how did it go?")
        msg.flush_responses()
        
        waiting = self.backend.next_message()
        self.assertEquals(waiting.text, "how did it go?", "the backend got the message (1)")
        msg.respond("again?")
        msg.respond("and again?")
        msg.flush_responses()

        waiting = self.backend.next_message()
        self.assertEquals(waiting.text, "again?", "the backend got the message (2)")
        waiting = self.backend.next_message()
        self.assertEquals(waiting.text, "and again?", "the backend got the message (3)")
        self.router.stop()
    def test_flush_responses(self):
        msg = Message(self.connection, "this is a test")
        self.router.start()
        msg.respond("how did it go?")
        msg.flush_responses()

        waiting = self.backend.next_message()
        self.assertEquals(waiting.text, "how did it go?",
                          "the backend got the message (1)")
        msg.respond("again?")
        msg.respond("and again?")
        msg.flush_responses()

        waiting = self.backend.next_message()
        self.assertEquals(waiting.text, "again?",
                          "the backend got the message (2)")
        waiting = self.backend.next_message()
        self.assertEquals(waiting.text, "and again?",
                          "the backend got the message (3)")
        self.router.stop()