本文整理汇总了Python中mkt.developers.views.preload_submit函数的典型用法代码示例。如果您正苦于以下问题:Python preload_submit函数的具体用法?Python preload_submit怎么用?Python preload_submit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了preload_submit函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_submit_xls
def test_submit_xls(self, noop, save_mock):
f = open(self.test_xls, 'r')
req = req_factory_factory(self.submit_url, user=self.user, post=True,
data={'agree': True, 'test_plan': f})
r = preload_submit(req, self.webapp.app_slug)
self.assert3xx(r, self.url)
self._assert_submit('xls', 'application/vnd.ms-excel', save_mock)
示例2: test_submit_multiple_status
def test_submit_multiple_status(self, noop, save_mock):
f = open(self.test_xls, "r")
req = req_factory_factory(self.submit_url, user=self.user, post=True, data={"test_plan": f, "agree": True})
preload_submit(req, self.webapp.slug)
self._submit_pdf()
eq_(PreloadTestPlan.objects.count(), 2)
xls = PreloadTestPlan.objects.get(filename__contains="xls")
pdf = PreloadTestPlan.objects.get(filename__contains="pdf")
eq_(xls.status, amo.STATUS_DISABLED)
eq_(pdf.status, amo.STATUS_PUBLIC)
# Check the link points to most recent one.
req = req_factory_factory(self.url, user=self.user)
r = status(req, self.webapp.slug)
doc = pq(r.content)
eq_(doc(".test-plan-download").attr("href"), pdf.preload_test_plan_url)
示例3: test_submit_no_file
def test_submit_no_file(self, noop, save_mock):
req = req_factory_factory(self.submit_url, user=self.user, post=True, data={"agree": True})
r = preload_submit(req, self.webapp.slug)
eq_(r.status_code, 200)
eq_(PreloadTestPlan.objects.count(), 0)
assert not save_mock.called
assert "required" in pq(r.content)(".test_plan .errorlist").text()
示例4: test_submit_bad_file
def test_submit_bad_file(self, noop, save_mock):
f = open(os.path.abspath(__file__), "r")
req = req_factory_factory(self.submit_url, user=self.user, post=True, data={"agree": True, "test_plan": f})
r = preload_submit(req, self.webapp.slug)
eq_(r.status_code, 200)
eq_(PreloadTestPlan.objects.count(), 0)
assert not save_mock.called
assert "Invalid file type." in pq(r.content)(".test_plan .errorlist").text()
示例5: test_submit_no_agree
def test_submit_no_agree(self, noop, save_mock):
f = open(self.test_xls, 'r')
req = req_factory_factory(self.submit_url, user=self.user, post=True,
data={'test_plan': f})
r = preload_submit(req, self.webapp.app_slug)
eq_(r.status_code, 200)
eq_(PreloadTestPlan.objects.count(), 0)
assert not save_mock.called
assert 'required' in pq(r.content)('.agree .errorlist').text()
示例6: test_submit_multiple_status
def test_submit_multiple_status(self, noop, save_mock):
f = open(self.test_xls, 'r')
req = req_factory_factory(self.submit_url, user=self.user, post=True,
data={'test_plan': f, 'agree': True})
preload_submit(req, self.webapp.app_slug)
self._submit_pdf()
eq_(PreloadTestPlan.objects.count(), 2)
xls = PreloadTestPlan.objects.get(filename__contains='xls')
pdf = PreloadTestPlan.objects.get(filename__contains='pdf')
eq_(xls.status, mkt.STATUS_DISABLED)
eq_(pdf.status, mkt.STATUS_PUBLIC)
# Check the link points to most recent one.
req = req_factory_factory(self.url, user=self.user)
r = status(req, self.webapp.app_slug)
doc = pq(r.content)
eq_(doc('.test-plan-download').attr('href').split('?')[0],
pdf.preload_test_plan_url.split('?')[0])
示例7: test_submit_bad_file
def test_submit_bad_file(self, noop, save_mock):
f = open(os.path.abspath(__file__), 'r')
req = req_factory_factory(self.submit_url, user=self.user, post=True,
data={'agree': True, 'test_plan': f})
r = preload_submit(req, self.webapp.app_slug)
eq_(r.status_code, 200)
eq_(PreloadTestPlan.objects.count(), 0)
assert not save_mock.called
assert ('Invalid file type' in
pq(r.content)('.test_plan .errorlist').text())
示例8: _submit_pdf
def _submit_pdf(self):
f = open(self.test_pdf, 'r')
req = req_factory_factory(self.submit_url, user=self.user, post=True,
data={'agree': True, 'test_plan': f})
return preload_submit(req, self.webapp.app_slug)
示例9: test_submit_xls
def test_submit_xls(self, noop, save_mock):
f = open(self.test_xls, "r")
req = req_factory_factory(self.submit_url, user=self.user, post=True, data={"agree": True, "test_plan": f})
r = preload_submit(req, self.webapp.slug)
self.assert3xx(r, self.url)
self._assert_submit("xls", "application/vnd.ms-excel", save_mock)
示例10: _submit_pdf
def _submit_pdf(self):
f = open(self.test_pdf, "r")
req = req_factory_factory(self.submit_url, user=self.user, post=True, data={"agree": True, "test_plan": f})
return preload_submit(req, self.webapp.slug)