Example #1
0
    def test_create_purchasepayment(self):
        url = reverse('payments_purchasepayment_create')
        data = {
            "amount": 100.00,
            "status": create_paymentstatus().pk,
            "method": create_purchaseorder().pk,
            "ref": create_purchaseorder().pk,
        }
        print(url)

        response = self.client.post(url, data=data)
        print(response)
        self.assertEqual(response.status_code, 302)
Example #2
0
 def test_create_purchasecost(self):
     url = reverse('costs_purchasecost_create')
     data = {
         "slug": "slug",
         "payment": create_payment().pk,
         "ref": create_purchaseorder().pk,
         "type": create_costtype().pk,
     }
     response = self.client.post(url, data=data)
     self.assertEqual(response.status_code, 302)
Example #3
0
def create_purchasecost(**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_purchaseorder()
    if "type" not in defaults:
        defaults["type"] = create_costtype()
    return PurchaseCost.objects.create(**defaults)
Example #4
0
def create_purchasepayment(**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_purchaseorder()
    return PurchasePayment.objects.create(**defaults)
Example #5
0
 def test_update_purchasepayment(self):
     purchasepayment = create_purchasepayment()
     data = {
         "slug": "slug",
         "date": timezone.now(),
         "amount": 100.00,
         "status": create_paymentstatus().pk,
         "method": create_paymentmethod().pk,
         "ref": create_purchaseorder().pk,
     }
     url = reverse('payments_purchasepayment_update',
                   args=[purchasepayment.slug, ])
     response = self.client.post(url, data)
     self.assertEqual(response.status_code, 302)