if exit_code: sys.exit(exit_code) # Now kill the last http server os.killpg(http_server.pid, signal.SIGTERM) self.processes.remove(http_server) def run(self, env): for version in range(ipsilon.util.data.CURRENT_SCHEMA_VERSION): self.test_upgrade_from(env, version) if __name__ == '__main__': from_version = sys.argv[1] idpname = sys.argv[2] url = sys.argv[3] user = pwd.getpwuid(os.getuid())[0] sess = HttpSessions() sess.add_server(idpname, 'https://%s' % url, user, 'ipsilon') print "dbupgrades: From v%s: Authenticate to IDP ..." % from_version, try: sess.auth_to_idp(idpname) except Exception, e: # pylint: disable=broad-except print >> sys.stderr, " ERROR: %s" % repr(e) sys.exit(1) print " SUCCESS"
conf = self.setup_http(name, addr, port) testdir = os.path.dirname(os.path.abspath(inspect.getfile( inspect.currentframe()))) fixup_sp_httpd(os.path.dirname(conf), testdir) print "Starting SP's httpd server" self.start_http_server(conf, env) if __name__ == '__main__': idpname = 'idp1' sp1name = 'sp1' user = pwd.getpwuid(os.getuid())[0] sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'ipsilon') sess.add_server(sp1name, 'https://127.0.0.11:45081') print "openid: Authenticate to IDP ...", try: sess.auth_to_idp(idpname) except Exception as e: # pylint: disable=broad-except print >> sys.stderr, " ERROR: %s" % repr(e) sys.exit(1) print " SUCCESS" print "openid: Run OpenID Protocol ...", try: page = sess.fetch_page(idpname, 'https://127.0.0.11:45081/?extensions=NO')
fixup_sp_httpd(os.path.dirname(conf)) print "Starting SP's httpd server" self.start_http_server(conf, env) if __name__ == '__main__': idpname = 'idp1' user = pwd.getpwuid(os.getuid())[0] sp = sp_list[0] spurl = 'https://%s:%s' % (sp['addr'], sp['port']) # Set global mapping and allowed attributes, then test fetch from # SP. sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'ipsilon') sess.add_server(sp['name'], spurl) print "testmapping: Authenticate to IDP ...", try: sess.auth_to_idp(idpname) except Exception, e: # pylint: disable=broad-except print >> sys.stderr, " ERROR: %s" % repr(e) sys.exit(1) print " SUCCESS" print "testmapping: Add SP Metadata to IDP ...", try: sess.add_sp_metadata(idpname, sp['name']) except Exception, e: # pylint: disable=broad-except
sp2name = 'sp2' user = pwd.getpwuid(os.getuid())[0] testdir = os.environ['TESTDIR'] krb5conf = os.path.join(testdir, 'krb5.conf') kenv = { 'PATH': '/sbin:/bin:/usr/sbin:/usr/bin', 'KRB5_CONFIG': krb5conf, 'KRB5CCNAME': 'FILE:' + os.path.join(testdir, 'ccaches/user') } for key in kenv: os.environ[key] = kenv[key] sess = HttpSessions() sess.add_server(idpname, 'https://%s:45080' % WRAP_HOSTNAME, user, 'ipsilon') sess.add_server(sp1name, 'https://127.0.0.11:45081') sess.add_server(sp2name, 'https://127.0.0.11:45082') with TC.case('Authenticate to IdP'): sess.auth_to_idp(idpname, krb=True) with TC.case('Add first SP Metadata to IdP'): sess.add_sp_metadata(idpname, sp1name) with TC.case('Access first SP Protected Area'): page = sess.fetch_page(idpname, 'https://127.0.0.11:45081/sp/') page.expected_value('text()', 'WORKS!')
conf = self.setup_sp_server(sp, name, addr, port, env) os.remove(os.path.dirname(sp) + '/pw.txt') fixup_sp_httpd(os.path.dirname(conf)) print "Starting second SP's httpd server" self.start_http_server(conf, env) if __name__ == '__main__': idpname = 'idp1' sp1name = 'sp1' sp2name = 'sp2-test.example.com' user = pwd.getpwuid(os.getuid())[0] sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'ipsilon') sess.add_server(sp1name, 'https://127.0.0.11:45081') sess.add_server(sp2name, 'https://127.0.0.11:45082') print "test1: Authenticate to IDP ...", try: sess.auth_to_idp(idpname) except Exception, e: # pylint: disable=broad-except print >> sys.stderr, " ERROR: %s" % repr(e) sys.exit(1) print " SUCCESS" print "test1: Add first SP Metadata to IDP ...", try: sess.add_sp_metadata(idpname, sp1name)
conf = self.setup_sp_server(sp, name, addr, port, env) os.remove(os.path.dirname(sp) + '/pw.txt') fixup_sp_httpd(os.path.dirname(conf)) self.setup_step("Starting second SP's httpd server") self.start_http_server(conf, env) if __name__ == '__main__': idpname = 'idp1' sp1name = 'sp1' sp2name = 'sp2-test.example.com' user = pwd.getpwuid(os.getuid())[0] sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'ipsilon') sess.add_server(sp1name, 'https://127.0.0.11:45081') sess.add_server(sp2name, 'https://127.0.0.11:45082') with TC.case('Authenticate to IdP'): sess.auth_to_idp(idpname) with TC.case('Add first SP Metadata to IdP'): sess.add_sp_metadata(idpname, sp1name) with TC.case('Access first SP Protected Area'): page = sess.fetch_page(idpname, 'https://127.0.0.11:45081/sp/') page.expected_value('text()', 'WORKS!') with TC.case('Access second SP Protected Area'):
conf = self.setup_http(name, addr, port) testdir = os.path.dirname(os.path.abspath(inspect.getfile( inspect.currentframe()))) fixup_sp_httpd(os.path.dirname(conf), testdir) self.setup_step("Starting SP's httpd server") self.start_http_server(conf, env) if __name__ == '__main__': idpname = 'idp1' sp1name = 'sp1' user = pwd.getpwuid(os.getuid())[0] sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'ipsilon') sess.add_server(sp1name, 'https://127.0.0.11:45081') with TC.case('Authenticate to IdP'): sess.auth_to_idp(idpname) with TC.case('Run OpenID Protocol'): page = sess.fetch_page(idpname, 'https://127.0.0.11:45081/?extensions=NO', require_consent=True) page.expected_value('text()', 'SUCCESS, WITHOUT EXTENSIONS') with TC.case('Run OpenID Protocol without consent'): page = sess.fetch_page(idpname, 'https://127.0.0.11:45081/?extensions=NO',
fixup_sp_httpd(os.path.dirname(spconf)) fixup_idp_conf(self.testdir) print "Starting IDP's httpd server" self.start_http_server(idpconf, env) print "Starting SP's httpd server" self.start_http_server(spconf, env) if __name__ == '__main__': user = pwd.getpwuid(os.getuid())[0] sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'ipsilon') sess.add_server(spname, 'https://127.0.0.11:45081') print "fconf: Access IdP Homepage ... ", try: page = sess.fetch_page(idpname, 'https://127.0.0.10:45080/idp1/') page.expected_value('//title/text()', 'Ipsilon') except ValueError, e: print >> sys.stderr, " ERROR: %s" % repr(e) sys.exit(1) print " SUCCESS" print "fconf: Access SP Protected Area ...", try: page = sess.fetch_page(idpname, 'https://127.0.0.11:45081/sp/')
'ipsilon/install/ipsilon-upgrade-database'), cfgfile ] subprocess.check_call(cmd, cwd=os.path.join(self.testdir, 'lib', idpname), env=env, stdout=self.stdout, stderr=self.stderr) self.setup_step("Starting IDP's httpd server") self.start_http_server(idpconf, env) self.setup_step("Starting SP's httpd server") self.start_http_server(spconf, env) if __name__ == '__main__': user = pwd.getpwuid(os.getuid())[0] sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'ipsilon') sess.add_server(spname, 'https://127.0.0.11:45081') with TC.case('Access IdP homepage'): page = sess.fetch_page(idpname, 'https://127.0.0.10:45080/idp1/') page.expected_value('//title/text()', 'Ipsilon') with TC.case('Access SP protected area'): page = sess.fetch_page(idpname, 'https://127.0.0.11:45081/sp/') page.expected_value('text()', 'WORKS!')
fixup_sp_httpd(os.path.dirname(conf)) self.setup_step("Starting SP's httpd server") self.start_http_server(conf, env) if __name__ == '__main__': idpname = 'idp1' user = pwd.getpwuid(os.getuid())[0] sp = sp_list[0] spurl = 'https://%s:%s' % (sp['addr'], sp['port']) # Set global mapping and allowed attributes, then test fetch from # SP. sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'ipsilon') sess.add_server(sp['name'], spurl) with TC.case('Authenticate to IdP'): sess.auth_to_idp(idpname) with TC.case('Add SP Metadata to IdP'): sess.add_sp_metadata(idpname, sp['name']) with TC.case('Test default mapping and attrs'): expect = { 'NAME_ID': user, 'fullname': 'Test User %s' % user, 'surname': user, 'givenname': u'Test User 一',
conf = self.setup_sp_server(sp, name, addr, port, env) os.remove(os.path.dirname(sp) + '/pw.txt') fixup_sp_httpd(os.path.dirname(conf)) self.setup_step("Starting second SP's httpd server") self.start_http_server(conf, env) if __name__ == '__main__': idpname = 'idp1' sp1name = 'sp1' sp2name = 'sp2-test.example.com' user = pwd.getpwuid(os.getuid())[0] sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'ipsilon') sess.add_server(sp1name, 'https://127.0.0.11:45081') sess.add_server(sp2name, 'https://127.0.0.11:45082') with TC.case('Authenticate to IDP'): sess.auth_to_idp(idpname) with TC.case('Add first SP metadata to IDP'): sess.add_sp_metadata(idpname, sp1name) with TC.case('Make sure we send no RelayState if none was requested'): page = sess.fetch_page(idpname, 'https://127.0.0.11:45081/sp/', follow_redirect=1) # Cut off the RelayState
krb5conf = os.path.join(testdir, "krb5.conf") kenv = { "PATH": "/sbin:/bin:/usr/sbin:/usr/bin", "KRB5_CONFIG": krb5conf, "KRB5CCNAME": "FILE:" + os.path.join(testdir, "ccaches/user"), } for kkey in kenv: os.environ[kkey] = kenv[kkey] sp_list = generate_sp_list() for sp in sp_list: krb = False spname = sp["nameid"] spurl = "https://%s:%s" % (sp["addr"], sp["port"]) sess = HttpSessions() sess.add_server(idpname, "https://%s:45080" % WRAP_HOSTNAME, user, "ipsilon") sess.add_server(spname, spurl) print "" print "testnameid: Testing NameID format %s ..." % spname if spname == "kerberos": krb = True print "testnameid: Authenticate to IDP ...", try: sess.auth_to_idp(idpname, krb=krb) except Exception, e: # pylint: disable=broad-except print >> sys.stderr, " ERROR: %s" % repr(e) sys.exit(1)
conf = self.setup_sp_server(sp, name, addr, port, env) fixup_sp_httpd(os.path.dirname(conf)) self.setup_step("Starting third SP's httpd server") self.start_http_server(conf, env) if __name__ == '__main__': idpname = 'idp1' sp1name = 'sp1' sp2name = 'sp2' sp3name = 'sp3' user = pwd.getpwuid(os.getuid())[0] sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'ipsilon') sess.add_server(sp1name, 'https://127.0.0.11:45081') sess.add_server(sp2name, 'https://127.0.0.12:45082') sess.add_server(sp3name, 'https://127.0.0.13:45083') with TC.case('Authenticate to IdP'): sess.auth_to_idp(idpname) with TC.case('Registering test client'): client_info = { 'redirect_uris': ['https://invalid/'], 'response_types': ['code'], 'grant_types': ['authorization_code'], 'application_type': 'web', 'client_name': 'Test suite client',
krb5conf = os.path.join(testdir, 'krb5.conf') kenv = { 'PATH': '/sbin:/bin:/usr/sbin:/usr/bin', 'KRB5_CONFIG': krb5conf, 'KRB5CCNAME': 'FILE:' + os.path.join(testdir, 'ccaches/user') } for kkey in kenv: os.environ[kkey] = kenv[kkey] sp_list = generate_sp_list() for sp in sp_list: krb = False spname = sp['nameid'] spurl = 'https://%s:%s' % (sp['addr'], sp['port']) sess = HttpSessions() sess.add_server(idpname, 'https://%s:45080' % WRAP_HOSTNAME, user, 'ipsilon') sess.add_server(spname, spurl) TC.info('Testing NameID format %s' % spname) if spname == 'kerberos': krb = True with TC.case('Authenticate to IdP'): sess.auth_to_idp(idpname, krb=krb) with TC.case('Add SP Metadata to IdP'): sess.add_sp_metadata(idpname, spname)
sp_prof = self.generate_profile(sp_g, sp_b, nameid, addr, str(port), nameid) else: sp_prof = self.generate_profile(sp_g, sp_a, nameid, addr, str(port), nameid) conf = self.setup_sp_server(sp_prof, nameid, addr, str(port), env) fixup_sp_httpd(os.path.dirname(conf)) print "Starting SP's httpd server" self.start_http_server(conf, env) if __name__ == "__main__": idpname = "idp1" user = pwd.getpwuid(os.getuid())[0] sess = HttpSessions() sess.add_server(idpname, "https://127.0.0.10:45080", user, "ipsilon") for sp in splist: spname = sp["nameid"] spurl = "https://%s:%s" % (sp["addr"], sp["port"]) sess.add_server(spname, spurl) print "testlogout: Authenticate to IDP ...", try: sess.auth_to_idp(idpname) except Exception, e: # pylint: disable=broad-except print >> sys.stderr, " ERROR: %s" % repr(e) sys.exit(1) print " SUCCESS" for sp in splist:
conf = self.setup_sp_server(sp3, name, addr, port, env) fixup_sp_httpd(os.path.dirname(conf), name) print "Starting SP's httpd server" self.start_http_server(conf, env) if __name__ == '__main__': idpname = 'idp1' spname = 'sp1' sp2name = 'sp2-test.example.com' sp3name = 'sp3_invalid' user = pwd.getpwuid(os.getuid())[0] sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'ipsilon') sess.add_server(spname, 'https://127.0.0.11:45081') sess.add_server(sp2name, 'https://127.0.0.10:45082') sess.add_server(sp3name, 'https://127.0.0.10:45083') print "testrest: Authenticate to IDP ...", try: sess.auth_to_idp(idpname) except Exception, e: # pylint: disable=broad-except print >> sys.stderr, " ERROR: %s" % repr(e) sys.exit(1) print " SUCCESS" print "testrest: List initial Service Providers via REST ...", try:
conf = self.setup_sp_server(sp3, name, addr, port, env) fixup_sp_httpd(os.path.dirname(conf), name) self.setup_step("Starting SP's httpd server") self.start_http_server(conf, env) if __name__ == '__main__': idpname = 'idp1' spname = 'sp1' sp2name = 'sp2-test.example.com' sp3name = 'sp3_invalid' user = pwd.getpwuid(os.getuid())[0] sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'ipsilon') sess.add_server(spname, 'https://127.0.0.11:45081') sess.add_server(sp2name, 'https://127.0.0.10:45082') sess.add_server(sp3name, 'https://127.0.0.10:45083') with TC.case('Authenticate to IdP'): sess.auth_to_idp(idpname) with TC.case('List initial Service Providers via REST'): result = sess.get_rest_sp(idpname) if len(result['result']) != 0: raise ValueError( 'Expected no SP and got %d' % len(result['result']) )
idpname = 'idp1' sp1name = 'sp1' sp2name = 'sp2' user = pwd.getpwuid(os.getuid())[0] testdir = os.environ['TESTDIR'] krb5conf = os.path.join(testdir, 'krb5.conf') kenv = {'PATH': '/sbin:/bin:/usr/sbin:/usr/bin', 'KRB5_CONFIG': krb5conf, 'KRB5CCNAME': 'FILE:' + os.path.join(testdir, 'ccaches/user')} for key in kenv: os.environ[key] = kenv[key] sess = HttpSessions() sess.add_server(idpname, 'https://%s:45080' % WRAP_HOSTNAME, user, 'ipsilon') sess.add_server(sp1name, 'https://127.0.0.11:45081') sess.add_server(sp2name, 'https://127.0.0.11:45082') print "testgssapi: Authenticate to IDP ...", try: sess.auth_to_idp(idpname, krb=True) except Exception, e: # pylint: disable=broad-except print >> sys.stderr, " ERROR: %s" % repr(e) sys.exit(1) print " SUCCESS" print "testgssapi: Add first SP Metadata to IDP ...", try:
port = '45081' sp = self.generate_profile(sp_g, sp_a, name, addr, port) conf = self.setup_sp_server(sp, name, addr, port, env) fixup_sp_httpd(os.path.dirname(conf)) print "Starting SP's httpd server" self.start_http_server(conf, env) if __name__ == '__main__': idpname = 'idp1' spname = 'sp1' user = pwd.getpwuid(os.getuid())[0] sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'ipsilon') sess.add_server(spname, 'https://127.0.0.11:45081') print "pgdb: Authenticate to IDP ...", sys.stdout.flush() try: print 'Stress-testing the database connections...', sys.stdout.flush() for i in xrange(50): sess.auth_to_idp(idpname) sess.logout_from_idp(idpname) sess.auth_to_idp(idpname) except Exception, e: # pylint: disable=broad-except print >> sys.stderr, " ERROR: %s" % repr(e) sys.exit(1)
conf = self.setup_sp_server(sp, name, addr, port, env) fixup_sp_httpd(os.path.dirname(conf)) print "Starting SP's httpd server" self.start_http_server(conf, env) if __name__ == '__main__': idpname = 'idp1' spname = 'sp1' user = pwd.getpwuid(os.getuid())[0] print "trans: Add SP Metadata to IDP ...", try: sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'ipsilon') sess.add_server(spname, 'https://127.0.0.11:45081') sess.auth_to_idp(idpname) sess.add_sp_metadata(idpname, spname) except Exception, e: # pylint: disable=broad-except print >> sys.stderr, " ERROR: %s" % repr(e) sys.exit(1) print " SUCCESS" print "trans: Access SP Protected Area ...", try: sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'ipsilon') sess.add_server(spname, 'https://127.0.0.11:45081') page = sess.fetch_page(idpname, 'https://127.0.0.11:45081/sp/')
conf = self.setup_sp_server(sp, name, addr, port, env) fixup_sp_httpd(os.path.dirname(conf)) print "Starting third SP's httpd server" self.start_http_server(conf, env) if __name__ == '__main__': idpname = 'idp1' sp1name = 'sp1' sp2name = 'sp2' sp3name = 'sp3' user = pwd.getpwuid(os.getuid())[0] sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'ipsilon') sess.add_server(sp1name, 'https://127.0.0.11:45081') sess.add_server(sp2name, 'https://127.0.0.12:45082') sess.add_server(sp3name, 'https://127.0.0.13:45083') print "openidc: Authenticate to IDP ...", try: sess.auth_to_idp(idpname) except Exception, e: # pylint: disable=broad-except print >> sys.stderr, " ERROR: %s" % repr(e) sys.exit(1) print " SUCCESS" print "openidc: Registering test client ...", try:
sp = self.generate_profile(sp2_g, sp2_a, name, addr, port) conf = self.setup_sp_server(sp, name, addr, port, env) fixup_sp_httpd(os.path.dirname(conf)) self.setup_step("Starting second SP's httpd server") self.start_http_server(conf, env) if __name__ == '__main__': idpname = 'idp1' sp1name = 'sp1' sp2name = 'sp2' user = pwd.getpwuid(os.getuid())[0] sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'ipsilon') sess.add_server(sp1name, 'https://127.0.0.11:45081') sess.add_server(sp2name, 'https://127.0.0.12:45082') with TC.case('Authenticate to IdP'): sess.auth_to_idp(idpname) with TC.case('Add SP1 Metadata to IdP'): sess.add_sp_metadata(idpname, sp1name) with TC.case('Add SP2 Metadata to IdP'): sess.add_sp_metadata(idpname, sp2name) with TC.case('Access SP1 when authz stack set to allow'): page = sess.fetch_page(idpname, 'https://127.0.0.11:45081/sp/')
port = '45081' sp = self.generate_profile(sp_g, sp_a, name, addr, port) conf = self.setup_sp_server(sp, name, addr, port, env) fixup_sp_httpd(os.path.dirname(conf)) print "Starting SP's httpd server" self.start_http_server(conf, env) if __name__ == '__main__': idpname = 'idp1' spname = 'sp1' user = '******' sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'tuser') sess.add_server(spname, 'https://127.0.0.11:45081') print "test1: Authenticate to IDP ...", try: sess.auth_to_idp(idpname) except Exception, e: # pylint: disable=broad-except print >> sys.stderr, " ERROR: %s" % repr(e) sys.exit(1) print " SUCCESS" print "test1: Add SP Metadata to IDP ...", try: sess.add_sp_metadata(idpname, spname) except Exception, e: # pylint: disable=broad-except
self.start_http_server(conf, env) self.setup_step("Installing SP server") name = 'sp1' addr = '127.0.0.11' port = '45081' sp = self.generate_profile(sp_g, sp_a, name, addr, port) conf = self.setup_sp_server(sp, name, addr, port, env) fixup_sp_httpd(os.path.dirname(conf)) self.setup_step("Starting SP's httpd server") self.start_http_server(conf, env) if __name__ == '__main__': idpname = 'idp1' spname = 'sp1' user = '******' sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'tuser') sess.add_server(spname, 'https://127.0.0.11:45081') with TC.case('Authenticate to Idp with no LDAP backend'): sess.auth_to_idp( idpname, rule='//div[@class="alert alert-danger"]/p/text()', expected="Internal system error" )
name = 'sp1' addr = '127.0.0.11' port = '45081' sp = self.generate_profile(sp_g, sp_a, name, addr, port) conf = self.setup_sp_server(sp, name, addr, port, env) fixup_sp_httpd(os.path.dirname(conf)) self.setup_step("Starting SP's httpd server") self.start_http_server(conf, env) if __name__ == '__main__': idpname = 'idp1' spname = 'sp1' user = pwd.getpwuid(os.getuid())[0] with TC.case('Add SP Metadata to IdP'): sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'ipsilon') sess.add_server(spname, 'https://127.0.0.11:45081') sess.auth_to_idp(idpname) sess.add_sp_metadata(idpname, spname) with TC.case('Access SP Protected Area'): sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'ipsilon') sess.add_server(spname, 'https://127.0.0.11:45081') page = sess.fetch_page(idpname, 'https://127.0.0.11:45081/sp/') page.expected_value('text()', 'WORKS!')
port = '45081' sp = self.generate_profile(sp_g, sp_a, name, addr, port) conf = self.setup_sp_server(sp, name, addr, port, env) fixup_sp_httpd(os.path.dirname(conf)) print "Starting SP's httpd server" self.start_http_server(conf, env) if __name__ == '__main__': idpname = 'idp1' spname = 'sp1' user = '******' sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'tuser') sess.add_server(spname, 'https://127.0.0.11:45081') print "ldapdown: Authenticate to IDP with no LDAP backend...", try: sess.auth_to_idp( idpname, rule='//div[@class="alert alert-danger"]/p/text()', expected="Internal system error" ) except Exception, e: # pylint: disable=broad-except print >> sys.stderr, " ERROR: %s" % repr(e) sys.exit(1) print " SUCCESS"
sp_prof = self.generate_profile( sp_g, sp_a, nameid, addr, str(port), nameid ) conf = self.setup_sp_server(sp_prof, nameid, addr, str(port), env) fixup_sp_httpd(os.path.dirname(conf)) self.setup_step("Starting SP's httpd server") self.start_http_server(conf, env) if __name__ == '__main__': idpname = 'idp1' user = pwd.getpwuid(os.getuid())[0] sess = HttpSessions() sess.add_server(idpname, 'https://127.0.0.10:45080', user, 'ipsilon') for sp in splist: spname = sp['nameid'] spurl = 'https://%s:%s' % (sp['addr'], sp['port']) sess.add_server(spname, spurl) with TC.case('Authenticate to IdP'): sess.auth_to_idp(idpname) for sp in splist: spname = sp['nameid'] with TC.case('Add SP Metadata for %s to IdP' % spname): sess.add_sp_metadata(idpname, spname) with TC.case('Logout without logging into SP'):
def run(self, env): overall_exit_code = 0 overall_results = [] for version in range(ipsilon.util.data.CURRENT_SCHEMA_VERSION): for with_readonly in [True, False]: exit_code, results = self.test_upgrade_from( env, version, with_readonly) if exit_code != 0: overall_exit_code = 1 overall_results.extend(results) return overall_exit_code, overall_results if __name__ == '__main__': from_version = sys.argv[1] with_ro = sys.argv[2] idpname = sys.argv[3] url = sys.argv[4] user = pwd.getpwuid(os.getuid())[0] sess = HttpSessions() sess.add_server(idpname, 'https://%s' % url, user, 'ipsilon') with TC.case('From v%s %s: Authenticate to IdP' % (from_version, with_ro)): sess.auth_to_idp(idpname)