예제 #1
0
 def test_query_get_method_bad_response():
     response_from_api = dict({"offline": True})
     vips.get = MagicMock(return_value=(False, response_from_api))
     endpoint = TestConfig.VIPS_API_ROOT_URL + '/12345/status/' + TestVips.CORRELATION_ID
     vips.get(endpoint, TestConfig.VIPS_API_USERNAME,
              TestConfig.VIPS_API_PASSWORD)
     is_success, actual = vips.status_get("12345", TestConfig,
                                          TestVips.CORRELATION_ID)
     vips.get.assert_called_with(endpoint, TestConfig.VIPS_API_USERNAME,
                                 TestConfig.VIPS_API_PASSWORD,
                                 TestVips.CORRELATION_ID)
     print(json.dumps(actual))
     assert is_success is False
예제 #2
0
 def test_health_check_method():
     response = load_json_into_dict(
         'python/common/tests/sample_data/vips/vips_health_check_200.json')
     vips.get = MagicMock(return_value=(True, response))
     endpoint = TestConfig.VIPS_API_ROOT_URL + '/api/utility/ping'
     vips.get(endpoint, TestConfig.VIPS_API_USERNAME,
              TestConfig.VIPS_API_PASSWORD)
     is_success, actual = vips.health_get(TestConfig)
     vips.get.assert_called_with(endpoint, TestConfig.VIPS_API_USERNAME,
                                 TestConfig.VIPS_API_PASSWORD)
     print(json.dumps(actual))
     assert is_success is True
     assert "responseMessage" in actual
예제 #3
0
 def test_disclosure_get_method():
     response_from_api = load_json_into_dict(
         'python/common/tests/sample_data/vips/vips_disclosure_200.json')
     vips.get = MagicMock(return_value=(True, response_from_api))
     endpoint = TestConfig.VIPS_API_ROOT_URL + '/1234/disclosure/' + TestVips.CORRELATION_ID
     vips.get(endpoint, TestConfig.VIPS_API_USERNAME,
              TestConfig.VIPS_API_PASSWORD)
     is_success, actual = vips.disclosure_get("1234", TestConfig,
                                              TestVips.CORRELATION_ID)
     vips.get.assert_called_with(endpoint, TestConfig.VIPS_API_USERNAME,
                                 TestConfig.VIPS_API_PASSWORD,
                                 TestVips.CORRELATION_ID)
     assert is_success is True
     assert "document" in actual['data']
예제 #4
0
 def test_query_get_method_failure():
     response_from_api = load_json_into_dict(
         'python/common/tests/sample_data/vips/vips_query_404.json')
     vips.get = MagicMock(return_value=(True, response_from_api))
     endpoint = TestConfig.VIPS_API_ROOT_URL + '/12345/status/' + TestVips.CORRELATION_ID
     vips.get(endpoint, TestConfig.VIPS_API_USERNAME,
              TestConfig.VIPS_API_PASSWORD)
     is_success, actual = vips.status_get("12345", TestConfig,
                                          TestVips.CORRELATION_ID)
     vips.get.assert_called_with(endpoint, TestConfig.VIPS_API_USERNAME,
                                 TestConfig.VIPS_API_PASSWORD,
                                 TestVips.CORRELATION_ID)
     print(json.dumps(actual))
     assert is_success is True
     assert "fail" in actual['resp']
예제 #5
0
 def test_query_get_method_success():
     response_from_api = load_json_into_dict(
         'python/tests/sample_data/vips/vips_query_200.json')
     vips.get = MagicMock(return_value=(True, response_from_api))
     endpoint = TestConfig.VIPS_API_ROOT_URL + '/12345/status/' + TestVips.CORRELATION_ID
     vips.get(endpoint, TestConfig.VIPS_API_USERNAME,
              TestConfig.VIPS_API_PASSWORD)
     is_success, actual = vips.status_get("12345", TestConfig,
                                          TestVips.CORRELATION_ID)
     vips.get.assert_called_with(endpoint, TestConfig.VIPS_API_USERNAME,
                                 TestConfig.VIPS_API_PASSWORD,
                                 TestVips.CORRELATION_ID)
     print(json.dumps(actual))
     assert is_success is True
     assert "driverLicenceSeizedYn" in actual['data']['status']
     assert "surnameNm" in actual['data']['status']
     assert "disclosure" in actual['data']['status']