當前位置: 首頁>>代碼示例>>Python>>正文


Python creds.Creds類代碼示例

本文整理匯總了Python中activedirectory.core.creds.Creds的典型用法代碼示例。如果您正苦於以下問題:Python Creds類的具體用法?Python Creds怎麽用?Python Creds使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Creds類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_acquire_multi

 def test_acquire_multi(self, conf):
     conf.require(ad_user=True)
     domain = conf.domain()
     principal = conf.ad_user_account()
     password = conf.ad_user_password()
     creds1 = ADCreds(domain)
     creds1.acquire(principal, password)
     ccache1 = creds1._ccache_name()
     config1 = creds1._config_name()
     assert ccache1 == os.environ['KRB5CCNAME']
     assert config1 == os.environ['KRB5_CONFIG']
     creds2 = ADCreds(domain)
     creds2.acquire(principal, password)
     ccache2 = creds2._ccache_name()
     config2 = creds2._config_name()
     assert ccache2 == os.environ['KRB5CCNAME']
     assert config2 == os.environ['KRB5_CONFIG']
     assert ccache1 != ccache2
     assert config1 != config2
     activate(creds1)
     assert os.environ['KRB5CCNAME'] == ccache1
     assert os.environ['KRB5_CONFIG'] == config1
     activate(creds2)
     assert os.environ['KRB5CCNAME'] == ccache2
     assert os.environ['KRB5_CONFIG'] == config2
開發者ID:theatlantic,項目名稱:python-active-directory,代碼行數:25,代碼來源:test_creds.py

示例2: test_add

 def test_add(self):
     self.require(ad_admin=True)
     domain = self.domain()
     creds = Creds(domain)
     creds.acquire(self.ad_admin_account(), self.ad_admin_password())
     activate(creds)
     client = Client(domain)
     user = self._create_user(client, 'test-usr')
     self._delete_obj(client, user)
開發者ID:mosutw,項目名稱:python-active-directory,代碼行數:9,代碼來源:test_client.py

示例3: test_search

 def test_search(self):
     self.require(ad_user=True)
     domain = self.domain()
     creds = Creds(domain)
     creds.acquire(self.ad_user_account(), self.ad_user_password())
     activate(creds)
     client = Client(domain)
     result = client.search('(objectClass=user)')
     assert len(result) > 1
開發者ID:mosutw,項目名稱:python-active-directory,代碼行數:9,代碼來源:test_client.py

示例4: test_delete

 def test_delete(self, conf):
     conf.require(ad_admin=True)
     domain = conf.domain()
     creds = Creds(domain)
     creds.acquire(conf.ad_admin_account(), conf.ad_admin_password())
     activate(creds)
     client = Client(domain)
     dn = utils.create_user(client, 'test-usr')
     client.delete(dn)
開發者ID:theatlantic,項目名稱:python-active-directory,代碼行數:9,代碼來源:test_client.py

示例5: test_naming_contexts

 def test_naming_contexts(self, conf):
     conf.require(ad_user=True)
     domain = conf.domain()
     creds = Creds(domain)
     creds.acquire(conf.ad_user_account(), conf.ad_user_password())
     activate(creds)
     client = Client(domain)
     naming_contexts = client.naming_contexts()
     assert len(naming_contexts) >= 3
開發者ID:theatlantic,項目名稱:python-active-directory,代碼行數:9,代碼來源:test_client.py

示例6: test_search_schema

 def test_search_schema(self):
     self.require(ad_user=True)
     domain = self.domain()
     creds = Creds(domain)
     creds.acquire(self.ad_user_account(), self.ad_user_password())
     activate(creds)
     client = Client(domain)
     base = client.schema_base()
     result = client.search('(objectClass=*)', base=base, scope='base')
     assert len(result) == 1
開發者ID:mosutw,項目名稱:python-active-directory,代碼行數:10,代碼來源:test_client.py

示例7: test_search

 def test_search(self, conf):
     pytest.skip('test disabled: hanging')
     conf.require(ad_user=True)
     domain = conf.domain()
     creds = Creds(domain)
     creds.acquire(conf.ad_user_account(), conf.ad_user_password())
     activate(creds)
     client = Client(domain)
     result = client.search('(objectClass=user)')
     assert len(result) > 1
開發者ID:theatlantic,項目名稱:python-active-directory,代碼行數:10,代碼來源:test_client.py

示例8: test_forest

 def test_forest(self, conf):
     conf.require(ad_user=True)
     domain = conf.domain()
     creds = Creds(domain)
     creds.acquire(conf.ad_user_account(), conf.ad_user_password())
     activate(creds)
     client = Client(domain)
     forest = client.forest()
     assert forest
     assert forest.isupper()
開發者ID:theatlantic,項目名稱:python-active-directory,代碼行數:10,代碼來源:test_client.py

示例9: test_search_configuration

 def test_search_configuration(self, conf):
     conf.require(ad_user=True)
     domain = conf.domain()
     creds = Creds(domain)
     creds.acquire(conf.ad_user_account(), conf.ad_user_password())
     activate(creds)
     client = Client(domain)
     base = client.configuration_base()
     result = client.search('(objectClass=*)', base=base, scope='base')
     assert len(result) == 1
開發者ID:theatlantic,項目名稱:python-active-directory,代碼行數:10,代碼來源:test_client.py

示例10: test_search_server

 def test_search_server(self, conf):
     conf.require(ad_user=True)
     domain = conf.domain()
     creds = Creds(domain)
     creds.acquire(conf.ad_user_account(), conf.ad_user_password())
     activate(creds)
     locator = Locator()
     server = locator.locate(domain)
     client = Client(domain)
     result = client.search('(objectClass=user)', server=server)
     assert len(result) > 1
開發者ID:theatlantic,項目名稱:python-active-directory,代碼行數:11,代碼來源:test_client.py

示例11: test_domains

 def test_domains(self, conf):
     conf.require(ad_user=True)
     domain = conf.domain()
     creds = Creds(domain)
     creds.acquire(conf.ad_user_account(), conf.ad_user_password())
     activate(creds)
     client = Client(domain)
     domains = client.domains()
     for domain in domains:
         assert domain
         assert domain.isupper()
開發者ID:theatlantic,項目名稱:python-active-directory,代碼行數:11,代碼來源:test_client.py

示例12: test_search_all_domains

 def test_search_all_domains(self, conf):
     conf.require(ad_user=True)
     domain = conf.domain()
     creds = Creds(domain)
     creds.acquire(conf.ad_user_account(), conf.ad_user_password())
     activate(creds)
     client = Client(domain)
     domains = client.domains()
     for domain in domains:
         base = client.dn_from_domain_name(domain)
         result = client.search('(objectClass=*)', base=base, scope='base')
         assert len(result) == 1
開發者ID:theatlantic,項目名稱:python-active-directory,代碼行數:12,代碼來源:test_client.py

示例13: test_modify

 def test_modify(self, conf):
     conf.require(ad_admin=True)
     domain = conf.domain()
     creds = Creds(domain)
     creds.acquire(conf.ad_admin_account(), conf.ad_admin_password())
     activate(creds)
     client = Client(domain)
     user = utils.create_user(client, 'test-usr')
     mods = []
     mods.append(('replace', 'sAMAccountName', ['test-usr-2']))
     client.modify(user, mods)
     delete_obj(client, user)
開發者ID:theatlantic,項目名稱:python-active-directory,代碼行數:12,代碼來源:test_client.py

示例14: test_load

 def test_load(self, conf):
     conf.require(ad_user=True)
     domain = conf.domain().upper()
     principal = '%[email protected]%s' % (conf.ad_user_account(), domain)
     conf.acquire_credentials(principal, conf.ad_user_password())
     creds = ADCreds(domain)
     creds.load()
     assert creds.principal().lower() == principal.lower()
     ccache, princ, creds = conf.list_credentials()
     assert princ.lower() == principal.lower()
     assert len(creds) > 0
     assert creds[0] == 'krbtgt/%[email protected]%s' % (domain, domain)
開發者ID:theatlantic,項目名稱:python-active-directory,代碼行數:12,代碼來源:test_creds.py

示例15: test_acquire_password

 def test_acquire_password(self, conf):
     conf.require(ad_user=True)
     domain = conf.domain()
     creds = ADCreds(domain)
     principal = conf.ad_user_account()
     password = conf.ad_user_password()
     creds.acquire(principal, password)
     principal = '%[email protected]%s' % (principal, domain)
     assert creds.principal().lower() == principal.lower()
     child = pexpect.spawn('klist')
     pattern = '.*krbtgt/%[email protected]%s' % (domain.upper(), domain.upper())
     assert child.expect([pattern]) == 0
開發者ID:theatlantic,項目名稱:python-active-directory,代碼行數:12,代碼來源:test_creds.py


注:本文中的activedirectory.core.creds.Creds類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。