当前位置: 首页>>代码示例>>Python>>正文


Python FeatureProfile.to_signature方法代码示例

本文整理汇总了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)
开发者ID:mrheides,项目名称:zamboni,代码行数:9,代码来源:test_serializers.py

示例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'}
开发者ID:Jobava,项目名称:zamboni,代码行数:9,代码来源:test_filters.py

示例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)
开发者ID:ujdhesa,项目名称:zamboni,代码行数:9,代码来源:test_serializers.py

示例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)
开发者ID:mrheides,项目名称:zamboni,代码行数:14,代码来源:test_serializers.py

示例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)
开发者ID:Fjoerfoks,项目名称:zamboni,代码行数:51,代码来源:test_utils_.py

示例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)
开发者ID:jobava-mozilla,项目名称:zamboni,代码行数:7,代码来源:test_features.py

示例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)
开发者ID:wraithan,项目名称:zamboni,代码行数:6,代码来源:test_features.py


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