return q1
@pytest.mark.django_db
- def test_massimport_1(self, q1, c):
+ def test_massimport_1(self, q1, c_adm):
allquotes = """\
Ich bin ein Berliner
---
tag1, tag555
==="""
- results = c.postPage('massimport/', {'quotes': allquotes})
+ results = c_adm.postPage('massimport/', {'quotes': allquotes})
assert "rejected" not in results
assert hamlet.author == Author.objects.get(name="William Shakespeare")
for quote in Quote.objects.all():
- assert c.getPage(quote.get_absolute_url())
+ assert c_adm.getPage(quote.get_absolute_url())
@pytest.mark.django_db
- def test_massimport_2(self, q1, c):
+ def test_massimport_2(self, q1, c_adm):
allquotes = """\
<script>somethingevil()</script>
A rose by any other name...
tag1, tag555
==="""
- results = c.postPage('massimport/', {'quotes': allquotes})
+ results = c_adm.postPage('massimport/', {'quotes': allquotes})
assert "<script>" not in results
with pytest.raises(Quote.DoesNotExist):
Quote.objects.get(text__contains="<script>")
@pytest.mark.django_db
- def test_massimport_3(self, c):
+ def test_massimport_3(self, c_adm):
"""Whitespace and stuff"""
allquotes = """\
A rose by any other name...
"""
- results = c.postPage('massimport/', {'quotes': allquotes})
+ results = c_adm.postPage('massimport/', {'quotes': allquotes})
assert "rejected" not in results
assert Quote.objects.get(text="<p>A rose by any other name...</p>")
assert Author.objects.get(name="William Shakespeare")
assert tirade.work.author.name == "William Shakespeare"
assert Author.objects.filter(name__contains="Shakespeare").count() == 1
+ def test_massimport_noaccess(self, c):
+ c.getPage('massimport/', exp_status=302)
+ c.postPage('massimport/', {}, exp_status=302)