Example #1
0
    def test_enabled(self):
        """Testing function enabled."""
        # Test existing attribute
        user_ = _insert_random_user()
        modify = user.Modify(user_.username)

        # Test modification
        new = bool(randint(0, 1))
        modify.enabled(new)
        result = user.User(user_.username)
        self.assertEqual(result.enabled, new)
Example #2
0
    def test_role(self):
        """Testing function role."""
        # Test existing attribute
        user_ = _insert_random_user()
        modify = user.Modify(user_.username)

        # Test modification
        new = randint(0, 99)
        modify.role(new)
        result = user.User(user_.username)
        self.assertEqual(result.role, new)
Example #3
0
    def test_last_name(self):
        """Testing function last_name."""
        # Test existing attribute
        user_ = _insert_random_user()
        modify = user.Modify(user_.username)

        # Test modification
        new = data.hashstring(str(random()))
        modify.last_name(new)
        result = user.User(user_.username)
        self.assertEqual(result.last_name, new)
Example #4
0
    def test_password(self):
        """Testing function password."""
        # Test existing attribute
        user_ = _insert_random_user()
        modify = user.Modify(user_.username)

        # Test modification
        new = data.hashstring(str(random()))
        modify.password(new)
        result = user.User(user_.username)
        self.assertTrue(result.valid_password(new))
Example #5
0
 def test___init__(self):
     """Testing function __init__."""
     # Try bad username
     with self.assertRaises(SystemExit):
         user.Modify(data.hashstring(str(random())))