Esempio n. 1
0
    def test_sitemap_status(self):
        shelter = ShelterFactory()
        dog = DogFactory()
        response = self.client.get('/sitemap.xml/')

        self.assertContains(response, shelter.get_absolute_url())
        self.assertContains(response, dog.get_absolute_url())
Esempio n. 2
0
    def setUp(self):
        self.request_factory = RequestFactory()

        self.user_with_no_associated_shelters = UserFactory()
        self.user_associated_to_shelter1 = UserFactory()

        self.shelter1 = ShelterFactory.create(
            authenticated_users=[self.user_associated_to_shelter1])
        self.shelter2 = ShelterFactory.create()
Esempio n. 3
0
    def test_all_shelters_list_view(self):
        shelter1 = ShelterFactory()
        shelter2 = ShelterFactory()
        shelter_disabled = ShelterFactory(is_published=False)

        response = self.client.get('/globos-organizacijos/')
        self.assertContains(response, shelter1.get_absolute_url())
        self.assertContains(response, shelter2.get_absolute_url())
        self.assertNotContains(response, shelter_disabled.get_absolute_url())
Esempio n. 4
0
    def test_cat_profile(self):
        shelter = ShelterFactory()
        pet1 = CatFactory(shelter=shelter)

        response = self.client.get(f'/kates/{pet1.pk}-{pet1.slug}/')

        self.assertContains(response, shelter.name)
        self.assertContains(response, pet1.name)
Esempio n. 5
0
    def test_dogs_list_view_with_associated_shelters(self):
        user_associated_to_shelter1 = UserFactory(groups=[self.shelterGroup])

        shelter1 = ShelterFactory(
            authenticated_users=[user_associated_to_shelter1])
        shelter2 = ShelterFactory()

        shelter1pet1 = DogFactory(shelter=shelter1)
        shelter1pet2 = DogFactory(shelter=shelter1)
        shelter2pet1 = DogFactory(shelter=shelter2)

        self.client.force_login(user_associated_to_shelter1)

        response = self.client.get('/admin/dogs/')

        self.assertContains(response, shelter1pet1.edit_pet_url())
        self.assertContains(response, shelter1pet2.edit_pet_url())
        self.assertNotContains(response, shelter2pet1.edit_pet_url())
Esempio n. 6
0
    def test_shelter_pets_list(self):
        shelter = ShelterFactory()
        dog = DogFactory(shelter=shelter)
        cat = CatFactory(shelter=shelter)
        dog_disabled = DogFactory(shelter=shelter,
                                  status=PetStatus.TAKEN_NOT_VIA_GETPET)
        cat_disabled = CatFactory(shelter=shelter,
                                  status=PetStatus.TAKEN_NOT_VIA_GETPET)

        response = self.client.get(f'/globos-organizacijos/{shelter.slug}/')

        self.assertContains(response, shelter.name)
        self.assertContains(response, dog.get_absolute_url())
        self.assertContains(response, cat.get_absolute_url())
        self.assertNotContains(response, dog_disabled.get_absolute_url())
        self.assertNotContains(response, cat_disabled.get_absolute_url())
Esempio n. 7
0
    def test_shelter_pets_list_view_empty(self):
        shelter = ShelterFactory()
        response = self.client.get(f'/globos-organizacijos/{shelter.slug}/')

        self.assertEqual(response.status_code, 200)
Esempio n. 8
0
 def setUp(self):
     self.shelter1 = ShelterFactory()
     self.shelter2 = ShelterFactory(is_published=False)