def test_melbourne_shop_404(self): mock_api = MagicMock() mock_api.create_uplink = MagicMock(name="create_uplink") mock_api.create_uplink.return_value = MagicMock(spec=requests.Response, status_code=404) mock_api.create_uplink.return_value.json.return_value = melbourne_shop_404_speech_response result = app.create_uplink(mock_api, melbourne_shop_parameters) self.assertTrue(mock_api.create_uplink.called) self.assertEqual(melbourne_shop_404_speech_response, result)
def test_hahawan_invalid_wan_400(self): mock_api = MagicMock() mock_api.create_uplink = MagicMock(name="create_uplink") mock_api.create_uplink.return_value = MagicMock(spec=requests.Response, status_code=400) mock_api.create_uplink.return_value.json.return_value = hahawan_invalid_wan_400_api_response result = app.create_uplink(mock_api, hahawan_parameters) self.assertTrue(mock_api.create_uplink.called) self.assertEqual(hahawan_invalid_wan_400_speech_response, result)
from samples.create_uplink import * from actions.api import SteelConnectAPI import app if __name__ == "__main__": mock_api = SteelConnectAPI("Aubrey", "Aubrey", 'monash.riverbed.cc', 'org-Monash-d388075e40cf1bfd') app.create_uplink(mock_api, melbourne_shop_parameters)