953 |
953 |
"name": "Foo Identity",
|
954 |
954 |
"password": "foobarbaz"
|
955 |
955 |
}
|
956 |
|
identity_ret = server.get(f"/api/certificates/{ret.json['data']}/identity", content_type="application/json",
|
957 |
|
json=identity_details)
|
|
956 |
identity_ret = server.post(f"/api/certificates/{ret.json['data']}/identity", content_type="application/json",
|
|
957 |
json=identity_details)
|
958 |
958 |
|
959 |
959 |
# assert valid HTTP status code and correct content type
|
960 |
960 |
assert identity_ret.status_code == 200
|
... | ... | |
963 |
963 |
|
964 |
964 |
def test_generate_identity_non_well_formed(server):
|
965 |
965 |
# non integer ID
|
966 |
|
identity_ret = server.get(f"/api/certificates/foo/identity", content_type="application/json",
|
967 |
|
json={})
|
|
966 |
identity_ret = server.post(f"/api/certificates/foo/identity", content_type="application/json",
|
|
967 |
json={})
|
968 |
968 |
assert identity_ret.status_code == 400
|
969 |
969 |
|
970 |
970 |
# required fields not passed
|
971 |
|
identity_ret = server.get(f"/api/certificates/0/identity", content_type="application/json",
|
972 |
|
json={})
|
|
971 |
identity_ret = server.post(f"/api/certificates/0/identity", content_type="application/json",
|
|
972 |
json={})
|
973 |
973 |
assert identity_ret.status_code == 400
|
974 |
974 |
assert identity_ret.json == E_IDENTITY_NAME_NOT_SPECIFIED
|
975 |
975 |
|
976 |
976 |
# passphrase not passed
|
977 |
|
identity_ret = server.get(f"/api/certificates/0/identity", content_type="application/json",
|
978 |
|
json={"name": "Foo"})
|
|
977 |
identity_ret = server.post(f"/api/certificates/0/identity", content_type="application/json",
|
|
978 |
json={"name": "Foo"})
|
979 |
979 |
assert identity_ret.status_code == 400
|
980 |
980 |
assert identity_ret.json == E_IDENTITY_PASSWORD_NOT_SPECIFIED
|
981 |
981 |
|
982 |
982 |
# name not passed
|
983 |
|
identity_ret = server.get(f"/api/certificates/0/identity", content_type="application/json",
|
984 |
|
json={"password": "foopass"})
|
|
983 |
identity_ret = server.post(f"/api/certificates/0/identity", content_type="application/json",
|
|
984 |
json={"password": "foopass"})
|
985 |
985 |
assert identity_ret.status_code == 400
|
986 |
986 |
assert identity_ret.json == E_IDENTITY_NAME_NOT_SPECIFIED
|
987 |
987 |
|
988 |
988 |
# certificate not existing
|
989 |
|
identity_ret = server.get(f"/api/certificates/0/identity", content_type="application/json",
|
990 |
|
json={"password": "foopass", "name": "Foo"})
|
|
989 |
identity_ret = server.post(f"/api/certificates/0/identity", content_type="application/json",
|
|
990 |
json={"password": "foopass", "name": "Foo"})
|
991 |
991 |
assert identity_ret.status_code == 404
|
992 |
992 |
assert identity_ret.json == E_NO_CERTIFICATES_FOUND
|
Re #8708 - Changed /api/certificates/{id}/identity endpoint method back to POST (facepalm)
Changed REST API tests accordingly.