Skip to content

Commit

Permalink
Fixing tests, and resend invites endpoint.
Browse files Browse the repository at this point in the history
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
  • Loading branch information
xlorepdarkhelm committed Nov 1, 2024
1 parent 30d2b23 commit da68717
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/service_invite/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ def resend_service_invite(service_id, invited_user_id):
invited_user_id=invited_user_id,
)

nonce = request.json["nonce"]
state = request.json["state"]

fetched.created_at = utc_now()
fetched.status = InvitedUserStatus.PENDING

Expand All @@ -163,7 +166,7 @@ def resend_service_invite(service_id, invited_user_id):

save_invited_user(update_dict)

_create_service_invite(fetched, current_app.config["ADMIN_BASE_URL"])
_create_service_invite(fetched, nonce, state)

return jsonify(data=invited_user_schema.dump(fetched)), 200

Expand Down
4 changes: 4 additions & 0 deletions tests/app/service_invite/test_service_invite_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def test_create_invited_user(
auth_type=AuthType.EMAIL,
folder_permissions=["folder_1", "folder_2", "folder_3"],
nonce="FakeNonce",
state="FakeState",
**extra_args,
)

Expand Down Expand Up @@ -110,6 +111,7 @@ def test_create_invited_user_without_auth_type(
"permissions": "send_messages,manage_service,manage_api_keys",
"folder_permissions": [],
"nonce": "FakeNonce",
"state": "FakeState",
}

json_resp = admin_request.post(
Expand All @@ -134,6 +136,7 @@ def test_create_invited_user_invalid_email(client, sample_service, mocker, fake_
"permissions": "send_messages,manage_service,manage_api_keys",
"folder_permissions": [fake_uuid, fake_uuid],
"nonce": "FakeNonce",
"state": "FakeState",
}

data = json.dumps(data)
Expand Down Expand Up @@ -235,6 +238,7 @@ def test_resend_expired_invite(
response = client.post(
url,
headers=[("Content-Type", "application/json"), auth_header],
data='{"nonce": "FakeNonce", "state": "FakeState"}',
)

assert response.status_code == 200
Expand Down

0 comments on commit da68717

Please sign in to comment.