Ejemplo n.º 1
0
 def setUp(self):
     self.num_of_mocks_to_create = 5
     self.mock_user = UserFactory()
     self.mock_homes = SpaceFactory.create_batch(self.num_of_mocks_to_create,
                                                 user=self.mock_user)
     self.mock_holiday_homes = SpaceFactory.create_batch(self.num_of_mocks_to_create,
                                                         user=self.mock_user,
                                                         type='holidayHome')
     self.url = reverse('spaces-list')
Ejemplo n.º 2
0
    def test_should_only_return_my_spaces(self):
        mock_other_user = UserFactory()
        mock_other_spaces = SpaceFactory.create_batch(self.num_of_mocks_to_create,
                                                      user= mock_other_user)

        response = self.client.get(self.url)

        for space in response.data:
            self.assertEqual(space['user'], self.mock_user.id)