class MicrosoftAdapterTests(TestCase): def setUp(self): super(MicrosoftAdapterTests, self).setUp() import requests requests.post = Mock(side_effect=mock_send_message) requests.get = Mock(side_effect=mock_get_message) microsoft.requests = requests self.adapter = Microsoft( directline_host='https://directline.botframework.com', direct_line_token_or_secret='xtFDtPemROU.cwA.Mcs.qiScdaSx87ffj2l7OjSITqJFoN-9Ado5AgwVeknac94', conversation_id='IEyJvnDULgn' ) def test_validate_status_code_200(self): response = MockResponse(200, {}) try: self.adapter._validate_status_code(response) except Microsoft.HTTPStatusException: self.fail('Test raised HTTPStatusException unexpectedly!') def test_response_status_code_not_ok(self): response = MockResponse(404, {}) with self.assertRaises(Microsoft.HTTPStatusException): self.adapter._validate_status_code(response) def test_process_response(self): statement = Statement('Hi! What is your name?') data = self.adapter.process_response(statement) self.assertEqual('Hi! What is your name?', data)
class MicrosoftAdapterTests(TestCase): def setUp(self): super(MicrosoftAdapterTests, self).setUp() import requests requests.post = Mock(side_effect=mock_send_message) requests.get = Mock(side_effect=mock_get_message) microsoft.requests = requests self.adapter = Microsoft( directline_host='https://directline.botframework.com', direct_line_token_or_secret= 'xtFDtPemROU.cwA.Mcs.qiScdaSx87ffj2l7OjSITqJFoN-9Ado5AgwVeknac94', conversation_id='IEyJvnDULgn') def test_validate_status_code_200(self): response = MockResponse(200, {}) try: self.adapter._validate_status_code(response) except Microsoft.HTTPStatusException: self.fail('Test raised HTTPStatusException unexpectedly!') def test_response_status_code_not_ok(self): response = MockResponse(404, {}) with self.assertRaises(Microsoft.HTTPStatusException): self.adapter._validate_status_code(response) def test_process_response(self): statement = Statement('Hi! What is your name?') data = self.adapter.process_response(statement) self.assertEqual('Hi! What is your name?', data)
def setUp(self): super(MicrosoftAdapterTests, self).setUp() import requests requests.post = Mock(side_effect=mock_send_message) requests.get = Mock(side_effect=mock_get_message) microsoft.requests = requests self.adapter = Microsoft( directline_host='https://directline.botframework.com', direct_line_token_or_secret= 'xtFDtPemROU.cwA.Mcs.qiScdaSx87ffj2l7OjSITqJFoN-9Ado5AgwVeknac94', conversation_id='IEyJvnDULgn')
def setUp(self): super(MicrosoftAdapterTests, self).setUp() import requests requests.post = Mock(side_effect=mock_send_message) requests.get = Mock(side_effect=mock_get_message) microsoft.requests = requests self.adapter = Microsoft( directline_host='https://directline.botframework.com', direct_line_token_or_secret='xtFDtPemROU.cwA.Mcs.qiScdaSx87ffj2l7OjSITqJFoN-9Ado5AgwVeknac94', conversation_id='IEyJvnDULgn' )