feat: removed customer modl

This commit is contained in:
2024-12-07 11:34:00 +01:00
parent 48d39f55ba
commit ef91ef9090
10 changed files with 4 additions and 196 deletions
-66
View File
@@ -1,66 +0,0 @@
from rest_framework import status
from rest_framework.test import APITestCase
from config.tests.mixins import TestUserAuthenticationMixin
class TestCustomersAPI(APITestCase, TestUserAuthenticationMixin):
model_name = "customer"
def setUp(self):
self.create_user()
def test_create_retrieve_customer(self):
self.login()
response = self.client.post(
f"/api/v1/shop/customers/",
{
"vat_id": "11111111H",
"first_name": "Darth",
"last_name": "Maull",
"email": "darth@maul.com",
"address": "Dathomir",
"city": "Dathomir",
"state": "Dathomir",
"country": "Dathomir",
"zip": "00001",
},
)
assert response.status_code == status.HTTP_201_CREATED
pk = response.data.get("id")
response = self.client.get(f"/api/v1/shop/customers/{pk}/")
assert response.status_code == status.HTTP_200_OK
def test_create_update_customer(self):
self.login()
response = self.client.post(
f"/api/v1/shop/customers/",
{
"vat_id": "11111111H",
"first_name": "Darth",
"last_name": "Maull",
"email": "darth@maul.com",
"address": "Dathomir",
"city": "Dathomir",
"state": "Dathomir",
"country": "Dathomir",
"zip": "00001",
},
)
assert response.status_code == status.HTTP_201_CREATED
pk = response.data.get("id")
response = self.client.get(f"/api/v1/shop/customers/{pk}/")
assert response.status_code == status.HTTP_200_OK
response = self.client.patch(
f"/api/v1/shop/customers/{pk}/",
{
"address": "Mandalore",
},
)
assert response.status_code == status.HTTP_200_OK
response = self.client.get(f"/api/v1/shop/customers/{pk}/")
assert response.status_code == status.HTTP_200_OK
assert response.data.get("address") == "Mandalore"
+1 -1
View File
@@ -5,7 +5,7 @@ from rest_framework import status
from rest_framework.test import APITestCase
from config.tests.mixins import TestUserAuthenticationMixin
from shop.models import Product, ProductPrice, Tax, Customer, CustomerAddress
from shop.models import Product, ProductPrice, Tax, CustomerAddress
User = get_user_model()
+1 -1
View File
@@ -3,7 +3,7 @@ from decimal import Decimal
from django.contrib.auth import get_user_model
from rest_framework.test import APITestCase as TestCase
from shop.models import Customer, Product, ProductPrice, Tax, CustomerAddress
from shop.models import Product, ProductPrice, Tax, CustomerAddress
from shop.utils import create_order, create_order_line_for_product
User = get_user_model()