-
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.
make action more simple + not found test
- Loading branch information
Showing
2 changed files
with
20 additions
and
14 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 |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
from structlog.testing import capture_logs | ||
|
||
from meldingen_core.actions.melding import ( | ||
ContactOptions, | ||
MeldingAddAttachmentsAction, | ||
MeldingAddContactAction, | ||
MeldingAnswerQuestionsAction, | ||
|
@@ -101,11 +100,24 @@ async def test_melding_add_contact_action() -> None: | |
|
||
action: MeldingAddContactAction[Melding, Melding] = MeldingAddContactAction(repository, token_verifier) | ||
|
||
contact_details: ContactOptions = {"phone": "1234567", "email": "[email protected]"} | ||
melding = await action(123, contact_details, token) | ||
phone = "1234567" | ||
email = "[email protected]" | ||
melding = await action(123, phone, email, token) | ||
|
||
assert melding.phone == contact_details["phone"] | ||
assert melding.email == contact_details["email"] | ||
assert melding.phone == phone | ||
assert melding.email == email | ||
|
||
|
||
@pytest.mark.anyio | ||
async def test_melding_add_contact_action_not_found() -> None: | ||
repository = Mock(BaseMeldingRepository) | ||
repository.retrieve.return_value = None | ||
token_verifier: TokenVerifier[Melding, Melding] = TokenVerifier(repository) | ||
|
||
action: MeldingAddContactAction[Melding, Melding] = MeldingAddContactAction(repository, token_verifier) | ||
|
||
with pytest.raises(NotFoundException): | ||
await action(123, "1234567", "[email protected]", "token") | ||
|
||
|
||
@pytest.mark.anyio | ||
|