-
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.
* add contact to melding model and add action * formatting and mypy * add test and fix mypy * rename to something more precise * make action more simple + not found test * remove unused import
- Loading branch information
Showing
4 changed files
with
59 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
version: "3" | ||
|
||
services: | ||
meldingen-core: | ||
image: amsterdam/meldingen-core | ||
|
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
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
|
||
from meldingen_core.actions.melding import ( | ||
MeldingAddAttachmentsAction, | ||
MeldingAddContactAction, | ||
MeldingAnswerQuestionsAction, | ||
MeldingCompleteAction, | ||
MeldingCreateAction, | ||
|
@@ -90,6 +91,35 @@ async def test_melding_update_action() -> None: | |
assert melding.classification == classification | ||
|
||
|
||
@pytest.mark.anyio | ||
async def test_melding_add_contact_action() -> None: | ||
token = "123456" | ||
repository = Mock(BaseMeldingRepository) | ||
repository.retrieve.return_value = Melding("text", token=token, token_expires=datetime.now() + timedelta(days=1)) | ||
token_verifier = AsyncMock(TokenVerifier) | ||
|
||
action: MeldingAddContactAction[Melding, Melding] = MeldingAddContactAction(repository, token_verifier) | ||
|
||
phone = "1234567" | ||
email = "[email protected]" | ||
melding = await action(123, phone, email, token) | ||
|
||
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 | ||
async def test_melding_answer_questions_action() -> None: | ||
state_machine = Mock(BaseMeldingStateMachine) | ||
|