Created
September 17, 2018 13:18
-
-
Save prcutler/fb7d4ff30561e17a85edfd71e9135293 to your computer and use it in GitHub Desktop.
NFLPool Account unittest
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
import unittest | |
import unittest.mock | |
import pyramid.testing | |
class AccountControllerTests(unittest.TestCase): | |
def test_register_validation_no_email(self): | |
# Arrange | |
from nflpool.viewmodels.register_viewmodel import RegisterViewModel | |
request = pyramid.testing.DummyRequest() | |
request.POST = { | |
'first_name': 'Paul', | |
'last_name': 'Cutler', | |
'email': 'paul.r.cutler@gmail.com', | |
'password': '', | |
'confirm_password': '' | |
} | |
# noinspection PyTypeChecker | |
vm = RegisterViewModel(request) | |
# Act | |
vm.validate() | |
# Assert: | |
self.assertIsNotNone(vm.error) | |
self.assertTrue('password' in vm.error) |
Author
prcutler
commented
Sep 17, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment