Skip to content
This repository has been archived by the owner on Nov 7, 2018. It is now read-only.

Commit

Permalink
add test to ensure we're testing the proper branching of landings
Browse files Browse the repository at this point in the history
  • Loading branch information
konklone committed Nov 17, 2014
1 parent db4b231 commit 9cd79e7
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions foia_hub/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def setUp(self):
self.office2.save()

self.agency2 = Agency(name='Agency Without Offices', zip_code=20009, emails=self.emails)
self.agency2.save()

self.requester = Requester.objects.create(
first_name='Alice', last_name='Bobson', email='eve@example.com')
Expand Down Expand Up @@ -163,18 +164,30 @@ def test_contact_landing_404(self):
def test_contact_landing_success(self):
"""If loading an agency or a top-level office, we should see agency
name. If an office, we should not see peer offices."""

list_fingerprint = "Make your FOIA request directly to the most relevant group or component"

response = self.client.get(reverse(
'contact_landing', kwargs={'slug': self.agency.slug}))
self.assertContains(response, self.agency.name)
self.assertContains(response, self.office.name)
self.assertContains(response, self.office2.name)
self.assertContains(response, list_fingerprint)

slug = self.office.slug
response = self.client.get(reverse(
'contact_landing', kwargs={'slug': slug}))
'contact_landing', kwargs={'slug': self.office.slug}))
self.assertContains(response, self.agency.name)
self.assertContains(response, self.office.name)
self.assertNotContains(response, self.office2.name)
self.assertNotContains(response, list_fingerprint)

response = self.client.get(reverse(
'contact_landing', kwargs={'slug': self.agency2.slug}))
self.assertContains(response, self.agency2.name)
self.assertNotContains(response, self.office.name)
self.assertNotContains(response, self.office2.name)
self.assertNotContains(response, list_fingerprint)


def test_learn(self):
"""The /learn/ page should load without errors."""
Expand Down

0 comments on commit 9cd79e7

Please sign in to comment.