def test_require_change_permission_fails(self): product = Product(name="Bad Beer") product.save() self.client.login(username="******", password="******") response = self.client.post( "/products/{}".format(product.id), { "name": "Awesome Beer", "unit": "Hectoliter", "unit_price": "5" }, ) self.assertEqual(response.status_code, 403) self.assertEqual(Product.objects.get(id=product.id).name, "Bad Beer")
lunchType = ProductType(name="AdditionalLunch", description="...") lunchType.save() eventsType = ProductType(name="Events", description="...") eventsType.save() roomsType = ProductType(name="Rooms", description="...") roomsType.save() novaType = ProductType(name="Nova", description="...") novaType.save() standType = ProductType(name="Additional Stand Area", description="...") standType.save() heightType = ProductType(name="Additional Stand Height", description="...") heightType.save() stand1 = Product(fair=fair, name="2x4 meters +14 000", description="...", price=14000, product_type=standType, coa_number=5) stand1.save() stand2 = Product(fair=fair, name="2x5 meters +26 000", description="...", price=26000, product_type=standType, coa_number=5) stand2.save() stand3 = Product(fair=fair, name="2x6 meters + 36 000", description="...", price=36000, product_type=standType, coa_number=5) stand3.save() stand4 = Product(fair=fair, name="2x7 meters +44 000", description="...", price=44000, product_type=standType, coa_number=5) stand4.save() height1 = Product(fair=fair, name="Height 2,31 - 3m +1000", description="...", price=1000, product_type=heightType, coa_number=5) height1.save() height2 = Product(fair=fair, name="Height 3 - 5m +2000", description="...", price=1000, product_type=heightType, coa_number=5) height2.save() lunch1 = Product(fair=fair, name="Additional lunch tickets day 1 (21 November) +125 /Ticket", description="...", price=125, product_type=lunchType, coa_number=5) lunch1.save() lunch2 = Product(fair=fair, name="Additional lunch tickets day 2 (22 November) +125 /Ticket", description="...", price=125, product_type=lunchType, coa_number=5) lunch2.save() room1 = Product(fair=fair, name="DIVERSITY ROOM (Base price + 10 000)", description="Students at KTH prioritize companies working with diversity, thus one of THS Armada core values is Diversity. This year a focus room called Diversity Room. Lorem ipsum..", price=10000, product_type=roomsType, coa_number=5)