forked from p15670423/monkey
Island: Properly handle Credentials JSON in resource
This commit is contained in:
parent
878f12736f
commit
f4dee02874
|
@ -29,7 +29,7 @@ class PropagationCredentials(AbstractResource):
|
||||||
return propagation_credentials, HTTPStatus.OK
|
return propagation_credentials, HTTPStatus.OK
|
||||||
|
|
||||||
def post(self, collection=None):
|
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:
|
if collection == _configured_collection:
|
||||||
self._credentials_repository.save_configured_credentials(credentials)
|
self._credentials_repository.save_configured_credentials(credentials)
|
||||||
|
|
|
@ -89,8 +89,8 @@ def test_propagation_credentials_endpoint__post_stolen(flask_client, credentials
|
||||||
resp = flask_client.post(
|
resp = flask_client.post(
|
||||||
url,
|
url,
|
||||||
json=[
|
json=[
|
||||||
Credentials.to_json(LM_HASH_CREDENTIALS),
|
Credentials.to_mapping(LM_HASH_CREDENTIALS),
|
||||||
Credentials.to_json(NT_HASH_CREDENTIALS),
|
Credentials.to_mapping(NT_HASH_CREDENTIALS),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
assert resp.status_code == HTTPStatus.NO_CONTENT
|
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(
|
resp = flask_client.post(
|
||||||
NON_EXISTENT_COLLECTION_URL,
|
NON_EXISTENT_COLLECTION_URL,
|
||||||
json=[
|
json=[
|
||||||
Credentials.to_json(LM_HASH_CREDENTIALS),
|
Credentials.to_mapping(LM_HASH_CREDENTIALS),
|
||||||
Credentials.to_json(NT_HASH_CREDENTIALS),
|
Credentials.to_mapping(NT_HASH_CREDENTIALS),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
assert resp.status_code == HTTPStatus.NOT_FOUND
|
assert resp.status_code == HTTPStatus.NOT_FOUND
|
||||||
|
|
Loading…
Reference in New Issue