Skip to content

Commit

Permalink
Fix usage of the new create_pet method; add docstrings to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dirtycoder committed Nov 6, 2016
1 parent 952d518 commit 4c9221c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pets/meupet/tests/test_pet_detail_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,24 @@ class PetDetailViewTest(MeuPetTestCase):
def setUp(self):
super(PetDetailViewTest, self).setUp()

self.pet = self.create_pet('Pet')
self.pet = self.create_pet()

def test_get_pet_by_pk(self):
"""Show detail page using an id as a value to the 'pk_or_slug' argument"""
resp = self.client.get(reverse('meupet:detail', kwargs={'pk_or_slug': self.pet.id}))

self.assertEqual(200, resp.status_code)
self.assertContains(resp, 'Testing Pet')
self.assertContains(resp, self.pet.name)

def test_get_pet_by_slug(self):
"""Show detail page using a slug as a value to the 'pk_or_slug' argument"""
resp = self.client.get(reverse('meupet:detail', kwargs={'pk_or_slug': self.pet.slug}))

self.assertEqual(200, resp.status_code)
self.assertContains(resp, 'Testing Pet')
self.assertContains(resp, self.pet.slug)

def test_show_more_photos_in_pet_detail(self):
"""Show the 'More Photos' section if more photos are added"""
photo = Photo(image=self.get_test_image_file())
self.pet.photo_set.add(photo)
self.pet.save()
Expand Down

0 comments on commit 4c9221c

Please sign in to comment.