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.http import Http404
|
||||
import pytest
|
||||
from pytest_django.asserts import assertContains, assertTemplateUsed
|
||||
from pytest_django.asserts import assertContains
|
||||
|
||||
from . import views
|
||||
from conservancy.fundgoal.models import FundraisingGoal
|
||||
|
@ -24,20 +24,19 @@ def create_fundraising_goal():
|
|||
def test_about_page_served(rf):
|
||||
create_fundraising_goal()
|
||||
request = rf.get('/about/')
|
||||
with assertTemplateUsed('about/index.html'):
|
||||
response = views.index(request).render()
|
||||
response = views.content(request)
|
||||
assertContains(response, 'Conservancy is a nonprofit organization')
|
||||
|
||||
|
||||
def test_annual_report_file_served(rf):
|
||||
request = rf.get('/docs/conservancy_annual-report_fy-2011.pdf')
|
||||
response = views.index(request)
|
||||
request = rf.get('/projects/apply/ConservancyFSATemplate.pdf')
|
||||
response = views.content(request)
|
||||
assert response.headers['Content-Type'] == 'application/pdf'
|
||||
|
||||
|
||||
def test_path_traversal_404s(rf):
|
||||
# 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')
|
||||
with pytest.raises(Http404):
|
||||
views.index(request)
|
||||
views.content(request)
|
||||
|
|
Loading…
Reference in a new issue