def setUp(self):
        redis.flushdb()
        self.app = Application.objects.create(id='app', name='app')
        self.channel = Channel.objects.create(name='stable')
        self.platform = Platform.objects.create(name='win')
        self.version1 = Version.objects.create(
            app=self.app,
            platform=self.platform,
            channel=self.channel,
            version='1.0.0.0',
            file=SimpleUploadedFile('./chrome_installer.exe', False))
        self.version2 = Version.objects.create(
            app=self.app,
            platform=self.platform,
            channel=self.channel,
            version='2.0.0.0',
            file=SimpleUploadedFile('./chrome_installer.exe', False))
        self.app_list = [dict(appid=self.app.id, version=str(self.version1.version))]

        self._generate_fake_statistics()
        self.users_statistics = [('January', 1),
                                 ('February', 2),
                                 ('March', 3),
                                 ('April', 4),
                                 ('May', 5),
                                 ('June', 6),
                                 ('July', 7),
                                 ('August', 8),
                                 ('September', 9),
                                 ('October', 10),
                                 ('November', 11),
                                 ('December', 12)]
예제 #2
0
    def setUp(self):
        redis.flushdb()
        self.app = Application.objects.create(id='app', name='app')
        self.channel = Channel.objects.create(name='stable')
        self.platform = Platform.objects.create(name='win')
        self.version1 = Version.objects.create(app=self.app,
                                               platform=self.platform,
                                               channel=self.channel,
                                               version='1.0.0.0',
                                               file=SimpleUploadedFile(
                                                   './chrome_installer.exe',
                                                   False))
        self.version2 = Version.objects.create(app=self.app,
                                               platform=self.platform,
                                               channel=self.channel,
                                               version='2.0.0.0',
                                               file=SimpleUploadedFile(
                                                   './chrome_installer.exe',
                                                   False))
        self.app_list = [
            dict(appid=self.app.id, version=str(self.version1.version))
        ]

        self._generate_fake_statistics()
        self.users_statistics = [('January', 1), ('February', 2), ('March', 3),
                                 ('April', 4), ('May', 5), ('June', 6),
                                 ('July', 7), ('August', 8), ('September', 9),
                                 ('October', 10), ('November', 11),
                                 ('December', 12)]
예제 #3
0
    def setUp(self):
        self.user = User.objects.create_user(username='******', password='******', email='*****@*****.**')
        self.client.credentials(
            HTTP_AUTHORIZATION='Basic %s' % base64.b64encode(bytes('{}:{}'.format('test', 'secret'), 'utf8')).decode())

        redis.flushdb()
        self.app = Application.objects.create(id='app', name='app')
        self.channel = Channel.objects.create(name='stable')
        self.platform = Platform.objects.create(name='win')
        self.version1 = Version.objects.create(
            app=self.app,
            platform=self.platform,
            channel=self.channel,
            version='1.0.0.0',
            file=SimpleUploadedFile('./chrome_installer.exe', False))
        self.version2 = Version.objects.create(
            app=self.app,
            platform=self.platform,
            channel=self.channel,
            version='2.0.0.0',
            file=SimpleUploadedFile('./chrome_installer.exe', False))
        self.app_list = [dict(appid=self.app.id, version=str(self.version1.version))]

        self._generate_fake_statistics()
        now = datetime.now()
        self.users_statistics = [(datetime(now.year-1, x, 1).strftime("%Y-%m"), x) for x in range(2, 13)]
        self.users_statistics.append((datetime(now.year, 1, 1).strftime("%Y-%m"), 1))
        self.data = dict(data=dict(self.users_statistics))
예제 #4
0
    def setUp(self):
        self.user = User.objects.create_user(username='******', password='******', email='*****@*****.**')
        self.client.credentials(
            HTTP_AUTHORIZATION='Basic %s' % base64.b64encode(bytes('{}:{}'.format('test', 'secret'), 'utf8')).decode())

        redis.flushdb()
        self.app = Application.objects.create(id='app', name='app')
        self.channel = Channel.objects.create(name='stable')
        self.platform = Platform.objects.create(name='win')
        self.version1 = Version.objects.create(
            app=self.app,
            platform=self.platform,
            channel=self.channel,
            version='1.0.0.0',
            file=SimpleUploadedFile('./chrome_installer.exe', False))

        self.version2 = Version.objects.create(
            app=self.app,
            platform=self.platform,
            channel=self.channel,
            version='2.0.0.0',
            file=SimpleUploadedFile('./chrome_installer.exe', False))

        self.sparkle_version1 = SparkleVersion.objects.create(
            app=self.app,
            channel=self.channel,
            version='0.0',
            short_version='3.0.0.0',
            file=SimpleUploadedFile('./chrome_installer.dmg', False))

        self.sparkle_version2 = SparkleVersion.objects.create(
            app=self.app,
            channel=self.channel,
            version='0.1',
            short_version='4.0.0.1',
            file=SimpleUploadedFile('./chrome_installer.dmg', False))

        self.n_hours = 36
        self._generate_fake_statistics()

        hours = [datetime(2016, 2, 13, 0, tzinfo=pytz.UTC) + timedelta(hours=hour)
                 for hour in range(self.n_hours)]
        self.win_statistics = [('1.0.0.0', [[hour.strftime("%Y-%m-%dT%H:%M:%S.%fZ"), self.n_hours - i]
                                            for (i, hour)in enumerate(hours)])]
        self.win_statistics.append(('2.0.0.0', [[hour.strftime("%Y-%m-%dT%H:%M:%S.%fZ"), i]
                                                for (i, hour)in enumerate(hours)]))

        self.mac_statistics = [('3.0.0.0', [[hour.strftime("%Y-%m-%dT%H:%M:%S.%fZ"), self.n_hours - i]
                                            for (i, hour)in enumerate(hours)])]
        self.mac_statistics.append(('4.0.0.1', [[hour.strftime("%Y-%m-%dT%H:%M:%S.%fZ"), i]
                                                for (i, hour)in enumerate(hours)]))

        self.data = dict(data=dict(win=dict(self.win_statistics),
                                   mac=dict(self.mac_statistics)))
예제 #5
0
    def setUp(self):
        self.user = User.objects.create_user(username='******',
                                             password='******',
                                             email='*****@*****.**')
        self.client.credentials(
            HTTP_AUTHORIZATION='Basic %s' % base64.b64encode(
                bytes('{}:{}'.format('test', 'secret'), 'utf8')).decode())

        redis.flushdb()
        self.app = Application.objects.create(id='app', name='app')
        self.channel = Channel.objects.create(name='stable')
        self.platform = Platform.objects.create(name='win')
        self.version1 = Version.objects.create(app=self.app,
                                               platform=self.platform,
                                               channel=self.channel,
                                               version='1.0.0.0',
                                               file=SimpleUploadedFile(
                                                   './chrome_installer.exe',
                                                   False))
        self.version2 = Version.objects.create(app=self.app,
                                               platform=self.platform,
                                               channel=self.channel,
                                               version='2.0.0.0',
                                               file=SimpleUploadedFile(
                                                   './chrome_installer.exe',
                                                   False))
        self.mac_version = SparkleVersion.objects.create(
            app=self.app,
            channel=self.channel,
            version='782.112',
            short_version='13.0.782.112',
            dsa_signature=
            'MCwCFCdoW13VBGJWIfIklKxQVyetgxE7AhQTVuY9uQT0KOV1UEk21epBsGZMPg==',
            file=SimpleUploadedFile('./chrome.dmg', b'_' * 1024),
            file_size=1024)
        self.app_list = [
            dict(appid=self.app.id, version=str(self.version1.version))
        ]
        self.mac_app = dict(appid=self.app.id,
                            version=str(self.mac_version.short_version))

        self._generate_fake_statistics()
        now = datetime.now()
        updates = [(datetime(now.year - 1, x, 1).strftime("%Y-%m"), x - 1)
                   for x in range(2, 13)]
        updates.append((datetime(now.year, 1, 1).strftime("%Y-%m"), 0))
        installs = [(datetime(now.year - 1, x, 1).strftime("%Y-%m"), 1)
                    for x in range(2, 13)]
        installs.append((datetime(now.year, 1, 1).strftime("%Y-%m"), 1))
        platform_statistics = dict(new=installs, updates=updates)
        self.users_statistics = dict(win=platform_statistics,
                                     mac=platform_statistics)
        self.data = dict(data=dict(self.users_statistics))
예제 #6
0
    def setUp(self):
        self.user = User.objects.create_user(username='******', password='******', email='*****@*****.**')
        self.client.credentials(
            HTTP_AUTHORIZATION='Basic %s' % base64.b64encode(bytes('{}:{}'.format('test', 'secret'), 'utf8')).decode())

        redis.flushdb()
        self.app = Application.objects.create(id='app', name='app')
        self.channel = Channel.objects.create(name='stable')
        self.platform = Platform.objects.create(name='win')
        Platform.objects.create(name='mac')
        self.version1 = Version.objects.create(
            app=self.app,
            platform=self.platform,
            channel=self.channel,
            version='1.0.0.0',
            file=SimpleUploadedFile('./chrome_installer.exe', False))
        self.version2 = Version.objects.create(
            app=self.app,
            platform=self.platform,
            channel=self.channel,
            version='2.0.0.0',
            file=SimpleUploadedFile('./chrome_installer.exe', False))
        self.mac_version = SparkleVersion.objects.create(
            app=self.app,
            channel=self.channel,
            version='782.112',
            short_version='13.0.782.112',
            dsa_signature='MCwCFCdoW13VBGJWIfIklKxQVyetgxE7AhQTVuY9uQT0KOV1UEk21epBsGZMPg==',
            file=SimpleUploadedFile('./chrome.dmg', b'_' * 1024),
            file_size=1024)
        app_kwargs = dict(appid=self.app.id, version=str(self.version1.version))
        install_app = create_app_xml(events=[fixtures.event_install_success], **app_kwargs)
        uninstall_app = create_app_xml(events=[fixtures.event_uninstall_success], **app_kwargs)
        self.install_app_list = [install_app]
        self.uninstall_app_list = [uninstall_app]
        self.mac_app = dict(appid=self.app.id, version=str(self.mac_version.short_version))

        self._generate_fake_statistics()
        now = datetime.now()
        updates = [(datetime(now.year-1, x, 1).strftime("%Y-%m"), x - 1) for x in range(2, 13)]
        updates.append((datetime(now.year, 1, 1).strftime("%Y-%m"), 0))
        installs = [(datetime(now.year-1, x, 1).strftime("%Y-%m"), 1) for x in range(2, 13)]
        installs.append((datetime(now.year, 1, 1).strftime("%Y-%m"), 1))
        uninstalls = [(datetime(now.year-1, x, 1).strftime("%Y-%m"), 1) for x in range(2, 13)]
        uninstalls.append((datetime(now.year, 1, 1).strftime("%Y-%m"), 1))

        win_platform_statistics = dict(new=installs, updates=updates, uninstalls=uninstalls)
        mac_platform_statistics = dict(new=installs, updates=updates)
        self.users_statistics = dict(win=win_platform_statistics, mac=mac_platform_statistics)
        self.data = dict(data=dict(self.users_statistics))
예제 #7
0
    def setUp(self):
        redis.flushdb()
        self.app = Application.objects.create(id="app", name="app")
        self.channel = Channel.objects.create(name="stable")
        self.platform = Platform.objects.create(name="win")
        self.version1 = Version.objects.create(
            app=self.app,
            platform=self.platform,
            channel=self.channel,
            version="1.0.0.0",
            file=SimpleUploadedFile("./chrome_installer.exe", False),
        )
        self.version2 = Version.objects.create(
            app=self.app,
            platform=self.platform,
            channel=self.channel,
            version="2.0.0.0",
            file=SimpleUploadedFile("./chrome_installer.exe", False),
        )
        self.mac_version = SparkleVersion.objects.create(
            app=self.app,
            channel=self.channel,
            version="782.112",
            short_version="13.0.782.112",
            dsa_signature="MCwCFCdoW13VBGJWIfIklKxQVyetgxE7AhQTVuY9uQT0KOV1UEk21epBsGZMPg==",
            file=SimpleUploadedFile("./chrome.dmg", b"_" * 23963192),
            file_size=23963192,
        )

        app_kwargs = dict(appid=self.app.id, version=str(self.version1.version))
        install_app = create_app_xml(events=[fixtures.event_install_success], **app_kwargs)
        uninstall_app = create_app_xml(events=[fixtures.event_uninstall_success], **app_kwargs)
        self.install_app_list = [install_app]
        self.uninstall_app_list = [uninstall_app]
        self.mac_app = dict(appid=self.app.id, version=str(self.mac_version.short_version))

        self._generate_fake_statistics()
        now = datetime.now()
        win_updates = [(datetime(now.year, x, 1).strftime("%Y-%m"), x - 1) for x in range(1, 13)]
        win_installs = [(datetime(now.year, x, 1).strftime("%Y-%m"), 1) for x in range(1, 13)]
        uninstalls = [(datetime(now.year, x, 1).strftime("%Y-%m"), 1) for x in range(1, 13)]
        mac_updates = [(datetime(now.year, x, 1).strftime("%Y-%m"), x - 1) for x in range(1, 13)]
        mac_installs = [(datetime(now.year, x, 1).strftime("%Y-%m"), 1) for x in range(1, 13)]
        total_installs = map(lambda x, y: (x[0], x[1] + y[1]), win_installs, mac_installs)
        total_updates = map(lambda x, y: (x[0], x[1] + y[1]), win_updates, mac_updates)
        self.users_statistics = dict(new=total_installs, updates=total_updates, uninstalls=uninstalls)
        self.win_users_statistics = dict(new=win_installs, updates=win_updates, uninstalls=uninstalls)
        self.mac_users_statistics = dict(new=mac_installs, updates=mac_updates)
예제 #8
0
 def setUp(self):
     redis.flushdb()
     self.app = Application.objects.create(id='{5FAD27D4-6BFA-4daa-A1B3-5A1F821FEE0F}', name='app')
     self.channel = Channel.objects.create(name='stable')
     self.platform = Platform.objects.create(name='win')
     self.version1 = Version.objects.create(
         app=self.app,
         platform=self.platform,
         channel=self.channel,
         version='1.0.0.0',
         file=SimpleUploadedFile('./chrome_installer.exe', False))
     self.version2 = Version.objects.create(
         app=self.app,
         platform=self.platform,
         channel=self.channel,
         version='2.0.0.0',
         file=SimpleUploadedFile('./chrome_installer.exe', False))
예제 #9
0
    def setUp(self):
        redis.flushdb()
        self.app = Application.objects.create(id='app', name='app')
        self.channel = Channel.objects.create(name='stable')
        self.platform = Platform.objects.create(name='win')
        Platform.objects.create(name='mac')
        self.version1 = Version.objects.create(
            app=self.app,
            platform=self.platform,
            channel=self.channel,
            version='1.0.0.0',
            file=SimpleUploadedFile('./chrome_installer.exe', False))
        self.version2 = Version.objects.create(
            app=self.app,
            platform=self.platform,
            channel=self.channel,
            version='2.0.0.0',
            file=SimpleUploadedFile('./chrome_installer.exe', False))
        self.mac_version = SparkleVersion.objects.create(
            app=self.app,
            channel=self.channel,
            version='782.112',
            short_version='13.0.782.112',
            dsa_signature='MCwCFCdoW13VBGJWIfIklKxQVyetgxE7AhQTVuY9uQT0KOV1UEk21epBsGZMPg==',
            file=SimpleUploadedFile('./chrome.dmg', b'_' * 23963192),
            file_size=23963192)

        app_kwargs = dict(appid=self.app.id, version=str(self.version1.version))
        install_app = create_app_xml(events=[fixtures.event_install_success], **app_kwargs)
        uninstall_app = create_app_xml(events=[fixtures.event_uninstall_success], **app_kwargs)
        self.install_app_list = [install_app]
        self.uninstall_app_list = [uninstall_app]
        self.mac_app = dict(appid=self.app.id, version=str(self.mac_version.short_version))

        self._generate_fake_statistics()
        now = datetime.now()
        win_updates = [(datetime(now.year, x, 1).strftime("%Y-%m"), x - 1) for x in range(1, 13)]
        win_installs = [(datetime(now.year, x, 1).strftime("%Y-%m"), 1) for x in range(1, 13)]
        uninstalls = [(datetime(now.year, x, 1).strftime("%Y-%m"), 1) for x in range(1, 13)]
        mac_updates = [(datetime(now.year, x, 1).strftime("%Y-%m"), x - 1) for x in range(1, 13)]
        mac_installs = [(datetime(now.year, x, 1).strftime("%Y-%m"), 1) for x in range(1, 13)]
        total_installs = map(lambda x, y: (x[0], x[1] + y[1]), win_installs, mac_installs)
        total_updates = map(lambda x, y: (x[0], x[1] + y[1]), win_updates, mac_updates)
        self.users_statistics = dict(new=total_installs, updates=total_updates, uninstalls=uninstalls)
        self.win_users_statistics = dict(new=win_installs, updates=win_updates, uninstalls=uninstalls)
        self.mac_users_statistics = dict(new=mac_installs, updates=mac_updates)
예제 #10
0
    def setUp(self):
        redis.flushdb()
        self.app = Application.objects.create(id='app', name='app')
        self.channel = Channel.objects.create(name='stable')
        self.platform = Platform.objects.create(name='win')
        self.version1 = Version.objects.create(
            app=self.app,
            platform=self.platform,
            channel=self.channel,
            version='1.0.0.0',
            file=SimpleUploadedFile('./chrome_installer.exe', False))
        self.version2 = Version.objects.create(
            app=self.app,
            platform=self.platform,
            channel=self.channel,
            version='2.0.0.0',
            file=SimpleUploadedFile('./chrome_installer.exe', False))
        self.mac_version = SparkleVersion.objects.create(
            app=self.app,
            channel=self.channel,
            version='782.112',
            short_version='13.0.782.112',
            dsa_signature='MCwCFCdoW13VBGJWIfIklKxQVyetgxE7AhQTVuY9uQT0KOV1UEk21epBsGZMPg==',
            file=SimpleUploadedFile('./chrome.dmg', b'_' * 23963192),
            file_size=23963192)
        self.app_list = [dict(appid=self.app.id, version=str(self.version1.version))]
        self.mac_app = dict(appid=self.app.id, version=str(self.mac_version.short_version))

        self._generate_fake_statistics()
        now = datetime.now()
        win_updates = [(datetime(now.year, x, 1).strftime("%Y-%m"), x - 1) for x in range(1, 13)]
        win_installs = [(datetime(now.year, x, 1).strftime("%Y-%m"), 1) for x in range(1, 13)]
        mac_updates = [(datetime(now.year, x, 1).strftime("%Y-%m"), x - 1) for x in range(1, 13)]
        mac_installs = [(datetime(now.year, x, 1).strftime("%Y-%m"), 1) for x in range(1, 13)]
        total_installs = map(lambda x, y: (x[0], x[1] + y[1]), win_installs, mac_installs)
        total_updates = map(lambda x, y: (x[0], x[1] + y[1]), win_updates, mac_updates)
        self.users_statistics = dict(new=total_installs, updates=total_updates)
        self.win_users_statistics = dict(new=win_installs, updates=win_updates)
        self.mac_users_statistics = dict(new=mac_installs, updates=mac_updates)
예제 #11
0
    def setUp(self):
        redis.flushdb()
        self.app = Application.objects.create(id='app', name='app')
        self.channel = Channel.objects.create(name='stable')
        self.platform = Platform.objects.create(name='win')
        self.version1 = Version.objects.create(
            app=self.app,
            platform=self.platform,
            channel=self.channel,
            version='1.0.0.0',
            file=SimpleUploadedFile('./chrome_installer.exe', False))
        self.version2 = Version.objects.create(
            app=self.app,
            platform=self.platform,
            channel=self.channel,
            version='2.0.0.0',
            file=SimpleUploadedFile('./chrome_installer.exe', False))
        self.app_list = [dict(appid=self.app.id, version=str(self.version1.version))]

        self._generate_fake_statistics()
        now = datetime.now()
        self.users_statistics = [(datetime(now.year, x, 1).strftime("%Y-%m"), x) for x in range(1, 13)]
예제 #12
0
    def setUp(self):
        self.user = User.objects.create_user(username='******',
                                             password='******',
                                             email='*****@*****.**')
        self.client.credentials(
            HTTP_AUTHORIZATION='Basic %s' % base64.b64encode(
                bytes('{}:{}'.format('test', 'secret'), 'utf8')).decode())

        redis.flushdb()
        self.app = Application.objects.create(id='app', name='app')
        self.channel = Channel.objects.create(name='stable')
        self.platform = Platform.objects.create(name='win')
        self.version1 = Version.objects.create(app=self.app,
                                               platform=self.platform,
                                               channel=self.channel,
                                               version='1.0.0.0',
                                               file=SimpleUploadedFile(
                                                   './chrome_installer.exe',
                                                   False))
        self.version2 = Version.objects.create(app=self.app,
                                               platform=self.platform,
                                               channel=self.channel,
                                               version='2.0.0.0',
                                               file=SimpleUploadedFile(
                                                   './chrome_installer.exe',
                                                   False))
        self.app_list = [
            dict(appid=self.app.id, version=str(self.version1.version))
        ]

        self._generate_fake_statistics()
        self.users_statistics = [('January', 1), ('February', 2), ('March', 3),
                                 ('April', 4), ('May', 5), ('June', 6),
                                 ('July', 7), ('August', 8), ('September', 9),
                                 ('October', 10), ('November', 11),
                                 ('December', 12)]
        self.data = dict(data=dict(self.users_statistics))
예제 #13
0
    def setUp(self):
        self.user = User.objects.create_user(username='******', password='******', email='*****@*****.**')
        self.client.credentials(
            HTTP_AUTHORIZATION='Basic %s' % base64.b64encode(bytes('{}:{}'.format('test', 'secret'), 'utf8')).decode())

        redis.flushdb()
        self.app = Application.objects.create(id='app', name='app')
        self.channel = Channel.objects.create(name='stable')
        self.platform = Platform.objects.create(name='win')
        self.version1 = Version.objects.create(
            app=self.app,
            platform=self.platform,
            channel=self.channel,
            version='1.0.0.0',
            file=SimpleUploadedFile('./chrome_installer.exe', False))
        self.version2 = Version.objects.create(
            app=self.app,
            platform=self.platform,
            channel=self.channel,
            version='2.0.0.0',
            file=SimpleUploadedFile('./chrome_installer.exe', False))
        self.app_list = [dict(appid=self.app.id, version=str(self.version1.version))]

        self._generate_fake_statistics()
        self.users_statistics = [('January', 1),
                                 ('February', 2),
                                 ('March', 3),
                                 ('April', 4),
                                 ('May', 5),
                                 ('June', 6),
                                 ('July', 7),
                                 ('August', 8),
                                 ('September', 9),
                                 ('October', 10),
                                 ('November', 11),
                                 ('December', 12)]
        self.data = dict(data=dict(self.users_statistics))
예제 #14
0
 def setUp(self):
     redis.flushdb()
예제 #15
0
 def setUp(self):
     self.client = Client()
     redis.flushdb()
예제 #16
0
 def tearDown(self):
     redis.flushdb()
예제 #17
0
 def setUp(self):
     redis.flushdb()
예제 #18
0
 def tearDown(self):
     redis.flushdb()
예제 #19
0
 def tearDown(self):
     redis.flushdb()
     super(UpdateViewTest, self).tearDown()
예제 #20
0
 def setUp(self):
     self.client = Client()
     redis.flushdb()
     super(UpdateViewTest, self).setUp()
예제 #21
0
 def tearDown(self):
     redis.flushdb()
     super(UpdateViewTest, self).tearDown()
예제 #22
0
 def setUp(self):
     self.client = Client()
     redis.flushdb()
     super(UpdateViewTest, self).setUp()
예제 #23
0
 def setUp(self):
     self.client = Client()
     redis.flushdb()