本文整理汇总了Python中snippets.base.tests.ClientMatchRuleFactory类的典型用法代码示例。如果您正苦于以下问题:Python ClientMatchRuleFactory类的具体用法?Python ClientMatchRuleFactory怎么用?Python ClientMatchRuleFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ClientMatchRuleFactory类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_multi_match
def test_multi_match(self):
client = self._client(version='1.0', locale='en-US')
pass_rule = ClientMatchRuleFactory(version='1.0', locale='en-US')
fail_rule = ClientMatchRuleFactory(version='1.0', locale='fr')
ok_(pass_rule.matches(client))
ok_(not fail_rule.matches(client))
开发者ID:hoosteeno,项目名称:snippets-service,代码行数:7,代码来源:test_models.py
示例2: test_regex_match
def test_regex_match(self):
client = self._client(version='15.2.4')
pass_rule = ClientMatchRuleFactory(version='/[\d\.]+/')
fail_rule = ClientMatchRuleFactory(version='/\D+/')
ok_(pass_rule.matches(client))
ok_(not fail_rule.matches(client))
开发者ID:hoosteeno,项目名称:snippets-service,代码行数:7,代码来源:test_models.py
示例3: test_string_match
def test_string_match(self):
client = self._client(channel='aurora')
pass_rule = ClientMatchRuleFactory(channel='aurora')
fail_rule = ClientMatchRuleFactory(channel='nightly')
ok_(pass_rule.matches(client))
ok_(not fail_rule.matches(client))
开发者ID:hoosteeno,项目名称:snippets-service,代码行数:7,代码来源:test_models.py
示例4: test_exclusion_rule_match
def test_exclusion_rule_match(self):
client = self._client(channel='aurora')
fail_rule = ClientMatchRuleFactory(channel='aurora', is_exclusion=True)
pass_rule = ClientMatchRuleFactory(channel='nightly',
is_exclusion=True)
ok_(pass_rule.matches(client))
ok_(not fail_rule.matches(client))
开发者ID:hoosteeno,项目名称:snippets-service,代码行数:8,代码来源:test_models.py
示例5: _dup_test
def _dup_test(self, snippet):
snippet.client_match_rules.add(*ClientMatchRuleFactory.create_batch(3))
snippet_copy = snippet.duplicate()
eq_(snippet_copy.disabled, True)
ok_(snippet_copy.id != snippet.id)
eq_(snippet_copy.locale_set.count(), 1)
ok_(snippet_copy.locale_set.all()[0] != snippet.locale_set.all()[0])
eq_(set(snippet_copy.client_match_rules.all()), set(snippet.client_match_rules.all()))
开发者ID:Osmose,项目名称:snippets-service,代码行数:8,代码来源:test_models.py
示例6: _dup_test
def _dup_test(self, snippet):
snippet.client_match_rules.add(*ClientMatchRuleFactory.create_batch(3))
snippet_copy = snippet.duplicate()
self.assertEqual(snippet_copy.disabled, True)
self.assertTrue(snippet_copy.id != snippet.id)
self.assertEqual(snippet_copy.locales.count(), 1)
self.assertTrue(snippet_copy.locales.all()[0] == snippet.locales.all()[0])
self.assertEqual(set(snippet_copy.client_match_rules.all()),
set(snippet.client_match_rules.all()))
开发者ID:akatsoulas,项目名称:snippets-service,代码行数:9,代码来源:test_models.py
示例7: test_basic
def test_basic(self, matches):
rule1_pass = ClientMatchRuleFactory.create()
rule2_pass = ClientMatchRuleFactory.create()
rule3_fail = ClientMatchRuleFactory.create()
rule4_pass = ClientMatchRuleFactory.create()
rule5_fail = ClientMatchRuleFactory.create()
return_values = {
rule1_pass.id: True,
rule2_pass.id: True,
rule3_fail.id: False,
rule4_pass.id: True,
rule5_fail.id: False,
}
matches.side_effect = lambda self, client: return_values.get(self.id, False)
passed, failed = self.manager.all().evaluate('asdf')
eq_(set([rule1_pass, rule2_pass, rule4_pass]), set(passed))
eq_(set([rule3_fail, rule5_fail]), set(failed))
开发者ID:hoosteeno,项目名称:snippets-service,代码行数:19,代码来源:test_managers.py
示例8: test_empty_match
def test_empty_match(self):
client = self._client(version='1.0', locale='fr')
rule = ClientMatchRuleFactory()
ok_(rule.matches(client))
开发者ID:hoosteeno,项目名称:snippets-service,代码行数:5,代码来源:test_models.py
注:本文中的snippets.base.tests.ClientMatchRuleFactory类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论