feat: Test create catalog sale
This commit is contained in:
@@ -4,7 +4,7 @@ import io
|
|||||||
|
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.test import APITestCase
|
from rest_framework.test import APITestCase
|
||||||
from ..models.sales import Sale
|
from ..models.sales import Sale, CatalogSale
|
||||||
from ..models.customers import Customer
|
from ..models.customers import Customer
|
||||||
from ..models.products import Product
|
from ..models.products import Product
|
||||||
from .Mixins import LoginMixin
|
from .Mixins import LoginMixin
|
||||||
@@ -38,11 +38,10 @@ class TestAPI(APITestCase, LoginMixin):
|
|||||||
response = self._create_catalog_sale()
|
response = self._create_catalog_sale()
|
||||||
content = json.loads(response.content.decode("utf-8"))
|
content = json.loads(response.content.decode("utf-8"))
|
||||||
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
||||||
# self.assertEqual(Sale.objects.count(), 1)
|
self.assertEqual(CatalogSale.objects.count(), 1)
|
||||||
# sale = Sale.objects.all()[0]
|
sale = CatalogSale.objects.all()[0]
|
||||||
# self.assertEqual(sale.customer.name, self.customer.name)
|
self.assertEqual(sale.customer.name, self.customer.name)
|
||||||
# self.assertEqual(sale.id, content["id"])
|
self.assertEqual(sale.id, content["id"])
|
||||||
# self.assertTrue(sale.catalog_sale)
|
|
||||||
|
|
||||||
def test_create_sale_with_decimal(self):
|
def test_create_sale_with_decimal(self):
|
||||||
response = self._create_sale_with_decimal()
|
response = self._create_sale_with_decimal()
|
||||||
|
|||||||
Reference in New Issue
Block a user