Add tests for PE id validation

This commit is contained in:
Patrick Smith
2018-07-19 11:30:03 -04:00
parent 3f8b584ff8
commit 355d2ed36a
4 changed files with 111 additions and 16 deletions

View File

@@ -43,27 +43,39 @@ class MockApiClient(ApiClient):
return response
MOCK_REQUEST = {
"id": "66b8ef71-86d3-48ef-abc2-51bfa1732b6b",
"creator": "49903ae7-da4a-49bf-a6dc-9dff5d004238",
"body": {
"financial_verification": {
"pe_id": "0203752A",
},
},
"status": "incomplete"
}
class MockRequestsClient(MockApiClient):
@tornado.gen.coroutine
def get(self, path, **kwargs):
json = {
"id": "66b8ef71-86d3-48ef-abc2-51bfa1732b6b",
"creator": "49903ae7-da4a-49bf-a6dc-9dff5d004238",
"body": {},
"status": "incomplete",
}
return self._get_response("GET", path, 200, json=json)
return self._get_response("GET", path, 200, json=MOCK_REQUEST)
@tornado.gen.coroutine
def post(self, path, **kwargs):
json = {
"id": "66b8ef71-86d3-48ef-abc2-51bfa1732b6b",
"creator": "49903ae7-da4a-49bf-a6dc-9dff5d004238",
"body": {},
"status": "incomplete",
}
return self._get_response("POST", path, 202, json=json)
return self._get_response("POST", path, 202, json=MOCK_REQUEST)
MOCK_VALID_PE_ID = "8675309U"
class MockFundzClient(MockApiClient):
@tornado.gen.coroutine
def get(self, path, **kwargs):
if path.endswith(MOCK_VALID_PE_ID):
return self._get_response("GET", path, 200)
else:
return self._get_response("GET", path, 404)
class MockAuthzClient(MockApiClient):