def setUp(self): MongoTestCase.setUp(self, None, None) self.vccs_client = TestVCCSClient() self.central_user = self.amdb.get_user_by_mail('*****@*****.**') self.user = ChpassUser.from_central_user(self.central_user) vccs_module.add_credentials('dummy', None, 'abcd', self.user, vccs=self.vccs_client)
def setUp(self): MongoTestCase.setUp(self) datadir = pkg_resources.resource_filename(__name__, 'data') staticdir = pkg_resources.resource_filename(__name__, 'static/en') self.redis_instance = RedisTemporaryInstance.get_instance() # load the IdP configuration _test_config = { 'debug': True, 'insecure_cookies': False, 'mongo_uri': self.tmp_db.uri, 'environment': 'test_suite', 'pysaml2_config': os.path.join(datadir, 'test_SSO_conf.py'), 'static_dir': staticdir, 'tou_version': 'mock-version', 'shared_session_secret_key': 'shared-session-secret-key', 'shared_session_ttl': 30, 'redis_host': 'localhost', 'redis_port': str(self.redis_instance.port), 'redis_db': '0', 'listen_addr': 'unittest-idp.example.edu', 'listen_port': 443, 'base_url': 'https://unittest-idp.example.edu/', 'content_packages': [('eduid_idp', 'tests/static')], 'action_plugins': ['tou', 'mfa'], 'default_eppn_scope': 'example.edu', } cherry_conf = { 'tools.sessions.on': True, 'tools.sessions.storage_class': EduidSession, 'tools.sessions.name': 'sessid', 'tools.sessions.domain': 'unittest-idp.example.edu', 'tools.sessions.secure': True, 'tools.sessions.persistent': True, 'tools.sessions.httponly': False, } self.config = IdPConfig.init_config(test_config=_test_config, debug=False) cherry_conf.update(self.config.to_dict()) cherrypy.config.update(cherry_conf) cherrypy.config.logger = logger if hasattr(cherrypy.request, '_session_init_flag'): del cherrypy.request._session_init_flag init(storage_class=EduidSession, path='/', name='sessid', domain="unittest-idp.example.edu") # Create the IdP app self.idp_app = IdPApplication(logger, self.config) self.actions = self.idp_app.context.actions_db # setup some test data _email = '*****@*****.**' self.test_user = self.amdb.get_user_by_mail(_email) self.test_action = self.actions.add_action(self.test_user.eppn, action_type='dummy', preference=100, params={}) # prevent the HTTP server from ever starting cherrypy.server.unsubscribe() # mount the IdP app in the cherrypy app server cherrypy.tree.mount(self.idp_app, '', {'/': cherry_conf}) # create a webtest testing environment from six.moves.http_cookiejar import CookieJar self.http = webtest.TestApp(cherrypy.tree, extra_environ={'wsgi.url_scheme': 'https'}, cookiejar=CookieJar())
def tearDown(self): # reset the testing environment self.http.reset() MongoTestCase.tearDown(self)
def tearDown(self): MongoTestCase.tearDown(self) vccs_module.revoke_all_credentials('dummy', self.user, vccs=self.vccs_client)