chore: extracted product batch creation
This commit is contained in:
@@ -51,6 +51,8 @@ class TestProductBatchesAPI(APITestCase, TestUserAuthenticationMixin):
|
||||
pk = response.data.get("id")
|
||||
|
||||
response = self.client.get(f"/api/v1/shop/product-batches/{pk}/")
|
||||
self.product.refresh_from_db()
|
||||
assert self.product.stock == Decimal("5")
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
|
||||
def test_create_update_product_batch(self):
|
||||
@@ -73,6 +75,9 @@ class TestProductBatchesAPI(APITestCase, TestUserAuthenticationMixin):
|
||||
response = self.client.get(f"/api/v1/shop/product-batches/{pk}/")
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
|
||||
self.product.refresh_from_db()
|
||||
assert self.product.stock == Decimal("5")
|
||||
|
||||
response = self.client.patch(
|
||||
f"/api/v1/shop/product-batches/{pk}/",
|
||||
{
|
||||
@@ -81,6 +86,9 @@ class TestProductBatchesAPI(APITestCase, TestUserAuthenticationMixin):
|
||||
)
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
|
||||
self.product.refresh_from_db()
|
||||
assert self.product.stock == Decimal("10")
|
||||
|
||||
response = self.client.get(f"/api/v1/shop/product-batches/{pk}/")
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
assert Decimal(response.data.get("quantity")) == Decimal("10")
|
||||
|
||||
Reference in New Issue
Block a user