Example #1
0
    def setUp(self):
        self.app = ApplicationFactory(name='TestApp')
        self.channel = ChannelFactory(name='alpha')
        self.stable_channel = ChannelFactory(name='stable')
        self.win_v1 = VersionFactory(version='10.0.0.0',
                                     app=self.app,
                                     channel=self.channel)
        self.win_v2 = VersionFactory(version='42.0.1.0',
                                     app=self.app,
                                     channel=self.channel)
        self.win_stable_v = VersionFactory(version='23.0.0.0',
                                           app=self.app,
                                           channel=self.stable_channel)
        self.win_disabled_v = VersionFactory(version='55.0.2.0',
                                             app=self.app,
                                             channel=self.channel,
                                             is_enabled=False)

        self.mac_v1 = SparkleVersionFactory(short_version='10.0.0.0',
                                            version='0.0',
                                            app=self.app,
                                            channel=self.channel)
        self.mac_v2 = SparkleVersionFactory(short_version='42.0.1.0',
                                            version='1.0',
                                            app=self.app,
                                            channel=self.channel)
        self.mac_stable_v = SparkleVersionFactory(short_version='23.0.0.0',
                                                  version='0.0',
                                                  app=self.app,
                                                  channel=self.stable_channel)
        self.mac_disabled_v = SparkleVersionFactory(short_version='55.0.2.0',
                                                    version='2.0',
                                                    app=self.app,
                                                    channel=self.channel,
                                                    is_enabled=False)
        self.exp_res = {
            self.app.name: {
                "win": {
                    self.channel.name: {
                        "url": self.win_v2.file_absolute_url,
                        "version": self.win_v2.version
                    },
                    self.stable_channel.name: {
                        "url": self.win_stable_v.file_absolute_url,
                        "version": self.win_stable_v.version
                    }
                },
                "mac": {
                    self.channel.name: {
                        "url": self.mac_v2.file_absolute_url,
                        "version": self.mac_v2.short_version
                    },
                    self.stable_channel.name: {
                        "url": self.mac_stable_v.file_absolute_url,
                        "version": self.mac_stable_v.short_version
                    }
                }
            }
        }
Example #2
0
 def setUp(self):
     self.app = ApplicationFactory()
     self.a_platform = PlatformFactory(name='a')
     self.b_platform = PlatformFactory(name='b')
     self.empty_platform = PlatformFactory(name='empty')
     self.mac_platform = PlatformFactory(name='mac')
     VersionFactory(platform=self.a_platform, app=self.app)
     VersionFactory(platform=self.b_platform, app=self.app)
Example #3
0
class SparkleVersionFactory(factory.DjangoModelFactory):
    class Meta:
        model = 'sparkle.SparkleVersion'

    app = factory.lazy_attribute(lambda x: ApplicationFactory())
    channel = factory.lazy_attribute(lambda x: ChannelFactory())
    version = '2062.124'
    short_version = '37.0.2062.124'
Example #4
0
class SparkleVersionFactory(factory.DjangoModelFactory):
    class Meta:
        model = 'sparkle.SparkleVersion'

    app = factory.lazy_attribute(lambda x: ApplicationFactory())
    channel = factory.lazy_attribute(lambda x: ChannelFactory())
    version = '2062.124'
    short_version = '37.0.2062.124'
    file = factory.django.FileField(filename='the_file.dat')
    file_size = 123
Example #5
0
 def test_public_sparkle_update(self):
     ChannelFactory._meta.database = 'root'
     channel_name = 'test'
     channel = ChannelFactory(name=channel_name)
     app_name = 'SparrowTestApp'
     ApplicationFactory._meta.database = 'root'
     app = ApplicationFactory(name=app_name)
     file = SimpleUploadedFile("test.dmg", b"content")
     SparkleVersionFactory._meta.database = 'root'
     SparkleVersionFactory.create(channel=channel, app=app, file=file)
     url = '%s%s' % (self.live_server_url,
                     reverse('sparkle_appcast',
                             kwargs=dict(app_name=app_name,
                                         channel=channel_name))
                     )  # replace by reverse
     resp = requests.get(url)
     root = objectify.fromstring(resp.content)
     self.assertTrue(app_name in str(root.channel.item.title))
Example #6
0
 def test_serializer(self):
     data = dict(id='{D0AB2EBC-931B-4013-9FEB-C9C4C2225C8C}',
                 name='chrome2')
     app = ApplicationFactory(**data)
     data.update(dict(data_set=[]))
     self.assertDictEqual(AppSerializer(app).data, data)