Skip to content

Commit 59ab3eb

Browse files
committed
testing registration happy path
1 parent 6401db2 commit 59ab3eb

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

app/ch14_testing/final/.idea/dictionaries/screencaster.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/ch14_testing/final/tests/account_tests.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from pypi_org.viewmodels.account.register_viewmodel import RegisterViewModel
22
from tests.test_client import flask_app
3-
3+
import unittest.mock
44

55
def test_example():
66
print("Test example...")
@@ -21,7 +21,9 @@ def test_register_validation_when_valid():
2121
vm = RegisterViewModel()
2222

2323
# Act
24-
vm.validate()
24+
target = 'pypi_org.services.user_service.find_user_by_email'
25+
with unittest.mock.patch(target, return_value=None):
26+
vm.validate()
2527

2628
# Assert
2729
assert vm.error is None

0 commit comments

Comments
 (0)