Beispiel #1
0
class TestIdentityCreate(OpenAMTestCase):
    "Tests that the admin user perform create and delete operations on identities"
    def setUp(self):
            self.context = Context(self.url)
            self.user=User(self.context, self.username, self.password)

    def tearDown(self):
        if self.user:
            if self.user.is_valid():
                self.user.logout()

    def test_create_identity(self):
        self.identity = self.context.create_identity( self.user.tokenId, 'testuser', 'password', '*****@*****.**' )
        self.assertIsInstance( self.identity, Identity )
        self.assertTrue( self.user.tokenId, self.context.delete_identity() )
Beispiel #2
0
class TestUser(OpenAMTestCase):
    "Tests that the admin user can login and out"
    def setUp(self):
            self.context = Context(self.url)
            self.user = None

    def tearDown(self):
        if self.user:
            if self.user.is_valid():
                self.user.logout()
        
    def test_login(self):
        self.user=User(self.context, self.username, self.password)
        self.assertTrue(self.user.is_valid())
        self.assertIsInstance( self.user.identity, Identity )
        self.user.logout()
        self.assertFalse(self.user.is_valid())
        
    def test_callback_login(self):
        self.user=User(self.context)
        self.user.callback_login(NameCallback=self.username, PasswordCallback=self.password )
        self.assertTrue(self.user.is_valid())
        self.user.logout()
        self.assertFalse(self.user.is_valid())

    def test_change_password(self):
        self.user=User(self.context, self.username, self.password)
        self.assertTrue(self.user.is_valid())

        self.user.change_password('newpassword')
        self.user.logout()

        self.user=User(self.context, self.username, 'newpassword')
        self.assertTrue(self.user.is_valid())

        self.user.change_password(self.password)
        self.user.logout()