本文整理汇总了Python中omaha.factories.VersionFactory.create方法的典型用法代码示例。如果您正苦于以下问题:Python VersionFactory.create方法的具体用法?Python VersionFactory.create怎么用?Python VersionFactory.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类omaha.factories.VersionFactory
的用法示例。
在下文中一共展示了VersionFactory.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_updatecheck_positive_critical_on_other_channel
# 需要导入模块: from omaha.factories import VersionFactory [as 别名]
# 或者: from omaha.factories.VersionFactory import create [as 别名]
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_monitoring
# 需要导入模块: from omaha.factories import VersionFactory [as 别名]
# 或者: from omaha.factories.VersionFactory import create [as 别名]
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)
示例3: test_filter_by_enabled
# 需要导入模块: from omaha.factories import VersionFactory [as 别名]
# 或者: from omaha.factories.VersionFactory import create [as 别名]
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())
示例4: test_get_attributes
# 需要导入模块: from omaha.factories import VersionFactory [as 别名]
# 或者: from omaha.factories.VersionFactory import create [as 别名]
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',
)
)
示例5: test_get_version_partial_update
# 需要导入模块: from omaha.factories import VersionFactory [as 别名]
# 或者: from omaha.factories.VersionFactory import create [as 别名]
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))
示例6: test_data
# 需要导入模块: from omaha.factories import VersionFactory [as 别名]
# 或者: from omaha.factories.VersionFactory import create [as 别名]
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)
示例7: test_property
# 需要导入模块: from omaha.factories import VersionFactory [as 别名]
# 或者: from omaha.factories.VersionFactory import create [as 别名]
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/')
示例8: test_create
# 需要导入模块: from omaha.factories import VersionFactory [as 别名]
# 或者: from omaha.factories.VersionFactory import create [as 别名]
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)
示例9: test_property_default_storage
# 需要导入模块: from omaha.factories import VersionFactory [as 别名]
# 或者: from omaha.factories.VersionFactory import create [as 别名]
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)
示例10: test_version_upload_to
# 需要导入模块: from omaha.factories import VersionFactory [as 别名]
# 或者: from omaha.factories.VersionFactory import create [as 别名]
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,
))
示例11: test_updatecheck_positive_critical
# 需要导入模块: from omaha.factories import VersionFactory [as 别名]
# 或者: from omaha.factories.VersionFactory import create [as 别名]
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)
示例12: test_userid_counting
# 需要导入模块: from omaha.factories import VersionFactory [as 别名]
# 或者: from omaha.factories.VersionFactory import create [as 别名]
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)
示例13: test_create
# 需要导入模块: from omaha.factories import VersionFactory [as 别名]
# 或者: from omaha.factories.VersionFactory import create [as 别名]
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)
示例14: test_get_version
# 需要导入模块: from omaha.factories import VersionFactory [as 别名]
# 或者: from omaha.factories.VersionFactory import create [as 别名]
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))
示例15: test_serializer
# 需要导入模块: from omaha.factories import VersionFactory [as 别名]
# 或者: from omaha.factories.VersionFactory import create [as 别名]
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'),
))