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


Python factories.VersionFactory类代码示例

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


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

示例1: test_updatecheck_positive_critical_on_other_channel

    def test_updatecheck_positive_critical_on_other_channel(self):
        app = ApplicationFactory.create(id='{D0AB2EBC-931B-4013-9FEB-C9C4C2225C8C}', name='chrome')
        platform = PlatformFactory.create(name='win')
        channel = ChannelFactory.create(name='stable')
        channel2 = ChannelFactory.create(name='alpha')
        first_version = VersionFactory.create(
            app=app,
            platform=platform,
            channel=channel,
            version='13.0.782.110',
            file=SimpleUploadedFile('./chrome_installer_first.exe', b'_' * 23963192),
            file_size=23963192)
        first_version.file_hash = 'VXriGUVI0TNqfLlU02vBel4Q3Zo='
        first_version.save()

        critical_version = VersionFactory.create(
            is_critical=True,
            app=app,
            platform=platform,
            channel=channel2,
            version='13.0.782.111',
            file=SimpleUploadedFile('./chrome_installer_critical.exe', b'_' * 23963192),
            file_size=23963192)
        critical_version.file_hash = 'VXriGUVI0TNqfLlU02vBel4Q3Zo='
        critical_version.save()

        last_version = VersionFactory.create(
            app=app,
            platform=platform,
            channel=channel,
            version='13.0.782.112',
            file=SimpleUploadedFile('./chrome_installer.exe', b'_' * 23963192),
            file_size=23963192)
        last_version.file_hash = 'VXriGUVI0TNqfLlU02vBel4Q3Zo='
        last_version.save()

        Action.objects.create(
            version=last_version,
            arguments='--do-not-launch-chrome',
            event=EVENT_DICT_CHOICES['install'],
            run='chrome_installer.exe'
        )

        Action.objects.create(
            version=last_version,
            event=EVENT_DICT_CHOICES['postinstall'],
            other=dict(
                version='13.0.782.112',
                onsuccess='exitsilentlyonlaunchcmd',
            )
        )

        response = self.client.post(reverse('update'),
                                    fixtures.request_update_check, content_type='text/xml')

        self.assertEqual(response.status_code, 200)

        self.assertXmlDocument(response.content)
        self.assertXmlEquivalentOutputs(response.content,
                                        fixtures.response_update_check_positive)
开发者ID:Crystalnix,项目名称:omaha-server,代码行数:60,代码来源:test_views.py

示例2: test_monitoring

    def test_monitoring(self):
        for key in self.cache_keys:
            self.assertEqual(cache.get(key, 0), 0)

        VersionFactory.create(file_size=100)
        SparkleVersionFactory.create(file_size=100)
        Crash.objects.create(archive_size=80, minidump_size=20)
        Symbols.objects.create(file_size=100)
        Feedback.objects.create(screenshot_size=25, blackbox_size=25, attached_file_size=25, system_logs_size=25)

        monitoring_size()

        for key in self.cache_keys:
            self.assertEqual(cache.get(key), 100)
开发者ID:FrankPerryCarbonite,项目名称:omaha-server,代码行数:14,代码来源:test_limitation.py

示例3: test_get_attributes

    def test_get_attributes(self):
        ver = VersionFactory.create(file=SimpleUploadedFile('./chrome_installer.exe', False))
        action = Action(
            version=ver,
            arguments='--do-not-launch-chrome',
            event=EVENT_DICT_CHOICES['install'],
            run='chrome_installer.exe'
        )

        self.assertDictEqual(
            action.get_attributes(),
            dict(
                arguments='--do-not-launch-chrome',
                run='chrome_installer.exe',
            ))

        action = Action(
            version=ver,
            terminateallbrowsers=True,
            event=EVENT_DICT_CHOICES['postinstall'],
            other=dict(
                version='13.0.782.112',
                onsuccess='exitsilentlyonlaunchcmd')
        )

        self.assertDictEqual(
            action.get_attributes(),
            dict(
                terminateallbrowsers='true',
                version='13.0.782.112',
                onsuccess='exitsilentlyonlaunchcmd',
            )
        )
开发者ID:anmekin,项目名称:omaha-server,代码行数:33,代码来源:test_models.py

示例4: test_filter_by_enabled

    def test_filter_by_enabled(self):
        version = VersionFactory.create(
            version='37.0.2062.125',
            file=SimpleUploadedFile('./chrome_installer.exe', False))
        version_disabled = VersionFactory.create(
            app=version.app,
            platform=version.platform,
            channel=version.channel,
            is_enabled=False,
            version='38.0.2062.125',
            file=SimpleUploadedFile('./chrome_installer2.exe', False))

        self.assertEqual(Version.objects.all().count(), 2)
        self.assertEqual(Version.objects.filter_by_enabled().count(), 1)
        self.assertIn(version, Version.objects.filter_by_enabled())
        self.assertNotIn(version_disabled, Version.objects.filter_by_enabled())
开发者ID:Crystalnix,项目名称:omaha-server,代码行数:16,代码来源:test_managers.py

示例5: test_get_version_partial_update

    def test_get_version_partial_update(self):
        userid = "{%s}" % UUID(int=1)
        userid_beta = "{%s}" % UUID(int=40)
        version = VersionFactory.create(file=SimpleUploadedFile('./chrome_installer.exe', b''))
        version_beta = Version.objects.create(
            file=SimpleUploadedFile('./chrome_installer.exe', b''),
            app=version.app,
            platform=version.platform,
            channel=version.channel,
            version='39.0.0.0',
        )

        PartialUpdate.objects.create(version=version_beta,
                                     percent=5,
                                     start_date=datetime.now(),
                                     end_date=datetime.now(),
                                     active_users=ACTIVE_USERS_DICT_CHOICES['all'])

        self.assertEqual(version, get_version(version.app.pk,
                                              version.platform.name,
                                              version.channel.name,
                                              '36.0.2062.124',
                                              userid))

        self.assertEqual(version_beta, get_version(version.app.pk,
                                                   version.platform.name,
                                                   version.channel.name,
                                                   '36.0.2062.124',
                                                   userid_beta))
开发者ID:Crystalnix,项目名称:omaha-server,代码行数:29,代码来源:test_builder.py

示例6: test_data

    def test_data(self):
        app = ApplicationFactory.create(id='{430FD4D0-B729-4F61-AA34-91526481799D}', name='chrome')
        platform = PlatformFactory.create(name='win')
        channel = ChannelFactory.create(name='stable')
        obj = VersionFactory.create(
            app=app,
            platform=platform,
            channel=channel,
            version='13.0.782.112',
            file=SimpleUploadedFile('./chrome_installer.exe', b'_' * 23963192),
            file_size=23963192)
        obj.file_hash = 'VXriGUVI0TNqfLlU02vBel4Q3Zo='
        obj.save()

        Data.objects.create(
            app=app,
            name=NAME_DATA_DICT_CHOICES['install'],
            index='verboselogging',
            value='app-specific values here')

        Data.objects.create(
            app=app,
            name=NAME_DATA_DICT_CHOICES['untrusted'])

        response = self.client.post(reverse('update'),
                                    fixtures.request_data, content_type='text/xml')

        self.assertEqual(response.status_code, 200)

        self.assertXmlDocument(response.content)
        self.assertXmlEquivalentOutputs(response.content,
                                        fixtures.response_data)
开发者ID:Crystalnix,项目名称:omaha-server,代码行数:32,代码来源:test_views.py

示例7: test_property

 def test_property(self):
     version = VersionFactory.create(file=SimpleUploadedFile('./chrome_installer.exe', ''))
     self.assertEqual(version.file_absolute_url,
                      'http://cache.pack.google.com/edgedl/chrome/install/782.112/chrome_installer.exe')
     self.assertEqual(version.file_package_name, 'chrome_installer.exe')
     self.assertEqual(version.file_url,
                      u'http://cache.pack.google.com/edgedl/chrome/install/782.112/')
开发者ID:anmekin,项目名称:omaha-server,代码行数:7,代码来源:test_models.py

示例8: test_create

 def test_create(self):
     version = VersionFactory.create()
     data = dict(event=1, version=version.pk)
     response = self.client.post(reverse(self.url), data, format='json')
     self.assertEqual(response.status_code, status.HTTP_201_CREATED)
     obj = Action.objects.get(id=response.data['id'])
     self.assertEqual(response.data, self.serializer(obj).data)
开发者ID:xiaojianwu,项目名称:omaha-server,代码行数:7,代码来源:test_api.py

示例9: test_property_default_storage

 def test_property_default_storage(self):
     version = VersionFactory.create(file=SimpleUploadedFile('./chrome_installer.exe', ''))
     _url = 'http://example.com/static/media/build/%s/%s/%s/37.0.2062.124/chrome_installer.exe' \
           % (version.app.name, version.channel.name, version.platform.name)
     self.assertEqual(version.file_absolute_url, _url)
     self.assertEqual(version.file_package_name, 'chrome_installer.exe')
     _url = u'http://example.com/static/media/build/%s/%s/%s/37.0.2062.124/' \
            % (version.app.name, version.channel.name, version.platform.name)
     self.assertEqual(version.file_url, _url)
开发者ID:anmekin,项目名称:omaha-server,代码行数:9,代码来源:test_models.py

示例10: test_version_upload_to

 def test_version_upload_to(self):
     version = VersionFactory.create(file=SimpleUploadedFile('./chrome_installer.exe', False))
     self.assertEqual(version_upload_to(version, 'chrome_installer.exe'),
                      'build/{}/{}/{}/{}/chrome_installer.exe'.format(
                          version.app.name,
                          version.channel.name,
                          version.platform.name,
                          version.version,
                          version.file.name,
                      ))
开发者ID:anmekin,项目名称:omaha-server,代码行数:10,代码来源:test_models.py

示例11: test_updatecheck_positive_critical

    def test_updatecheck_positive_critical(self):
        app = ApplicationFactory.create(id='{D0AB2EBC-931B-4013-9FEB-C9C4C2225C8C}', name='chrome')
        platform = PlatformFactory.create(name='win')
        channel = ChannelFactory.create(name='stable')
        first_version = VersionFactory.create(
            app=app,
            platform=platform,
            channel=channel,
            version='13.0.782.110',
            file=SimpleUploadedFile('./chrome_installer_first.exe', b'_' * 23963192),
            file_size=23963192)
        first_version.file_hash = 'VXriGUVI0TNqfLlU02vBel4Q3Zo='
        first_version.save()

        critical_version = VersionFactory.create(
            is_critical=True,
            app=app,
            platform=platform,
            channel=channel,
            version='13.0.782.111',
            file=SimpleUploadedFile('./chrome_installer_critical.exe', b'_' * 23963192),
            file_size=23963192)
        critical_version.file_hash = 'VXriGUVI0TNqfLlU02vBel4Q3Zo='
        critical_version.save()

        last_version = VersionFactory.create(
            app=app,
            platform=platform,
            channel=channel,
            version='13.0.782.112',
            file=SimpleUploadedFile('./chrome_installer.exe', b'_' * 23963192),
            file_size=23963192)
        last_version.file_hash = 'VXriGUVI0TNqfLlU02vBel4Q3Zo='
        last_version.save()

        response = self.client.post(reverse('update'),
                                    fixtures.request_update_check, content_type='text/xml')

        self.assertEqual(response.status_code, 200)

        self.assertXmlDocument(response.content)
        self.assertXmlEquivalentOutputs(response.content,
                                        fixtures.response_update_check_postitive_critical)
开发者ID:Crystalnix,项目名称:omaha-server,代码行数:43,代码来源:test_views.py

示例12: test_userid_counting

    def test_userid_counting(self):
        now = datetime.utcnow()
        userid = '{D0BBD725-742D-44ae-8D46-0231E881D58E}'
        user_id = get_id(userid)
        appid1 = '{430FD4D0-B729-4F61-AA34-91526481799D}'
        appid2 = '{D0AB2EBC-931B-4013-9FEB-C9C4C2225C8C}'

        request_events = DayEvents('request', now.year, now.month, now.day)
        app1_events = DayEvents('request:%s' % appid1, now.year, now.month, now.day)
        app2_events = DayEvents('request:%s' % appid2, now.year, now.month, now.day)

        self.assertEqual(len(request_events), 0)
        self.assertEqual(len(app1_events), 0)
        self.assertEqual(len(app2_events), 0)


        app = ApplicationFactory.create(id='{D0AB2EBC-931B-4013-9FEB-C9C4C2225C8C}', name='chrome')
        platform = PlatformFactory.create(name='win')
        channel = ChannelFactory.create(name='stable')
        obj = VersionFactory.create(
            app=app,
            platform=platform,
            channel=channel,
            version='13.0.782.112',
            file=SimpleUploadedFile('./chrome_installer.exe', b'_' * 23963192))
        obj.file_hash = 'VXriGUVI0TNqfLlU02vBel4Q3Zo='
        obj.save()

        Action.objects.create(
            version=obj,
            arguments='--do-not-launch-chrome',
            event=EVENT_DICT_CHOICES['install'],
            run='chrome_installer.exe'
        )

        Action.objects.create(
            version=obj,
            event=EVENT_DICT_CHOICES['postinstall'],
            other=dict(
                version='13.0.782.112',
                onsuccess='exitsilentlyonlaunchcmd',
            )
        )

        self.client.post(reverse('update'),
                         fixtures.request_update_check, content_type='text/xml')

        self.assertEqual(len(request_events), 1)
        self.assertEqual(len(app1_events), 1)
        self.assertEqual(len(app2_events), 1)
        self.assertTrue(user_id in request_events)
        self.assertTrue(user_id in app1_events)
        self.assertTrue(user_id in app2_events)
开发者ID:ianblenke,项目名称:omaha-server,代码行数:53,代码来源:test_views.py

示例13: test_create

 def test_create(self):
     version = VersionFactory.create()
     data = dict(
         is_enabled=True,
         exclude_new_users=True,
         version=version.pk,
         end_date=str(date.today()),
         percent=51.0,
         start_date=str(date.today()),
         active_users=1,
     )
     response = self.client.post(reverse(self.url), data, format='json')
     self.assertEqual(response.status_code, status.HTTP_201_CREATED)
     obj = PartialUpdate.objects.get(id=response.data['id'])
     self.assertEqual(response.data, self.serializer(obj).data)
开发者ID:anmekin,项目名称:omaha-server,代码行数:15,代码来源:test_api.py

示例14: test_get_version

    def test_get_version(self):
        userid = '{D0BBD725-742D-44ae-8D46-0231E881D58E}'
        version = VersionFactory.create(file=SimpleUploadedFile('./chrome_installer.exe', b''))

        self.assertEqual(version, get_version(version.app.pk,
                                              version.platform.name,
                                              version.channel.name,
                                              '36.0.2062.124',
                                              userid))

        self.assertEqual(version, get_version(version.app.pk,
                                              version.platform.name,
                                              version.channel.name,
                                              '',
                                              userid))
开发者ID:Crystalnix,项目名称:omaha-server,代码行数:15,代码来源:test_builder.py

示例15: test_serializer

 def test_serializer(self):
     version = VersionFactory.create(file=SimpleUploadedFile('./chrome_installer.exe', False))
     self.assertDictEqual(VersionSerializer(version).data, dict(
         id=version.id,
         is_enabled=version.is_enabled,
         app=version.app.id,
         platform=version.platform.id,
         channel=version.channel.id,
         version=str(version.version),
         release_notes=version.release_notes,
         file=version.file.url,
         file_hash=version.file_hash,
         file_size=version.file_size,
         created=version.created.strftime('%Y-%m-%dT%H:%M:%S.%fZ'),
         modified=version.modified.strftime('%Y-%m-%dT%H:%M:%S.%fZ'),
     ))
开发者ID:cogren1,项目名称:omaha-server,代码行数:16,代码来源:test_serializers.py


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