109526520: Implement verify flow

When a person registers with a valid mobile number and email address,
a code will be sent to each. That person can enter the verify codes and continue to the add-service page.
This commit is contained in:
Rebecca Law
2015-12-07 16:08:30 +00:00
parent 56db1ad400
commit 16618e80f9
8 changed files with 122 additions and 22 deletions

View File

@@ -119,3 +119,23 @@ def test_user_is_active_is_false_if_state_is_inactive(notifications_admin, notif
saved_user = users_dao.get_user_by_id(user.id)
assert saved_user.is_active() is False
def test_should_update_user_to_active(notifications_admin, notifications_admin_db):
user = User(name='Make user active',
password='somepassword',
email_address='activate@user.gov.uk',
mobile_number='+441234123412',
created_at=datetime.now(),
role_id=1,
state='pending')
users_dao.insert_user(user)
users_dao.activate_user(user.id)
updated_user = users_dao.get_user_by_id(user.id)
assert updated_user.state == 'active'
def test_should_throws_error_when_id_does_not_exist(notifications_admin, notifications_admin_db):
with pytest.raises(AttributeError) as error:
users_dao.activate_user(123)
assert '''object has no attribute 'state''''' in str(error.value)