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))
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))
def test_get_app_version_active_users(self): userid = "{%s}" % UUID(int=1) userid_beta = "{%s}" % UUID(int=40) userid_beta_not_active = "{%s}" % UUID(int=60) 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', ) id = get_id(userid_beta) mark_event('request', id) PartialUpdate.objects.create(version=version_beta, percent=5, start_date=datetime.now(), end_date=datetime.now()) 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)) self.assertEqual(version, get_version(version.app.pk, version.platform.name, version.channel.name, '36.0.2062.124', userid_beta_not_active))
def test_get_app_version_channel(self): userid = '{D0BBD725-742D-44ae-8D46-0231E881D58E}' channel_beta = Channel.objects.create(name="beta") 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=channel_beta, version='39.0.0.0', ) self.assertEqual(version_beta, get_version(version.app.pk, version.platform.name, channel_beta.name, '', userid))