def test_failure_500(self): mock_api = MagicMock() mock_api.create_wan.return_value = MagicMock(spec=requests.Response, status_code=500) mock_api.create_wan.return_value.json.return_value = mpls_500_api_response result = app.create_wan(mock_api, create_mpls_wan["result"]["parameters"], []) self.assertTrue(mock_api.create_wan.called) self.assertEqual(mpls_500_expected, result)
def test_denver_wan_404(self, mock_post): mock_post.return_value = MagicMock(spec=requests.Response, status_code=404) result = app.create_wan(denver_shop_wan_parameters) self.assertTrue(mock_post.called) self.assertEqual(denver_shop_wan_404_speech_response, result)
def test_failure_404(self): mock_api = MagicMock() mock_api.create_wan.return_value = MagicMock(spec=requests.Response, status_code=404) result = app.create_wan(mock_api, create_mpls_wan["result"]["parameters"], []) self.assertTrue(mock_api.create_wan.called) self.assertEqual(mpls_404, result)
def test_mpls_wan_success(self, mock_post): mock_api = MagicMock() mock_api.create_wan.return_value = MagicMock(spec=requests.Response, status_code=200) result = app.create_wan(mock_api, create_mpls_wan["result"]["parameters"], []) self.assertTrue(mock_api.create_wan.called) self.assertEqual(mpls_success_speech_response, result)