def test_can_delete_user(self): """Should be able to remove a user""" username = "******" email = "*****@*****.**" password = "******" Users.register_user(username, email, password) Users.delete_user(username) # Make sure the user does not exist anymore user = Users.find_user(username) self.assertIsNone(user)
def test_can_register_user(self): """Should be able to register a user""" username = "******" email = "*****@*****.**" password = "******" Users.register_user(username, email, password) # Make sure the user now exists in the system user = Users.find_user(username) self.assertIsNotNone(user) # Clean up Users.delete_user(username)
def test_can_unenroll_user_in_service(self): user = get_mock_user() service_info = dict(service_name="vanguard") service_info["username"] = "******" service_info["password"] = "******" security_questions = { "What was your first pet's name?": "poopie", "What is the name of your elementary school": "chewbaca" } service_info["security_questions"] = security_questions Users.enroll_in_service(user['user'], service_info) Users.unenroll_from_service(user['user'], "vanguard") user = Users.find_user(user['user']) self.assertIsNone(user.get('services', {}).get("vanguard")) remove_mock_user()
def get_mock_user(): username = "******" email = "*****@*****.**" password = "******" Users.register_user(username, email, password) return Users.find_user(username)