本文整理匯總了Python中omaha.factories.ChannelFactory類的典型用法代碼示例。如果您正苦於以下問題:Python ChannelFactory類的具體用法?Python ChannelFactory怎麽用?Python ChannelFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ChannelFactory類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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)
示例2: 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)
示例3: test_sparkle_critical
def test_sparkle_critical(self):
app = ApplicationFactory.create(id='{D0AB2EBC-931B-4013-9FEB-C9C4C2225C8C}', name='chrome')
channel = ChannelFactory.create(name='stable')
first_version = SparkleVersionFactory.create(
app=app,
channel=channel,
version='782.110',
short_version='13.0.782.110',
file=SimpleUploadedFile('./chrome1.dmg', b'_' * 23963192),
file_size=23963192)
first_version.save()
first_crit_version = SparkleVersionFactory.create(
app=app,
channel=channel,
version='782.111',
short_version='13.0.782.111',
is_critical=True,
file=SimpleUploadedFile('./chrome2.dmg', b'_' * 23963192),
file_size=23963192)
first_crit_version.save()
last_version = SparkleVersionFactory.create(
app=app,
channel=channel,
version='782.112',
short_version='13.0.782.112',
file=SimpleUploadedFile('./chrome3.dmg', b'_' * 23963192),
file_size=23963192)
last_version.save()
second_crit_version = SparkleVersionFactory.create(
app=app,
channel=channel,
version='782.113',
short_version='13.0.782.113',
is_critical=True,
file=SimpleUploadedFile('./chrome4.dmg', b'_' * 23963192),
file_size=23963192)
second_crit_version.save()
response = self.client.get("%s?appVersionShort=13.0.782.110" % reverse('sparkle_appcast', args=(app.name, channel.name)),
HTTP_HOST='example.com')
self.assertEqual(response.status_code, 200)
self.assertXmlDocument(response.content)
self.assertXmlEquivalentOutputs(response.content,
fixtures.first_crit_response_sparkle)
response = self.client.get("%s?appVersionShort=13.0.782.111" % reverse('sparkle_appcast', args=(app.name, channel.name)),
HTTP_HOST='example.com')
self.assertEqual(response.status_code, 200)
self.assertXmlDocument(response.content)
self.assertXmlEquivalentOutputs(response.content,
fixtures.second_crit_response_sparkle)
示例4: 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)
示例5: test_create
def test_create(self):
data = dict(
app=ApplicationFactory.create().id,
channel=ChannelFactory.create().id,
version='1.2.3.4',
file=SimpleUploadedFile("chrome.exe", b'content'),
)
response = self.client.post(self.url, data)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
version = SparkleVersion.objects.get(id=response.data['id'])
self.assertEqual(response.data, self.serializer(version).data)
self.assertEqual(version.file_size, len(b'content'))
示例6: test_update
def test_update(self):
data = dict(
app=ApplicationFactory.create().id,
channel=ChannelFactory.create().id,
version='3.4',
file=SimpleUploadedFile("chrome.exe", b'content'),
)
response = self.client.post(reverse(self.url), data)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
obj_id = response.data['id']
version = SparkleVersion.objects.get(id=obj_id)
self.assertEqual(version.version, '3.4')
url = reverse(self.url_detail, kwargs=dict(pk=obj_id))
response = self.client.patch(url, dict(version='3.5'))
self.assertEqual(response.status_code, status.HTTP_200_OK)
version = SparkleVersion.objects.get(id=obj_id)
self.assertEqual(version.version, '3.5')
示例7: 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)
示例8: test_sparkle
def test_sparkle(self):
app = ApplicationFactory.create(id='{D0AB2EBC-931B-4013-9FEB-C9C4C2225C8C}', name='chrome')
channel = ChannelFactory.create(name='stable')
obj = SparkleVersionFactory.create(
app=app,
channel=channel,
version='782.112',
short_version='13.0.782.112',
file=SimpleUploadedFile('./chrome.dmg', b'_' * 23963192),
file_size=23963192)
obj.save()
response = self.client.get(reverse('sparkle_appcast', args=(app.name, channel.name)),
HTTP_HOST='example.com')
self.assertEqual(response.status_code, 200)
self.assertXmlDocument(response.content)
self.assertXmlEquivalentOutputs(response.content,
fixtures.response_sparkle)
示例9: test_sparkle_with_dsa_signature
def test_sparkle_with_dsa_signature(self):
app = ApplicationFactory.create(id='{D0AB2EBC-931B-4013-9FEB-C9C4C2225C9C}', name='chrome_dsa')
channel = ChannelFactory.create(name='stable')
obj = SparkleVersionFactory.create(
app=app,
channel=channel,
version='782.112',
short_version='13.0.782.112',
dsa_signature='MCwCFCdoW13VBGJWIfIklKxQVyetgxE7AhQTVuY9uQT0KOV1UEk21epBsGZMPg==',
file=SimpleUploadedFile('./chrome.dmg', b'_' * 23963192),
file_size=23963192)
obj.save()
response = self.client.get(reverse('sparkle_appcast', args=(app.name, channel.name)),
HTTP_HOST='example.com')
self.assertEqual(response.status_code, 200)
self.assertXmlDocument(response.content)
self.assertXmlEquivalentOutputs(fixtures.response_sparkle_with_dsa,
response.content)
示例10: test_factory
def test_factory(self):
channel = ChannelFactory.create()
self.assertTrue(Channel.objects.get(id=channel.id))