Exemplo n.º 1
0
    def test_generate_quiz_paylaod(self, mock_handle_multiple_answer_payload):
        handle_post_back(recipient_id=self.bot_user.messenger_id, post_back=self.generating_quiz_post_back)

        self.assertEqual(
            mock_handle_multiple_answer_payload.call_count,
            1
        )
Exemplo n.º 2
0
    def test_handle_language_code_post_back(self,
                                            mock_send_action,
                                            mock_send_message):
        handle_post_back(recipient_id=self.bot_user.messenger_id, post_back=self.language_code_post_back)

        self.assertEqual(mock_send_action.call_count, 1)
        self.assertEqual(mock_send_message.call_count, 1)
Exemplo n.º 3
0
    def test_handle_programming_questions_post_back(self,
                                                    mock_send_action,
                                                    mock_send_button_message):

        handle_post_back(recipient_id=self.bot_user.messenger_id, post_back=self.programming_questions_post_back)

        self.assertEqual(mock_send_action.call_count, 1)
        self.assertEqual(mock_send_button_message.call_count, 1)
Exemplo n.º 4
0
    def test_send_menu(self,
                       mock_send_action,
                       mock_send_generic_message
                       ):
        handle_post_back(recipient_id=self.bot_user.messenger_id, post_back=self.main_menu_postback)

        self.assertEqual(mock_send_action.call_count, 1)
        self.assertEqual(mock_send_generic_message.call_count, 1)
Exemplo n.º 5
0
    def test_programming_multiple_answer_post_back(self,
                                                   mock_send_action,
                                                   mock_send_message):

        handle_post_back(recipient_id=self.bot_user.messenger_id, post_back=self.programming_multiple_answer_post_back)

        self.assertEqual(mock_send_action.call_count, 1)
        self.assertEqual(mock_send_message.call_count, 1)
Exemplo n.º 6
0
    def test_handle_how_to_challenge_payload(self,
                                             mock_send_action,
                                             mock_send_button_message,
                                             mock_send_text_message):
        handle_post_back(recipient_id=self.bot_user.messenger_id, post_back=self.how_to_challenge_postback)

        self.assertEqual(mock_send_action.call_count, 1)
        self.assertEqual(mock_send_button_message.call_count, 1)
        self.assertEqual(mock_send_text_message.call_count, 1)
Exemplo n.º 7
0
    def test_handle_options_post_back(self,
                                      mock_send_action,
                                      mock_send_message):

        handle_post_back(recipient_id=self.bot_user.messenger_id, post_back=self.options_post_back)

        # Test that the send action is called once

        self.assertEqual(mock_send_action.call_count, 1)

        # Test that the send_message is called once

        self.assertEqual(mock_send_message.call_count, 1)
Exemplo n.º 8
0
    def test_handle_get_started(self,
                                mock_send_text_message,
                                mock_send_action,
                                mock_send_generic_message):

        handle_post_back(recipient_id=self.bot_user.messenger_id, post_back=self.get_started_post_back)

        # Assert that the send_text_message is called once

        self.assertEqual(mock_send_text_message.call_count, 1)

        # Assert that the send_generic_message is called once

        self.assertEqual(mock_send_generic_message.call_count, 1)

        # Assert that the send_action is called once

        self.assertEqual(mock_send_action.call_count, 1)