def test_get_stale_conversations(self): table = ConversationTable() conversation_one = StubConversation(12344) conversation_two = StubConversation(12345) conversation_three = StubConversation(12346) table.conversation_table = { ("10.26.0.1", "3942"): conversation_one, ("10.26.0.2", "3942"): conversation_two, ("10.26.0.3", "3942"): conversation_three } performer = Performer(self.sock, table, 10, 6) # Either order of returned results is fine self.assertTrue(performer._get_stale_conversations(5, 12350) == [conversation_one, conversation_two] or performer.get_stale_conversations(5, 12350) == [conversation_two, conversation_one], "stale conversations found don't match")
def test_get_stale_conversations(self): table = ConversationTable() conversation_one = StubConversation(12344) conversation_two = StubConversation(12345) conversation_three = StubConversation(12346) table.conversation_table = { ("10.26.0.1", "3942"): conversation_one, ("10.26.0.2", "3942"): conversation_two, ("10.26.0.3", "3942"): conversation_three } performer = Performer(self.sock, table, 10, 6) # Either order of returned results is fine self.assertTrue( performer._get_stale_conversations( 5, 12350) == [conversation_one, conversation_two] or performer.get_stale_conversations( 5, 12350) == [conversation_two, conversation_one], "stale conversations found don't match")
def test_sweep_completed_conversations(self): conversation_one = StubConversation(12344) conversation_one.state = tftp_conversation.COMPLETED conversation_two = StubConversation(12345) conversation_two.state = tftp_conversation.READING conversation_three = StubConversation(12346) conversation_three.state = tftp_conversation.COMPLETED table = ConversationTable() table.conversation_table = { ("10.26.0.1", "3942"): conversation_one, ("10.26.0.2", "3942"): conversation_two, ("10.26.0.3", "3942"): conversation_three } performer = Performer(self.sock, table, 10, 6) performer.sweep_completed_conversations() self.assertEqual(table.conversation_table, {("10.26.0.2", "3942"): conversation_two, })
def test_sweep_completed_conversations(self): conversation_one = StubConversation(12344) conversation_one.state = tftp_conversation.COMPLETED conversation_two = StubConversation(12345) conversation_two.state = tftp_conversation.READING conversation_three = StubConversation(12346) conversation_three.state = tftp_conversation.COMPLETED table = ConversationTable() table.conversation_table = { ("10.26.0.1", "3942"): conversation_one, ("10.26.0.2", "3942"): conversation_two, ("10.26.0.3", "3942"): conversation_three } performer = Performer(self.sock, table, 10, 6) performer.sweep_completed_conversations() self.assertEqual(table.conversation_table, { ("10.26.0.2", "3942"): conversation_two, })