Ejemplo n.º 1
0
    def setUpClass(cls):
        super().setUpClass()
        cls.url = '/api/pickup-dates/'

        # pickup date for group with one member and one store
        cls.member = UserFactory()
        cls.group = GroupFactory(members=[
            cls.member,
        ])
        cls.store = StoreFactory(group=cls.group)
        cls.pickup = PickupDateFactory(store=cls.store)

        # and another store + group + pick-update
        cls.group2 = GroupFactory(members=[
            cls.member,
        ])
        cls.store2 = StoreFactory(group=cls.group2)
        cls.pickup2 = PickupDateFactory(store=cls.store2)

        # a pickup date series
        cls.series = PickupDateSeriesFactory(store=cls.store)
        cls.series.update_pickup_dates()

        # another pickup date series
        cls.series2 = PickupDateSeriesFactory(store=cls.store)
        cls.series2.update_pickup_dates()
Ejemplo n.º 2
0
 def setUpTestData(cls):
     cls.member = UserFactory()
     cls.group = GroupFactory(members=[cls.member, ])
     cls.store = StoreFactory(group=cls.group)
     cls.pickup = PickupDateFactory(store=cls.store)
     cls.pickup_url = '/api/pickup-dates/{}/'.format(cls.pickup.id)
     cls.series = PickupDateSeriesFactory(store=cls.store)
     cls.series_url = '/api/pickup-date-series/{}/'.format(cls.series.id)
 def setUpClass(cls):
     super().setUpClass()
     cls.now = timezone.now()
     cls.member = UserFactory()
     cls.group = GroupFactory(members=[cls.member, ])
     cls.store = StoreFactory(group=cls.group)
     cls.series = PickupDateSeriesFactory(max_collectors=3, store=cls.store)
     cls.series.update_pickup_dates(start=lambda: cls.now)
Ejemplo n.º 4
0
    def test_delete_stores_as_group_member(self):
        PickupDateSeriesFactory(store=self.store)
        PickupDateFactory(store=self.store)

        self.client.force_login(user=self.member)
        response = self.client.delete(self.store_url)
        self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
        response = self.client.get(self.url)
        self.assertEqual(len(response.data), 0)

        # should also delete pickup dates & series
        response = self.client.get('/api/pickup-dates/')
        self.assertEqual(len(response.data), 0)
        response = self.client.get('/api/pickup-date-series/')
        self.assertEqual(len(response.data), 0)
Ejemplo n.º 5
0
 def setUpClass(cls):
     super().setUpClass()
     cls.url = '/api/pickup-date-series/'
     cls.series = PickupDateSeriesFactory()
     cls.series_url = '/api/pickup-date-series/{}/'.format(cls.series.id)
     cls.non_member = UserFactory()
 def setUpClass(cls):
     super().setUpClass()
     cls.series = PickupDateSeriesFactory()