def create_connection_authenticate(self): """Create UMC connection and authenticate""" try: self.client = Client.get_test_connection() except (HTTPError, ConnectionError) as exc: print("An error while trying to authenticate to UMC: %r" % exc) print "Waiting 5 seconds and making another attempt" sleep(5) self.client = Client.get_test_connection() self.username = self.client.username self.password = self.client.password self.hostname = self.client.hostname
def __init__(self, connection=None, ucr=None, name=None, typ=None, domains=None, wlan=None, priority=None): self.name = name if name else uts.random_string() self.typ = typ if typ else random.choice(['whitelist', 'blacklist']) if domains: self.domains = domains else: dom = RandomDomain() domains = dom.getDomainList(random.randint(1, 10)) self.domains = sorted(domains) if isinstance(wlan, bool): self.wlan = wlan else: self.wlan = random.choice([True, False]) self.priority = priority if priority else random.randint(1, 10) self.ucr = ucr if ucr else ucr_test.UCSTestConfigRegistry() if connection: self.client = connection else: self.client = Client.get_test_connection()
def __init__( self, school, room, # room dn examEndTime, # in format "HH:mm" recipients, # list of classes dns name=None, directory=None, files=[], shareMode="home", internetRule="none", customRule='', connection=None ): self.school = school self.room = room self.examEndTime = examEndTime self.recipients = recipients self.name = name if name else uts.random_name() self.directory = directory if directory else self.name self.files = files self.shareMode = shareMode self.internetRule = internetRule self.customRule = customRule if connection: self.client = connection else: self.client = Client.get_test_connection()
def __init__(self, school, groupRuleCouples, connection=None, ucr=None): self.school = school self.groupRuleCouples = groupRuleCouples self.ucr = ucr if ucr else ucr_test.UCSTestConfigRegistry() if connection: self.client = connection else: self.ucr.load() self.client = Client.get_test_connection()
def __init__(self, school, connection=None, ucr=None, name=None, users=None, description=None): self.school = school self.users = users or [] self.name = name if name else uts.random_string() self.description = description if description else uts.random_string() self.ucr = ucr if ucr else ucr_test.UCSTestConfigRegistry() self.ucr.load() if connection: self.client = connection else: self.client = Client.get_test_connection(self.ucr.get('ldap/master'))
def test_run_diagnostic_checks(): client = Client.get_test_connection() plugins = [plugin['id'] for plugin in client.umc_command('diagnostic/query').result if plugin['id'] not in SKIPPED_TESTS] account = utils.UCSTestDomainAdminCredentials() with tempfile.NamedTemporaryFile() as fd: fd.write(account.bindpw) fd.flush() args = ['/usr/bin/univention-run-diagnostic-checks', '--username', account.username, '--bindpwdfile', fd.name, '-t'] + plugins print(args) returncode = subprocess.call(args) assert 0 == returncode, 'Exit code != 0: %d' % (returncode,)
def test_run_diagnostic_checks(): client = Client.get_test_connection() plugins = client.umc_command('diagnostic/query').result failures = [] for plugin in plugins: if plugin['id'] in SKIPPED_TESTS: print 'SKIP %s' % plugin['id'] continue result = client.umc_command('diagnostic/run', { 'plugin': plugin['id'] }).result if result['type'] != 'success': failures.extend([ '############################', '## Check failed: %s - %s' % (plugin['id'], result['title']), result['description'], '########### End #############', ]) if failures: raise Exception('\n'.join(failures))
def __init__(self, school, connection=None, ulConnection=None, ucr=None, name=None, description=None, members=None): self.school = school self.name = name if name else uts.random_string() self.description = description if description else uts.random_string() self.members = members if members else [] self.ucr = ucr if ucr else ucr_test.UCSTestConfigRegistry() self.ucr.load() if ulConnection: self.ulConnection = ulConnection else: self.ulConnection = uu.getMachineConnection(ldap_master=False) if connection: self.client = connection else: self.client = Client.get_test_connection()
def __init__(self): self.client = Client.get_test_connection()