def test_check_poor_password(init_db): new_user = User("*****@*****.**", ) auth_code = Utils.generate_auth_code() new_user.password = Utils.hash_password(auth_code) with pytest.raises(UserErrors.PoorPasswordError): new_user.check_registration_password_same_as_auth_code( auth_code, new_user.password) new_user.delete_by_email()
def send_auth_code_email(self): auth_code = Utils.generate_auth_code() self.password = Utils.hash_password(auth_code) self.insert_user_in_db() return requests.post( UserConstants.URL, auth=("api", UserConstants.API_KEY), data={ "from": UserConstants.FROM, "to": self.email, "subject": "Task Manager App", "text": 'Welcome to Task Manager App! \n\n' 'Task Manager helps you keep track of tasks ' 'Please click here visit ({}) and enter your authorisation code on the registration page: \n\n' '{}'.format(UserConstants.AUTH_URL, auth_code) })