Beispiel #1
0
 def test__try_construct_envelope_positive(self, *mocks):
     """Test _try_construct_envelope for positive result."""
     dialogues_mock = mock.Mock()
     msg_mock = mock.Mock(spec=DefaultMessage)
     msg_mock.to = "to"
     msg_mock.sender = "sender"
     dialogues_mock.create.return_value = msg_mock, None
     message_class = mock.Mock()
     envelope = _try_construct_envelope("agent_name", dialogues_mock, message_class)
     self.assertIsInstance(envelope, Envelope)
Beispiel #2
0
 def test__try_construct_envelope_exception_raised(self, *mocks):
     """Test _try_construct_envelope for exception raised result."""
     envelope = _try_construct_envelope("agent_name", "sender", "dialogues")
     self.assertEqual(envelope, None)
Beispiel #3
0
 def test__try_construct_envelope_keyboard_interrupt(self, *mocks):
     """Test _try_construct_envelope for keyboard interrupt result."""
     with self.assertRaises(KeyboardInterrupt):
         _try_construct_envelope("agent_name", "sender", "dialogues")
Beispiel #4
0
 def test__try_construct_envelope_positive_no_input_message(self, *mocks):
     """Test _try_construct_envelope for no input message result."""
     envelope = _try_construct_envelope("agent_name", "sender", "dialogues")
     self.assertEqual(envelope, None)
Beispiel #5
0
 def test__try_construct_envelope_positive(self, *mocks):
     """Test _try_construct_envelope for positive result."""
     envelope = _try_construct_envelope("agent_name", "sender", mock.Mock())
     self.assertIsInstance(envelope, Envelope)