Ejemplo n.º 1
0
 def test_admin_get_account_authToken2(self):
     """ From an account name """
     authToken, lifetime = self.zc.get_account_authToken(
         account_name=self.LAMBDA_USER)
     new_zc = ZimbraAccountClient(self.HOST)
     new_zc.login_with_authToken(authToken, lifetime)
     self.assertTrue(new_zc._session.is_logged_in())
     self.assertTrue(new_zc.is_session_valid())
Ejemplo n.º 2
0
    def test_account_delegated_login(self):
        admin_zc = ZimbraAdminClient(TEST_CONF['host'],
                                     TEST_CONF['admin_port'])
        admin_zc.login(TEST_CONF['admin_login'], TEST_CONF['admin_password'])

        new_zc = ZimbraAccountClient(TEST_CONF['host'])
        new_zc.delegated_login(TEST_CONF['lambda_user'], admin_zc)

        self.assertTrue(new_zc._session.is_logged_in())
        self.assertTrue(new_zc.is_session_valid())
Ejemplo n.º 3
0
    def test_create_get_update_rename_delete_account(self):
        name = 'test-{}@zimbratest.example.com'.format(random.randint(
            0, 10**9))
        password = '******'
        ac_req = Account(name=name)

        with self.assertRaises(ZimbraSoapServerError):
            self.zc.get_account(ac_req)

        # CREATE
        ac = self.zc.create_account(name, password)

        self.assertIsInstance(ac, Account)
        self.assertEqual(ac.name, name)

        # GET
        ac_got = self.zc.get_account(ac_req)
        self.assertIsInstance(ac_got, Account)
        self.assertEqual(ac_got.name, name)

        # UPDATE
        random_name_1 = 'test-{}'.format(random.randint(0, 10**9))
        self.zc.modify_account(ac_got, {'displayName': random_name_1})

        ac_got = self.zc.get_account(ac_req)
        self.assertEqual(ac_got['displayName'], random_name_1)

        # MODIFY PASSWORD
        new_password = '******'
        self.zc.set_password(ac, new_password)

        act_zc = ZimbraAccountClient(TEST_CONF['host'],
                                     TEST_CONF['https_port'])

        try:
            act_zc.login(ac.name, new_password)
        except ZimbraSoapServerError:
            self.fail('self.zc.set_password has failed to change password')

        # RENAME
        self.zc.rename_account(ac_got,
                               '*****@*****.**')

        renamed_ac_got = self.zc.get_account(
            Account(name='*****@*****.**'))
        self.assertEqual(renamed_ac_got['mail'],
                         '*****@*****.**')

        # DELETE
        self.zc.delete_account(renamed_ac_got)

        with self.assertRaises(ZimbraSoapServerError):
            self.zc.get_account(ac)
Ejemplo n.º 4
0
 def setUpClass(cls):
     # Login/connection is done at class initialization to reduce tests time
     cls.zc = ZimbraAccountClient(TEST_CONF['host'])
     cls.zc.login(TEST_CONF['lambda_user'], TEST_CONF['lambda_password'])