예제 #1
0
    def test_get_latest_response_from_one_responses(self):
        conversation = ConversationFactory()
        response_1 = ResponseFactory(statement=StatementFactory(text='A'),
                                     response=StatementFactory(text='B'))

        conversation.responses.add(response_1)
        response = self.adapter.get_latest_response(conversation.id)

        self.assertEqual(response_1.response, response)
예제 #2
0
    def test_get_latest_response_from_three_responses(self):
        conversation = ConversationFactory()
        response_1 = ResponseFactory(statement=StatementFactory(text='A'),
                                     response=StatementFactory(text='B'))
        response_2 = ResponseFactory(statement=StatementFactory(text='C'),
                                     response=StatementFactory(text='D'))
        response_3 = ResponseFactory(statement=StatementFactory(text='E'),
                                     response=StatementFactory(text='F'))

        conversation.responses.add(response_1, response_2, response_3)
        response = self.adapter.get_latest_response(conversation.id)

        self.assertEqual(response_3.response, response)
예제 #3
0
    def test_get_latest_response_from_zero_responses(self):
        conversation = ConversationFactory()
        response = self.adapter.get_latest_response(conversation.id)

        self.assertIsNone(response)