• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python tests.setup函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中superdesk.tests.setup函数的典型用法代码示例。如果您正苦于以下问题:Python setup函数的具体用法?Python setup怎么用?Python setup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setup函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: before_scenario

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)
开发者ID:chalkjockey,项目名称:superdesk,代码行数:31,代码来源:environment.py


示例2: before_feature

def before_feature(context, feature):
    config = getattr(setup_before_all, 'config', None)
    if config is not None:
        app_factory = setup_before_all.app_factory
    else:
        # superdesk-aap don't use "setup_before_all" already
        config = getattr(setup_before_scenario, 'config', None)
        app_factory = getattr(setup_before_scenario, 'app_factory', None)
    config = config or {}
    app_factory = app_factory or get_app

    # set the MAX_TRANSMIT_RETRY_ATTEMPT to zero so that transmit does not retry
    config['MAX_TRANSMIT_RETRY_ATTEMPT'] = 0
    os.environ['BEHAVE_TESTING'] = '1'
    tests.setup(context, config, app_factory=app_factory)

    if 'tobefixed' in feature.tags:
        feature.mark_skipped()

    if 'dbauth' in feature.tags and LDAP_SERVER:
        feature.mark_skipped()

    if 'ldapauth' in feature.tags and not LDAP_SERVER:
        feature.mark_skipped()

    if 'amazons3' in feature.tags and not context.app.config.get('AMAZON_CONTAINER_NAME', None):
        feature.mark_skipped()
开发者ID:mugurrus,项目名称:superdesk-core,代码行数:27,代码来源:environment.py


示例3: setUp

 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'}
开发者ID:ancafarcas,项目名称:superdesk-core,代码行数:9,代码来源:errors_test.py


示例4: setUp

 def setUp(self):
     setup(context=self)
     with self.app.app_context():
         provider = {"name": "Test"}
         dirname = os.path.dirname(os.path.realpath(__file__))
         fixture = os.path.join(dirname, "fixtures", self.filename)
         with open(fixture, mode="rb") as f:
             bytes = f.read()
         parser = rfc822Parser()
         self.items = parser.parse_email([(1, bytes)], provider)
开发者ID:Flowdeeps,项目名称:superdesk-1,代码行数:10,代码来源:rfc822_parser_test.py


示例5: setUp

 def setUp(self):
     setup(context=self)
     with self.app.app_context():
         provider = {'name': 'Test'}
         dirname = os.path.dirname(os.path.realpath(__file__))
         fixture = os.path.normpath(os.path.join(dirname, '../fixtures', self.filename))
         with open(fixture, mode='rb') as f:
             bytes = f.read()
         parser = EMailRFC822FeedParser()
         self.items = parser.parse([(1, bytes)], provider)
开发者ID:hlmnrmr,项目名称:superdesk-core,代码行数:10,代码来源:rfc822_parser_test.py


示例6: before_all

def before_all(context):
    config = {}
    if AMAZON_CONTAINER_NAME:
        config['AMAZON_CONTAINER_NAME'] = AMAZON_CONTAINER_NAME
        config['AMAZON_ACCESS_KEY_ID'] = AMAZON_ACCESS_KEY_ID
        config['AMAZON_SECRET_ACCESS_KEY'] = AMAZON_SECRET_ACCESS_KEY
        config['AMAZON_REGION'] = AMAZON_REGION
        config['AMAZON_SERVE_DIRECT_LINKS'] = AMAZON_SERVE_DIRECT_LINKS
        config['AMAZON_S3_USE_HTTPS'] = AMAZON_S3_USE_HTTPS

    tests.setup(context=context, config=config, app_factory=get_app)
    os.environ['BEHAVE_TESTING'] = '1'
开发者ID:actionless,项目名称:superdesk,代码行数:12,代码来源:environment.py


示例7: before_scenario

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:
        tests.setup_providers(context)
开发者ID:PythonCharmers,项目名称:superdesk-server,代码行数:13,代码来源:environment.py


示例8: setup_before_all

def setup_before_all(context, config, app_factory):
    if AMAZON_CONTAINER_NAME:
        config['AMAZON_CONTAINER_NAME'] = AMAZON_CONTAINER_NAME
        config['AMAZON_ACCESS_KEY_ID'] = AMAZON_ACCESS_KEY_ID
        config['AMAZON_SECRET_ACCESS_KEY'] = AMAZON_SECRET_ACCESS_KEY
        config['AMAZON_REGION'] = AMAZON_REGION
        config['AMAZON_SERVE_DIRECT_LINKS'] = AMAZON_SERVE_DIRECT_LINKS
        config['AMAZON_S3_USE_HTTPS'] = AMAZON_S3_USE_HTTPS
        config['AMAZON_SERVER'] = AMAZON_SERVER
        config['AMAZON_PROXY_SERVER'] = AMAZON_PROXY_SERVER
        config['AMAZON_URL_GENERATOR'] = AMAZON_URL_GENERATOR

    # set the MAX_TRANSMIT_RETRY_ATTEMPT to zero so that transmit does not retry
    config['MAX_TRANSMIT_RETRY_ATTEMPT'] = 0
    tests.setup(context=context, config=config, app_factory=app_factory)
    os.environ['BEHAVE_TESTING'] = '1'
开发者ID:MiczFlor,项目名称:superdesk-core,代码行数:16,代码来源:environment.py


示例9: setup_before_scenario

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)
开发者ID:hlmnrmr,项目名称:superdesk-core,代码行数:47,代码来源:environment.py


示例10: setUp

    def setUp(self):
        setup(context=self)
        with self.app.app_context():
            self.app.data.insert('users', [{
                '_id': 123,
                'name': 'user',
                'user_type': 'administrator',
                'email': '[email protected]',
                'byline': 'E Harvey'
            }])
            self.app.data.insert('desks', [{'_id': 1, 'name': 'new zealand'}])
            self.app.data.insert('vocabularies', [{'_id': 'locators',
                                                  'items': [{'is_active': True,
                                                             'name': 'ADV', 'qcode': 'ADV', 'group': ''}]},
                                                  {'_id': 'priority', 'items': [{'is_active': True,
                                                                                 'name': 'Urgent', 'qcode': '3'}]}])

            self.provider = {'name': 'Test', 'config': {'formatted': True}}
开发者ID:superdesk,项目名称:superdesk-core,代码行数:18,代码来源:rfc822_parser_test.py


示例11: before_scenario

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)
开发者ID:hlmnrmr,项目名称:liveblog,代码行数:19,代码来源:environment.py


示例12: before_scenario

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)
开发者ID:liveblog,项目名称:superdesk-server,代码行数:19,代码来源:environment.py


示例13: setUpForChildren

    def setUpForChildren(self):
        """Run this `setUp` stuff for each children."""
        config = {
            'INSTALLED_APPS': INSTALLED_APPS,
            'ELASTICSEARCH_FORCE_REFRESH': True,
            'DEFAULT_TIMEZONE': 'Australia/Sydney',
            'MIN_BROADCAST_TEXT_WORD_COUNT': MIN_BROADCAST_TEXT_WORD_COUNT
        }

        setup(self, config=config, app_factory=get_app)

        self.ctx = self.app.app_context()
        self.ctx.push()

        def clean_ctx():
            if self.ctx:
                self.ctx.pop()

        self.addCleanup(clean_ctx)
开发者ID:mdhaman,项目名称:superdesk-aap,代码行数:19,代码来源:unittests.py


示例14: setup_before_scenario

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)
开发者ID:liveblog,项目名称:superdesk-core,代码行数:41,代码来源:environment.py


示例15: before_feature

def before_feature(context, feature):
    config = getattr(setup_before_all, 'config', None)
    if config is not None:
        app_factory = setup_before_all.app_factory
    else:
        # superdesk-aap don't use "setup_before_all" already
        config = getattr(setup_before_scenario, 'config', None)
        app_factory = getattr(setup_before_scenario, 'app_factory', None)
    config = config or {}
    app_factory = app_factory or get_app

    if AMAZON_CONTAINER_NAME:
        config['AMAZON_CONTAINER_NAME'] = AMAZON_CONTAINER_NAME
        config['AMAZON_ACCESS_KEY_ID'] = AMAZON_ACCESS_KEY_ID
        config['AMAZON_SECRET_ACCESS_KEY'] = AMAZON_SECRET_ACCESS_KEY
        config['AMAZON_REGION'] = AMAZON_REGION
        config['AMAZON_SERVE_DIRECT_LINKS'] = AMAZON_SERVE_DIRECT_LINKS
        config['AMAZON_S3_USE_HTTPS'] = AMAZON_S3_USE_HTTPS
        config['AMAZON_SERVER'] = AMAZON_SERVER
        config['AMAZON_PROXY_SERVER'] = AMAZON_PROXY_SERVER
        config['AMAZON_URL_GENERATOR'] = AMAZON_URL_GENERATOR

    # set the MAX_TRANSMIT_RETRY_ATTEMPT to zero so that transmit does not retry
    config['MAX_TRANSMIT_RETRY_ATTEMPT'] = 0
    os.environ['BEHAVE_TESTING'] = '1'
    tests.setup(context, config, app_factory=app_factory)

    if 'tobefixed' in feature.tags:
        feature.mark_skipped()

    if 'dbauth' in feature.tags and LDAP_SERVER:
        feature.mark_skipped()

    if 'ldapauth' in feature.tags and not LDAP_SERVER:
        feature.mark_skipped()

    if 'amazons3' in feature.tags and not context.app.config.get('AMAZON_CONTAINER_NAME', None):
        feature.mark_skipped()
开发者ID:hlmnrmr,项目名称:superdesk-core,代码行数:38,代码来源:environment.py


示例16: setUp

    def setUp(self):
        setup(context=self)
        with self.app.app_context():
            self.app.data.insert('users', [{
                '_id': 123,
                'name': 'user',
                'user_type': 'administrator',
                'email': '[email protected]'
            }])
            self.app.data.insert('desks', [{'_id': 1, 'name': 'new zealand'}])
            self.app.data.insert('vocabularies', [{'_id': 'locators',
                                                  'items': [{'is_active': True,
                                                             'name': 'ADV', 'qcode': 'ADV', 'group': ''}]},
                                                  {'_id': 'priority', 'items': [{'is_active': True,
                                                                                 'name': 'Urgent', 'qcode': '3'}]}])

            provider = {'name': 'Test', 'config': {'formatted': True}}
            dirname = os.path.dirname(os.path.realpath(__file__))
            fixture = os.path.normpath(os.path.join(dirname, '../fixtures', self.filename))
            with open(fixture, mode='rb') as f:
                bytes = f.read()
            parser = EMailRFC822FeedParser()
            self.items = parser.parse([(1, bytes)], provider)
开发者ID:liveblog,项目名称:superdesk-core,代码行数:23,代码来源:rfc822_parser_test.py


示例17: step_impl_given_config

def step_impl_given_config(context):
    tests.setup(context, json.loads(context.text))
    tests.setup_auth_user(context)
开发者ID:nistormihai,项目名称:superdesk-server,代码行数:3,代码来源:steps.py


示例18: before_all

def before_all(context):
    tests.setup(context)
    os.environ['BEHAVE_TESTING'] = '1'
开发者ID:Flowdeeps,项目名称:superdesk-1,代码行数:3,代码来源:environment.py


示例19: setUp

 def setUp(self):
     setup(self, app_factory=get_app)
     self.ctx = self.app.app_context()
     self.ctx.push()
开发者ID:MiczFlor,项目名称:superdesk-core,代码行数:4,代码来源:test_factory.py


示例20: before_all

def before_all(context):
    tests.setup(context=context, app_factory=get_app)
    os.environ['BEHAVE_TESTING'] = '1'
开发者ID:chalkjockey,项目名称:superdesk,代码行数:3,代码来源:environment.py



注:本文中的superdesk.tests.setup函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utc.get_expiry_date函数代码示例发布时间:2022-05-27
下一篇:
Python tests.get_prefixed_url函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap