예제 #1
0
class AuthenticatorTest(unittest.TestCase):
    def setUp(self):
        self.authenticator = Authenticator()
        self.authenticator.add_user("joe", "joepassword")

    @unittest.skip("this is useless")
    def test_add_user(self):
        self.authenticator.add_user("joe", "joepassword")
        self.assertTrue("joe" in self.authenticator.users.keys())

    def test_login(self):
        self.assertTrue(self.authenticator.login("joe", "joepassword"))
예제 #2
0
class AuthorizorTest(unittest.TestCase):
    """docstring for AuthorizorTest"""
    def setUp(self):
        self.authenticator = Authenticator()
        self.authenticator.add_user("joe", "joepassword")
        self.authenticator.login("joe", "joepassword")
        self.authorizor = Authorizor(self.authenticator)
        self.authorizor.add_permission("paint")

    @unittest.skip("this is useless")
    def test_add_permission(self):
        self.authorizor.add_permission("paint")
        self.assertTrue("paint" in self.authorizor.permissions.keys())

    def test_check_permission(self):
        self.authorizor.permit_user("paint", "joe")
        self.authorizor.check_permission("paint", "joe")