def test_create_sellcost(self): url = reverse('costs_sellcost_create') data = { "slug": "slug", "payment": create_payment().pk, "ref": create_sellorder().pk, "type": create_costtype().pk, } response = self.client.post(url, data=data) self.assertEqual(response.status_code, 302)
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_create_salepayment(self): url = reverse('payments_salepayment_create') data = { "slug": "slug", "date": timezone.now(), "amount": 100.00, "status": create_paymentstatus().pk, "method": create_paymentmethod().pk, "ref": create_sellorder().pk, } response = self.client.post(url, data=data) self.assertEqual(response.status_code, 302)
def create_salepayment(**kwargs): defaults = {} defaults["slug"] = "slug" defaults["date"] = timezone.now() defaults["amount"] = 100.00 defaults.update(**kwargs) if "status" not in defaults: defaults["status"] = create_paymentstatus() if "method" not in defaults: defaults["method"] = create_paymentmethod() if "ref" not in defaults: defaults["ref"] = create_sellorder() return SalePayment.objects.create(**defaults)