Fix tests following content move
This commit is contained in:
parent
2ff551147c
commit
1792c7ed8b
1 changed files with 6 additions and 7 deletions
|
@ -3,7 +3,7 @@ import datetime
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
import pytest
|
import pytest
|
||||||
from pytest_django.asserts import assertContains, assertTemplateUsed
|
from pytest_django.asserts import assertContains
|
||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
from conservancy.fundgoal.models import FundraisingGoal
|
from conservancy.fundgoal.models import FundraisingGoal
|
||||||
|
@ -24,20 +24,19 @@ def create_fundraising_goal():
|
||||||
def test_about_page_served(rf):
|
def test_about_page_served(rf):
|
||||||
create_fundraising_goal()
|
create_fundraising_goal()
|
||||||
request = rf.get('/about/')
|
request = rf.get('/about/')
|
||||||
with assertTemplateUsed('about/index.html'):
|
response = views.content(request)
|
||||||
response = views.index(request).render()
|
|
||||||
assertContains(response, 'Conservancy is a nonprofit organization')
|
assertContains(response, 'Conservancy is a nonprofit organization')
|
||||||
|
|
||||||
|
|
||||||
def test_annual_report_file_served(rf):
|
def test_annual_report_file_served(rf):
|
||||||
request = rf.get('/docs/conservancy_annual-report_fy-2011.pdf')
|
request = rf.get('/projects/apply/ConservancyFSATemplate.pdf')
|
||||||
response = views.index(request)
|
response = views.content(request)
|
||||||
assert response.headers['Content-Type'] == 'application/pdf'
|
assert response.headers['Content-Type'] == 'application/pdf'
|
||||||
|
|
||||||
|
|
||||||
def test_path_traversal_404s(rf):
|
def test_path_traversal_404s(rf):
|
||||||
# Will work in development only
|
# Will work in development only
|
||||||
assert (settings.BASE_DIR / 'static' / 'about/../../../conservancy-website.sqlite3').exists()
|
assert (settings.BASE_DIR / 'content' / 'about/../../../conservancy-website.sqlite3').exists()
|
||||||
request = rf.get('/about/../../../conservancy-website.sqlite3')
|
request = rf.get('/about/../../../conservancy-website.sqlite3')
|
||||||
with pytest.raises(Http404):
|
with pytest.raises(Http404):
|
||||||
views.index(request)
|
views.content(request)
|
||||||
|
|
Loading…
Reference in a new issue