def before_scenario(context, scenario): config = {} if scenario.status != 'skipped' and 'notesting' in scenario.tags: config['SUPERDESK_TESTING'] = False tests.setup(context=context, config=config, app_factory=get_app) context.headers = [('Content-Type', 'application/json'), ('Origin', 'localhost')] if 'dbauth' in scenario.tags and LDAP_SERVER: scenario.mark_skipped() if 'ldapauth' in scenario.tags and not LDAP_SERVER: scenario.mark_skipped() if scenario.status != 'skipped' and 'auth' in scenario.tags: setup_auth_user(context) if scenario.status != 'skipped' and 'provider' in scenario.tags: setup_providers(context) if scenario.status != 'skipped' and 'vocabulary' in scenario.tags: with context.app.app_context(): cmd = VocabulariesPopulateCommand() filename = os.path.join( os.path.abspath(os.path.dirname("features/steps/fixtures/")), "vocabularies.json") cmd.run(filename) if scenario.status != 'skipped' and 'notification' in scenario.tags: tests.setup_notification(context)
def before_scenario(context, scenario): config = {} if scenario.status != 'skipped' and 'notesting' in scenario.tags: config['SUPERDESK_TESTING'] = False tests.setup(context=context, config=config, app_factory=get_app) context.headers = [ ('Content-Type', 'application/json'), ('Origin', 'localhost') ] if 'dbauth' in scenario.tags and LDAP_SERVER: scenario.mark_skipped() if 'ldapauth' in scenario.tags and not LDAP_SERVER: scenario.mark_skipped() if scenario.status != 'skipped' and 'auth' in scenario.tags: setup_auth_user(context) if scenario.status != 'skipped' and 'provider' in scenario.tags: setup_providers(context) if scenario.status != 'skipped' and 'vocabulary' in scenario.tags: with context.app.app_context(): cmd = VocabulariesPopulateCommand() filename = os.path.join(os.path.abspath(os.path.dirname("features/steps/fixtures/")), "vocabularies.json") cmd.run(filename) if scenario.status != 'skipped' and 'notification' in scenario.tags: tests.setup_notification(context)
def setUp(self): setup(context=self) setup_notification(context=self) mock_logger = logging.getLogger('test') self.mock_logger_handler = MockLoggingHandler() mock_logger.addHandler(self.mock_logger_handler) errors.logger = mock_logger errors.notifiers = [] self.provider = {'name': 'TestProvider'}
def setUp(self): setup(context=self) setup_notification(context=self) mock_logger = logging.getLogger("test") self.mock_logger_handler = MockLoggingHandler() mock_logger.addHandler(self.mock_logger_handler) errors.logger = mock_logger errors.notifiers = [] self.provider = {"name": "TestProvider"}
def setup_before_scenario(context, scenario, config, app_factory): if scenario.status != 'skipped' and 'notesting' in scenario.tags: config['SUPERDESK_TESTING'] = False tests.setup(context, config, app_factory, bool(config)) if context.app: # reset to False. context.app.config.update({'NO_TAKES': False}) context.headers = [('Content-Type', 'application/json'), ('Origin', 'localhost')] if 'dbauth' in scenario.tags and LDAP_SERVER: scenario.mark_skipped() if 'ldapauth' in scenario.tags and not LDAP_SERVER: scenario.mark_skipped() if 'amazons3' in scenario.tags and not context.app.config.get( 'AMAZON_CONTAINER_NAME', None): scenario.mark_skipped() if 'alchemy' in scenario.tags and not context.app.config.get( 'KEYWORDS_KEY_API'): scenario.mark_skipped() if 'clean_snapshots' in scenario.tags: tests.use_snapshot.cache.clear() setup_search_provider(context.app) if scenario.status != 'skipped' and 'auth' in scenario.tags: setup_auth_user(context) if scenario.status != 'skipped' and 'provider' in scenario.tags: setup_providers(context) if scenario.status != 'skipped' and 'vocabulary' in scenario.tags: with context.app.app_context(): cmd = VocabulariesPopulateCommand() filename = os.path.join( os.path.abspath(os.path.dirname("features/steps/fixtures/")), "vocabularies.json") cmd.run(filename) if scenario.status != 'skipped' and 'content_type' in scenario.tags: with context.app.app_context(): cmd = VocabulariesPopulateCommand() filename = os.path.join( os.path.abspath(os.path.dirname("features/steps/fixtures/")), "content_types.json") cmd.run(filename) if scenario.status != 'skipped' and 'notification' in scenario.tags: tests.setup_notification(context)
def setup_before_scenario(context, scenario, config, app_factory): if scenario.status != "skipped" and "notesting" in scenario.tags: config["SUPERDESK_TESTING"] = False tests.setup(context, config, app_factory, bool(config)) context.headers = [("Content-Type", "application/json"), ("Origin", "localhost")] if "dbauth" in scenario.tags and LDAP_SERVER: scenario.mark_skipped() if "ldapauth" in scenario.tags and not LDAP_SERVER: scenario.mark_skipped() if "alchemy" in scenario.tags and not context.app.config.get( "KEYWORDS_KEY_API"): scenario.mark_skipped() if "clean_snapshots" in scenario.tags: tests.use_snapshot.cache.clear() setup_search_provider(context.app) if scenario.status != "skipped" and "auth" in scenario.tags: setup_auth_user(context) if scenario.status != "skipped" and "provider" in scenario.tags: setup_providers(context) if scenario.status != "skipped" and "vocabulary" in scenario.tags: with context.app.app_context(): cmd = AppPopulateCommand() filename = os.path.join( os.path.abspath(os.path.dirname("features/steps/fixtures/")), "vocabularies.json") cmd.run(filename) if scenario.status != "skipped" and "content_type" in scenario.tags: with context.app.app_context(): cmd = AppPopulateCommand() filename = os.path.join( os.path.abspath(os.path.dirname("features/steps/fixtures/")), "content_types.json") cmd.run(filename) if scenario.status != "skipped" and "notification" in scenario.tags: tests.setup_notification(context) if scenario.status != "skipped" and "app_init" in scenario.tags: with context.app.app_context(): command = AppInitializeWithDataCommand() command.run()
def setup_before_scenario(context, scenario, config, app_factory): if scenario.status != 'skipped' and 'notesting' in scenario.tags: config['SUPERDESK_TESTING'] = False # TODO: Temp fix for DATE_FORMAT. This will be removed when superdesk will allow to specify custom test settings. config['DATE_FORMAT'] = DATE_FORMAT tests.setup(context, config, app_factory, bool(config)) context.headers = [('Content-Type', 'application/json'), ('Origin', 'localhost')] if 'amazons3' in scenario.tags and not context.app.config.get( 'AMAZON_CONTAINER_NAME', None): scenario.mark_skipped() if 'alchemy' in scenario.tags and not context.app.config.get( 'KEYWORDS_KEY_API'): scenario.mark_skipped() if 'clean_snapshots' in scenario.tags: tests.use_snapshot.cache.clear() setup_search_provider(context.app) if scenario.status != 'skipped' and 'auth' in scenario.tags: setup_auth_user(context) if scenario.status != 'skipped' and 'consumer_auth' in scenario.tags: setup_auth_consumer(context, test_consumer) if scenario.status != 'skipped' and 'provider' in scenario.tags: setup_providers(context) if scenario.status != 'skipped' and 'vocabulary' in scenario.tags: with context.app.app_context(): cmd = VocabulariesPopulateCommand() filename = os.path.join( os.path.abspath(os.path.dirname("features/steps/fixtures/")), "vocabularies.json") cmd.run(filename) if scenario.status != 'skipped' and 'content_type' in scenario.tags: with context.app.app_context(): cmd = VocabulariesPopulateCommand() filename = os.path.join( os.path.abspath(os.path.dirname("features/steps/fixtures/")), "content_types.json") cmd.run(filename) if scenario.status != 'skipped' and 'notification' in scenario.tags: tests.setup_notification(context)
def before_scenario(context, scenario): config = {} tests.setup(context, config) context.headers = [('Content-Type', 'application/json'), ('Origin', 'localhost')] if 'auth' in scenario.tags: tests.setup_auth_user(context) if 'provider' in scenario.tags: setup_providers(context) if 'notification' in scenario.tags: tests.setup_notification(context)
def before_scenario(context, scenario): config = {} tests.setup(context, config) context.headers = [ ('Content-Type', 'application/json'), ('Origin', 'localhost') ] if 'auth' in scenario.tags: tests.setup_auth_user(context) if 'provider' in scenario.tags: setup_providers(context) if 'notification' in scenario.tags: tests.setup_notification(context)
def setup_before_scenario(context, scenario, config, app_factory): if scenario.status != 'skipped' and 'notesting' in scenario.tags: config['SUPERDESK_TESTING'] = False tests.setup(context, config, app_factory, bool(config)) context.headers = [ ('Content-Type', 'application/json'), ('Origin', 'localhost') ] if 'dbauth' in scenario.tags and LDAP_SERVER: scenario.mark_skipped() if 'ldapauth' in scenario.tags and not LDAP_SERVER: scenario.mark_skipped() if 'amazons3' in scenario.tags and not context.app.config.get('AMAZON_CONTAINER_NAME', None): scenario.mark_skipped() if 'alchemy' in scenario.tags and not context.app.config.get('KEYWORDS_KEY_API'): scenario.mark_skipped() if 'clean_snapshots' in scenario.tags: tests.use_snapshot.cache.clear() setup_search_provider(context.app) if scenario.status != 'skipped' and 'auth' in scenario.tags: setup_auth_user(context) if scenario.status != 'skipped' and 'provider' in scenario.tags: setup_providers(context) if scenario.status != 'skipped' and 'vocabulary' in scenario.tags: with context.app.app_context(): cmd = VocabulariesPopulateCommand() filename = os.path.join(os.path.abspath(os.path.dirname("features/steps/fixtures/")), "vocabularies.json") cmd.run(filename) if scenario.status != 'skipped' and 'content_type' in scenario.tags: with context.app.app_context(): cmd = VocabulariesPopulateCommand() filename = os.path.join(os.path.abspath(os.path.dirname("features/steps/fixtures/")), "content_types.json") cmd.run(filename) if scenario.status != 'skipped' and 'notification' in scenario.tags: tests.setup_notification(context)
def before_scenario(context, scenario): config = {} if scenario.status != 'skipped' and 'notesting' in scenario.tags: config['SUPERDESK_TESTING'] = False tests.setup(context, config) context.headers = [ ('Content-Type', 'application/json'), ('Origin', 'localhost') ] if 'dbauth' in scenario.tags and LDAP_SERVER: scenario.mark_skipped() if scenario.status != 'skipped' and 'auth' in scenario.tags: tests.setup_auth_user(context) if scenario.status != 'skipped' and 'notification' in scenario.tags: tests.setup_notification(context)
def before_scenario(context, scenario): config = {} if scenario.status != "skipped" and "notesting" in scenario.tags: config["SUPERDESK_TESTING"] = False tests.setup(context, config) context.headers = [("Content-Type", "application/json"), ("Origin", "localhost")] if "dbauth" in scenario.tags and LDAP_SERVER: scenario.mark_skipped() if scenario.status != "skipped" and "auth" in scenario.tags: tests.setup_auth_user(context) if scenario.status != "skipped" and "provider" in scenario.tags: setup_providers(context) if scenario.status != "skipped" and "notification" in scenario.tags: tests.setup_notification(context)
def setup_before_scenario(context, scenario, config, app_factory): if scenario.status != "skipped" and "notesting" in scenario.tags: config["SUPERDESK_TESTING"] = False tests.setup(context, config, app_factory, bool(config)) context.headers = [("Content-Type", "application/json"), ("Origin", "localhost")] if "dbauth" in scenario.tags and LDAP_SERVER: scenario.mark_skipped() if "ldapauth" in scenario.tags and not LDAP_SERVER: scenario.mark_skipped() if "amazons3" in scenario.tags and not context.app.config.get("AMAZON_CONTAINER_NAME", None): scenario.mark_skipped() if "alchemy" in scenario.tags and not context.app.config.get("KEYWORDS_KEY_API"): scenario.mark_skipped() setup_search_provider(context.app) if scenario.status != "skipped" and "auth" in scenario.tags: setup_auth_user(context) if scenario.status != "skipped" and "provider" in scenario.tags: setup_providers(context) if scenario.status != "skipped" and "vocabulary" in scenario.tags: with context.app.app_context(): cmd = VocabulariesPopulateCommand() filename = os.path.join(os.path.abspath(os.path.dirname("features/steps/fixtures/")), "vocabularies.json") cmd.run(filename) if scenario.status != "skipped" and "content_type" in scenario.tags: with context.app.app_context(): cmd = VocabulariesPopulateCommand() filename = os.path.join(os.path.abspath(os.path.dirname("features/steps/fixtures/")), "content_types.json") cmd.run(filename) if scenario.status != "skipped" and "notification" in scenario.tags: tests.setup_notification(context)