Ejemplo n.º 1
0
    def test_product_round_override(self):
        round1 = self.round
        round2 = OrderRoundFactory()
        products1 = ProductFactory.create_batch(50, order_round=round1)
        products2 = ProductFactory.create_batch(50, order_round=round2)

        ret = self.client.get(self.url)
        self.assertItemsEqual(ret.context['object_list'], products1)

        ret = self.client.get(self.url + "?round=%d" % round2.id)
        self.assertItemsEqual(ret.context['object_list'], products2)
Ejemplo n.º 2
0
    def test_product_round_override(self):
        round1 = self.round
        round2 = OrderRoundFactory()
        products1 = ProductFactory.create_batch(50, order_round=round1)
        products2 = ProductFactory.create_batch(50, order_round=round2)

        ret = self.client.get(self.url)
        self.assertCountEqual(ret.context['object_list'], products1)

        ret = self.client.get(self.url + "?round=%d" % round2.id)
        self.assertCountEqual(ret.context['object_list'], products2)
Ejemplo n.º 3
0
 def test_context_contains_products_ordered_by_name(self):
     ProductFactory.create_batch(50, order_round=self.round)
     ret = self.client.get(self.url)
     self.assertItemsEqual(ret.context['view'].products(), Product.objects.all().order_by('name'))
Ejemplo n.º 4
0
 def test_context_contains_products_ordered_by_name(self):
     ProductFactory.create_batch(50, order_round=self.round)
     ret = self.client.get(self.url)
     self.assertCountEqual(ret.context['view'].products(),
                           Product.objects.all().order_by('name'))