def test_create_trackingcost(self): url = reverse('costs_trackingcost_create') data = { "slug": "slug", "payment": create_payment().pk, "ref": create_tracking().pk, "type": create_costtype().pk, } response = self.client.post(url, data=data) self.assertEqual(response.status_code, 302)
def create_trackingcost(**kwargs): defaults = {} defaults["slug"] = "slug" defaults.update(**kwargs) if "payment" not in defaults: defaults["payment"] = create_payment() if "ref" not in defaults: defaults["ref"] = create_tracking() if "type" not in defaults: defaults["type"] = create_costtype() return TrackingCost.objects.create(**defaults)
def create_sellcost(**kwargs): defaults = {} defaults["slug"] = "slug" defaults.update(**kwargs) if "payment" not in defaults: defaults["payment"] = create_payment() if "ref" not in defaults: defaults["ref"] = create_sellorder() if "type" not in defaults: defaults["type"] = create_costtype() return SellCost.objects.create(**defaults)
def test_update_sellcost(self): sellcost = create_sellcost() data = { "slug": "slug", "payment": create_payment().pk, "ref": create_sellorder().pk, "type": create_costtype().pk, } url = reverse('costs_sellcost_update', args=[ sellcost.slug, ]) response = self.client.post(url, data) self.assertEqual(response.status_code, 302)