本文整理汇总了Python中fjord.feedback.tests.ResponseFactory.locale方法的典型用法代码示例。如果您正苦于以下问题:Python ResponseFactory.locale方法的具体用法?Python ResponseFactory.locale怎么用?Python ResponseFactory.locale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fjord.feedback.tests.ResponseFactory
的用法示例。
在下文中一共展示了ResponseFactory.locale方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_match
# 需要导入模块: from fjord.feedback.tests import ResponseFactory [as 别名]
# 或者: from fjord.feedback.tests.ResponseFactory import locale [as 别名]
def test_match(self):
# Note: This isn't an exhaustive test. Just a rough cursory check.
# TriggerRule that matches everything matches everything.
tr = TriggerRuleFactory(
versions=[],
locales=[],
keywords=[],
products=[],
)
resp = ResponseFactory()
assert tr.match(resp) is True
tr = TriggerRuleFactory(
versions=[u'38*'],
locales=[u'en-US', u'fr'],
keywords=[u'rc4'],
url_exists=True
)
prod = ProductFactory()
tr.products.add(prod)
resp = ResponseFactory(
version=u'38.0.5',
locale=u'en-US',
product=prod.db_name,
description=u'rc4 is awesome',
url=u'https://example.com/'
)
assert tr.match(resp) is True
resp.locale = 'es'
assert tr.match(resp) is False
示例2: test_match
# 需要导入模块: from fjord.feedback.tests import ResponseFactory [as 别名]
# 或者: from fjord.feedback.tests.ResponseFactory import locale [as 别名]
def test_match(self):
# Note: This isn't an exhaustive test. Just a rough cursory check.
# TriggerRule that matches everything matches everything.
tr = TriggerRuleFactory(versions=[], locales=[], keywords=[], products=[])
trm = tr.get_matcher()
resp = ResponseFactory()
assert trm.match(resp) is True
tr = TriggerRuleFactory(versions=[u"38*"], locales=[u"en-US", u"fr"], keywords=[u"rc4"], url_exists=True)
prod = ProductFactory()
tr.products.add(prod)
trm = tr.get_matcher()
resp = ResponseFactory(
version=u"38.0.5",
locale=u"en-US",
product=prod.db_name,
description=u"rc4 is awesome",
url=u"https://example.com/",
)
assert trm.match(resp) is True
resp.locale = "es"
assert trm.match(resp) is False