Island: Properly handle Credentials JSON in resource

This commit is contained in:
Mike Salvatore 2022-07-22 13:22:13 -04:00
parent 878f12736f
commit f4dee02874
2 changed files with 5 additions and 5 deletions

View File

@ -29,7 +29,7 @@ class PropagationCredentials(AbstractResource):
return propagation_credentials, HTTPStatus.OK
def post(self, collection=None):
credentials = [Credentials.from_json(c) for c in request.json]
credentials = [Credentials.from_mapping(c) for c in request.json]
if collection == _configured_collection:
self._credentials_repository.save_configured_credentials(credentials)

View File

@ -89,8 +89,8 @@ def test_propagation_credentials_endpoint__post_stolen(flask_client, credentials
resp = flask_client.post(
url,
json=[
Credentials.to_json(LM_HASH_CREDENTIALS),
Credentials.to_json(NT_HASH_CREDENTIALS),
Credentials.to_mapping(LM_HASH_CREDENTIALS),
Credentials.to_mapping(NT_HASH_CREDENTIALS),
],
)
assert resp.status_code == HTTPStatus.NO_CONTENT
@ -134,8 +134,8 @@ def test_propagation_credentials_endpoint__post_not_found(flask_client):
resp = flask_client.post(
NON_EXISTENT_COLLECTION_URL,
json=[
Credentials.to_json(LM_HASH_CREDENTIALS),
Credentials.to_json(NT_HASH_CREDENTIALS),
Credentials.to_mapping(LM_HASH_CREDENTIALS),
Credentials.to_mapping(NT_HASH_CREDENTIALS),
],
)
assert resp.status_code == HTTPStatus.NOT_FOUND