def test_add_user_with_short_password(self): with self.assertRaises(PasswordTooShort): authenticator.add_user('user_1', 'pwd')
def test_check_permission_not_permitted_user(self): authenticator.add_user('user_2', 'user2pwd') authenticator.login('user_2', 'user2pwd') with self.assertRaises(NotPermittedError): authorizor.check_permission('test', 'user_2')
def test_add_user(self): authenticator.add_user("tim", "struppi") self.assertTrue("frank" in authenticator.users)
def test_add_user_with_same_name(self): authenticator.add_user('user', 'usrpwd') with self.assertRaises(UsernameAlreadyExist): authenticator.add_user('user', 'usrpwd')
def test_exception_password_too_short(self): with self.assertRaises(PasswordTooShort): authenticator.add_user("struppi", "tim")
def test_exception_username_exists(self): with self.assertRaises(UsernameAlreadyExists): authenticator.add_user('frank', 'number2')
def setUp(self): authenticator.add_user("frank", "thetank")