本文整理汇总了Python中mkt.constants.features.FeatureProfile.to_signature方法的典型用法代码示例。如果您正苦于以下问题:Python FeatureProfile.to_signature方法的具体用法?Python FeatureProfile.to_signature怎么用?Python FeatureProfile.to_signature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mkt.constants.features.FeatureProfile
的用法示例。
在下文中一共展示了FeatureProfile.to_signature方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_feature_compatibility_false
# 需要导入模块: from mkt.constants.features import FeatureProfile [as 别名]
# 或者: from mkt.constants.features.FeatureProfile import to_signature [as 别名]
def test_feature_compatibility_false(self):
self.app.current_version.features.update(has_apps=True, has_nfc=True)
feature_profile = FeatureProfile(apps=False, nfc=True, mobileid=True)
self.request = RequestFactory().get(
'/?dev=firefoxos&pro=%s' % feature_profile.to_signature())
res = self.serialize(self.app)
eq_(res['feature_compatibility'], False)
示例2: profile_qs
# 需要导入模块: from mkt.constants.features import FeatureProfile [as 别名]
# 或者: from mkt.constants.features.FeatureProfile import to_signature [as 别名]
def profile_qs(self, disabled_features=None):
if disabled_features is None:
disabled_features = {}
profile = FeatureProfile().fromkeys(FeatureProfile(), True)
for feature in disabled_features:
profile[feature] = False
return {'pro': profile.to_signature(), 'dev': 'firefoxos'}
示例3: test_feature_compatibility_no_current_version
# 需要导入模块: from mkt.constants.features import FeatureProfile [as 别名]
# 或者: from mkt.constants.features.FeatureProfile import to_signature [as 别名]
def test_feature_compatibility_no_current_version(self):
self.app._current_version = None
feature_profile = FeatureProfile(apps=True, nfc=True, mobileid=True)
self.request = RequestFactory().get(
'/?dev=firefoxos&pro=%s' % feature_profile.to_signature())
res = self.serialize(self.app)
eq_(res['feature_compatibility'], None)
示例4: test_feature_compatibility_always_none
# 需要导入模块: from mkt.constants.features import FeatureProfile [as 别名]
# 或者: from mkt.constants.features.FeatureProfile import to_signature [as 别名]
def test_feature_compatibility_always_none(self):
# ES is already filtering by feature profile for us, so it does not
# make much sense to check for feature compatibility in ES serializer.
self.app.current_version.features.update(has_apps=True, has_nfc=True)
self.reindex(Webapp)
feature_profile = FeatureProfile(apps=False, nfc=True, mobileid=True)
self.request = RequestFactory().get(
'/?dev=firefoxos&pro=%s' % feature_profile.to_signature())
self.request.REGION = mkt.regions.USA
self.request.user = self.profile
res = self.serialize()
eq_(res['feature_compatibility'], None)
示例5: TestLoadFeatureProfile
# 需要导入模块: from mkt.constants.features import FeatureProfile [as 别名]
# 或者: from mkt.constants.features.FeatureProfile import to_signature [as 别名]
class TestLoadFeatureProfile(mkt.site.tests.TestCase):
def setUp(self):
super(TestLoadFeatureProfile, self).setUp()
self.profile = FeatureProfile(apps=True)
self.signature = self.profile.to_signature()
def test_does_nothing_on_desktop(self):
request = RequestFactory().get('/?dev=desktop&pro=%s' % self.signature)
load_feature_profile(request)
eq_(request.feature_profile, None)
def test_does_nothing_without_dev_param(self):
request = RequestFactory().get('/?pro=%s' % self.signature)
load_feature_profile(request)
eq_(request.feature_profile, None)
request = RequestFactory().get(
'/?device=mobilepro=%s' % self.signature)
load_feature_profile(request)
eq_(request.feature_profile, None)
def test_does_nothing_without_profile_signature(self):
request = RequestFactory().get('/?dev=firefoxos')
load_feature_profile(request)
eq_(request.feature_profile, None)
def test_does_nothing_if_invalid_profile_signature_is_passed(self):
request = RequestFactory().get('/?dev=firefoxos&pro=whatever')
load_feature_profile(request)
eq_(request.feature_profile, None)
def test_works(self):
request = RequestFactory().get(
'/?dev=firefoxos&pro=%s' % self.signature)
load_feature_profile(request)
eq_(request.feature_profile.to_list(), self.profile.to_list())
@mock.patch('mkt.features.utils.FeatureProfile.from_signature')
def test_caching_on_request_property(self, from_signature_mock):
fake_feature_profile = object()
from_signature_mock.return_value = fake_feature_profile
request = RequestFactory().get(
'/?dev=firefoxos&pro=%s' % self.signature)
load_feature_profile(request)
eq_(request.feature_profile, fake_feature_profile)
from_signature_mock.return_value = None
load_feature_profile(request)
# Should not be None thanks to the property caching.
eq_(request.feature_profile, fake_feature_profile)
示例6: test_init
# 需要导入模块: from mkt.constants.features import FeatureProfile [as 别名]
# 或者: from mkt.constants.features.FeatureProfile import to_signature [as 别名]
def test_init(self):
profile = FeatureProfile(**dict(
(f, True) for f in self.expected_features))
eq_(profile.to_signature(), self.signature)
eq_(profile.to_int(), self.features)
示例7: test_init
# 需要导入模块: from mkt.constants.features import FeatureProfile [as 别名]
# 或者: from mkt.constants.features.FeatureProfile import to_signature [as 别名]
def test_init(self):
profile = FeatureProfile(**dict((f, True) for f in self.truths))
eq_(profile.to_signature(), self.signature)
eq_(profile.to_binary(), self.binary)