本文整理汇总了Python中mkt.developers.tasks.fetch_icon函数的典型用法代码示例。如果您正苦于以下问题:Python fetch_icon函数的具体用法?Python fetch_icon怎么用?Python fetch_icon使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fetch_icon函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_data_uri
def test_data_uri(self):
app_path = os.path.join(self.apps_path, 'dataicon.webapp')
webapp = self.webapp_from_path(app_path)
tasks.fetch_icon(webapp)
eq_(webapp.icon_type, self.content_type)
self.check_icons(webapp)
开发者ID:rtnpro,项目名称:zamboni,代码行数:8,代码来源:test_tasks.py
示例2: test_cdn_icon
def test_cdn_icon(self, save, fetch, json):
response = mock.Mock()
response.read.return_value = ''
webapp = app_factory()
url = 'http://foo.com/bar'
json.return_value = {'icons': {'128': url}}
tasks.fetch_icon(webapp.pk, webapp.latest_version.all_files[0].pk)
assert url in fetch.call_args[0][0]
开发者ID:Jobava,项目名称:zamboni,代码行数:8,代码来源:test_tasks.py
示例3: test_cdn_icon
def test_cdn_icon(self, save, fetch):
response = mock.Mock()
response.read.return_value = ''
webapp = mock.Mock()
url = 'http://foo.com/bar'
webapp.get_manifest_json.return_value = {'icons': {'128': url}}
tasks.fetch_icon(webapp)
assert url in fetch.call_args[0][0]
开发者ID:ominds,项目名称:zamboni,代码行数:8,代码来源:test_tasks.py
示例4: test_data_uri
def test_data_uri(self):
app_path = os.path.join(self.apps_path, 'dataicon.webapp')
webapp = self.webapp_from_path(app_path)
file_obj = webapp.latest_version.all_files[0]
tasks.fetch_icon(webapp, file_obj)
eq_(webapp.icon_type, self.content_type)
self.check_icons(webapp, file_obj)
开发者ID:j-barron,项目名称:zamboni,代码行数:9,代码来源:test_tasks.py
示例5: test_cdn_icon
def test_cdn_icon(self, save, fetch):
response = mock.Mock()
response.read.return_value = ""
webapp = mock.Mock()
webapp.is_packaged = False
url = "http://foo.com/bar"
webapp.get_manifest_json.return_value = {"icons": {"128": url}}
tasks.fetch_icon(webapp)
assert url in fetch.call_args[0][0]
开发者ID:nearlyfreeapps,项目名称:zamboni,代码行数:9,代码来源:test_tasks.py
示例6: test_packaged_icon
def test_packaged_icon(self, save, zip):
response = mock.Mock()
response.read.return_value = ''
zf = mock.Mock()
zip.return_value = zf
webapp = mock.Mock()
webapp.is_packaged = True
url = '/path/to/icon.png'
webapp.get_manifest_json.return_value = {'icons': {'128': url}}
tasks.fetch_icon(webapp)
assert url[1:] in zf.extract_path.call_args[0][0]
开发者ID:rtnpro,项目名称:zamboni,代码行数:11,代码来源:test_tasks.py
示例7: test_cdn_icon
def test_cdn_icon(self, save, fetch):
response = mock.Mock()
response.read.return_value = ''
webapp = mock.Mock()
webapp.is_packaged = False
url = 'http://foo.com/bar'
webapp.get_manifest_json.return_value = {'icons': {'128': url}}
# Pass anything here for the `file_obj` argument to avoid it trying to
# get the `current_version`.
tasks.fetch_icon(webapp, mock.Mock())
assert url in fetch.call_args[0][0]
开发者ID:j-barron,项目名称:zamboni,代码行数:11,代码来源:test_tasks.py
示例8: test_packaged_icon
def test_packaged_icon(self, save, zip, json):
response = mock.Mock()
response.read.return_value = ''
zf = mock.Mock()
zip.return_value = zf
webapp = app_factory(is_packaged=True)
file_obj = webapp.latest_version.all_files[0]
url = '/path/to/icon.png'
json.return_value = {'icons': {'128': url}}
tasks.fetch_icon(webapp.pk, file_obj.pk)
assert url[1:] in zf.extract_path.call_args[0][0]
开发者ID:kumar303,项目名称:zamboni,代码行数:11,代码来源:test_tasks.py
示例9: _fix_missing_icons
def _fix_missing_icons(id):
try:
webapp = Webapp.objects.get(pk=id)
except Webapp.DoesNotExist:
_log(id, u'Webapp does not exist')
return
# Check for missing icons. If we find one important size missing, call
# fetch_icon for this app.
dirname = webapp.get_icon_dir()
destination = os.path.join(dirname, '%s' % webapp.id)
for size in (64, 128):
filename = '%s-%s.png' % (destination, size)
if not storage.exists(filename):
_log(id, u'Webapp is missing icon size %d' % (size, ))
return fetch_icon(webapp)
开发者ID:chrisdavidmills,项目名称:zamboni,代码行数:16,代码来源:tasks.py
示例10: test_bad_icons
def test_bad_icons(self):
path = os.path.join(self.apps_path, 'badicon.webapp')
iconless_app = self.webapp_from_path(path)
tasks.fetch_icon(iconless_app)
assert not self.urlopen_mock.called
开发者ID:rtnpro,项目名称:zamboni,代码行数:5,代码来源:test_tasks.py
示例11: test_no_version
def test_no_version(self):
app = Webapp()
eq_(tasks.fetch_icon(app), None)
开发者ID:rtnpro,项目名称:zamboni,代码行数:3,代码来源:test_tasks.py
示例12: test_bad_icons
def test_bad_icons(self):
path = os.path.join(self.apps_path, 'badicon.webapp')
iconless_app = self.webapp_from_path(path)
tasks.fetch_icon(iconless_app,
iconless_app.latest_version.all_files[0])
assert not self.requests_mock.called
开发者ID:j-barron,项目名称:zamboni,代码行数:6,代码来源:test_tasks.py
示例13: test_no_icons
def test_no_icons(self):
path = os.path.join(self.apps_path, 'noicon.webapp')
iconless_app = self.webapp_from_path(path)
tasks.fetch_icon(iconless_app)
assert not self.requests_mock.called
开发者ID:hardikj,项目名称:zamboni,代码行数:5,代码来源:test_tasks.py
示例14: test_no_version
def test_no_version(self):
app = app_factory()
eq_(tasks.fetch_icon(app.pk), None)
开发者ID:Jobava,项目名称:zamboni,代码行数:3,代码来源:test_tasks.py
注:本文中的mkt.developers.tasks.fetch_icon函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论