forked from cfpb/sbl-filing-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(user_actions): Fix accept_submission action creation, remove…
… submission_id from signing action closes cfpb#551
- Loading branch information
1 parent
1453629
commit 24df850
Showing
2 changed files
with
20 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -914,8 +914,8 @@ async def test_accept_submission(self, mocker: MockerFixture, app_fixture: FastA | |
|
||
user_action_accept = UserActionDAO( | ||
id=3, | ||
user_id="1234-5678-ABCD-EFGH", | ||
user_name="test accepter", | ||
user_id="123456-7890-ABCDEF-GHIJ", | ||
user_name="Test User", | ||
user_email="[email protected]", | ||
action_type=UserActionType.ACCEPT, | ||
timestamp=datetime.datetime.now(), | ||
|
@@ -932,9 +932,6 @@ async def test_accept_submission(self, mocker: MockerFixture, app_fixture: FastA | |
user_actions=[user_action_submit], | ||
) | ||
|
||
update_accepter_mock = mocker.patch("sbl_filing_api.entities.repos.submission_repo.add_user_action") | ||
update_accepter_mock.return_value = user_action_accept | ||
|
||
update_mock = mocker.patch("sbl_filing_api.entities.repos.submission_repo.update_submission") | ||
update_mock.return_value = SubmissionDAO( | ||
id=1, | ||
|
@@ -958,22 +955,23 @@ async def test_accept_submission(self, mocker: MockerFixture, app_fixture: FastA | |
mock.return_value.state = SubmissionState.VALIDATION_SUCCESSFUL | ||
res = client.put("/v1/filing/institutions/1234567890ZXWVUTSR00/filings/2024/submissions/4/accept") | ||
update_mock.assert_called_once() | ||
update_accepter_mock.assert_called_once_with( | ||
ANY, | ||
UserActionDTO( | ||
user_id="123456-7890-ABCDEF-GHIJ", | ||
user_name="Test User", | ||
user_email="[email protected]", | ||
action_type=UserActionType.ACCEPT, | ||
), | ||
) | ||
submission_arg = update_mock.call_args.args[-1] | ||
accepter = submission_arg.user_actions[-1] | ||
assert accepter.id is None | ||
assert accepter.timestamp is None | ||
assert accepter.filing_id == 1 | ||
assert accepter.submission_id == 1 | ||
assert accepter.user_id == "123456-7890-ABCDEF-GHIJ" | ||
assert accepter.user_name == "Test User" | ||
assert accepter.user_email == "[email protected]" | ||
assert accepter.action_type == UserActionType.ACCEPT | ||
|
||
assert res.json()["state"] == "SUBMISSION_ACCEPTED" | ||
assert res.json()["id"] == 1 | ||
assert res.json()["counter"] == 4 | ||
assert res.json()["accepter"]["id"] == 3 | ||
assert res.json()["accepter"]["user_id"] == "1234-5678-ABCD-EFGH" | ||
assert res.json()["accepter"]["user_name"] == "test accepter" | ||
assert res.json()["accepter"]["user_id"] == "123456-7890-ABCDEF-GHIJ" | ||
assert res.json()["accepter"]["user_name"] == "Test User" | ||
assert res.json()["accepter"]["user_email"] == "[email protected]" | ||
assert res.json()["accepter"]["action_type"] == UserActionType.ACCEPT | ||
assert res.status_code == 200 | ||
|
@@ -1042,7 +1040,6 @@ async def test_good_sign_filing( | |
ANY, | ||
UserActionDTO( | ||
filing_id=1, | ||
submission_id=1, | ||
user_id="123456-7890-ABCDEF-GHIJ", | ||
user_name="Test User", | ||
user_email="[email protected]", | ||
|