Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix tests after rebase

Patryk Zawadzkib3f019369b4c
diff --git a/tests/api/test_graphql.py b/tests/api/test_graphql.py
index 9cc7707636..b728436fb4 100644
--- a/tests/api/test_graphql.py
+++ b/tests/api/test_graphql.py
@@ -172,7 +172,6 @@ def test_real_query(user_api_client, product):
id
name
slug
- color
__typename
}
__typename
diff --git a/tests/api/test_product.py b/tests/api/test_product.py
index b9ae04d1ad..324e9f83f3 100644
--- a/tests/api/test_product.py
+++ b/tests/api/test_product.py
@@ -104,14 +104,10 @@ def test_product_query(admin_api_client, product):
}
purchaseCost {
start {
- gross {
- amount
- }
+ amount
}
stop {
- gross {
- amount
- }
+ amount
}
}
margin {
@@ -813,7 +809,7 @@ def test_product_image_create_mutation(admin_api_client, product):
id
image
url
- order
+ sortOrder
}
}
}
@@ -825,6 +821,7 @@ def test_product_image_create_mutation(admin_api_client, product):
body = get_multipart_request_body(query, variables, image_file, image_name)
response = admin_api_client.post_multipart(reverse('api'), body)
content = get_graphql_content(response)
+ assert 'errors' not in content
data = content['data']['productImageCreate']
file_name = data['productImage']['image']
product.refresh_from_db()
@@ -859,9 +856,9 @@ def test_collections_query(user_api_client, collection):
def test_create_collection(admin_api_client, product_list):
query = """
mutation createCollection(
- $name: String!, $slug: String!, $products: [ID]) {
+ $name: String!, $slug: String!, $products: [ID], $isPublished: Boolean!) {
collectionCreate(
- name: $name, slug: $slug, products: $products) {
+ name: $name, slug: $slug, products: $products, isPublished: $isPublished) {
collection {
name
slug
@@ -877,7 +874,7 @@ def test_create_collection(admin_api_client, product_list):
name = 'test-name'
slug = 'test-slug'
variables = json.dumps(
- {'name': name, 'slug': slug, 'products': product_ids})
+ {'name': name, 'slug': slug, 'products': product_ids, 'isPublished': True})
response = admin_api_client.post(
reverse('api'), {'query': query, 'variables': variables})
content = get_graphql_content(response)
@@ -891,9 +888,9 @@ def test_create_collection(admin_api_client, product_list):
def test_update_collection(admin_api_client, collection):
query = """
mutation createCollection(
- $name: String!, $slug: String!, $id: ID!) {
+ $name: String!, $slug: String!, $id: ID!, $isPublished: Boolean!) {
collectionUpdate(
- name: $name, slug: $slug, id: $id) {
+ name: $name, slug: $slug, id: $id, isPublished: $isPublished) {
collection {
name
slug
@@ -905,7 +902,7 @@ def test_update_collection(admin_api_client, collection):
name = 'new-name'
slug = 'new-slug'
variables = json.dumps(
- {'name': name, 'slug': slug, 'id': collection_id})
+ {'name': name, 'slug': slug, 'id': collection_id, 'isPublished': True})
response = admin_api_client.post(
reverse('api'), {'query': query, 'variables': variables})
content = get_graphql_content(response)
diff --git a/tests/api/test_variant.py b/tests/api/test_variant.py
index ba103757e7..d65656d833 100644
--- a/tests/api/test_variant.py
+++ b/tests/api/test_variant.py
@@ -14,14 +14,16 @@ def test_create_variant(admin_api_client, product, product_type):
$priceOverride: Float,
$costPrice: Float,
$quantity: Int!,
- $attributes: [AttributeValueInput]) {
+ $attributes: [AttributeValueInput],
+ $trackInventory: Boolean!) {
productVariantCreate(
productId: $productId,
sku: $sku,
priceOverride: $priceOverride,
costPrice: $costPrice,
quantity: $quantity,
- attributes: $attributes) {
+ attributes: $attributes,
+ trackInventory: $trackInventory) {
productVariant {
name
sku
@@ -64,7 +66,8 @@ def test_create_variant(admin_api_client, product, product_type):
'costPrice': cost_price,
'priceOverride': price_override,
'attributes': [
- {'slug': variant_slug, 'value': variant_value}]})
+ {'slug': variant_slug, 'value': variant_value}],
+ 'trackInventory': True})
response = admin_api_client.post(
reverse('api'), {'query': query, 'variables': variables})
content = get_graphql_content(response)
@@ -85,12 +88,14 @@ def test_update_product_variant(admin_api_client, product):
$id: ID!,
$sku: String!,
$costPrice: Float,
- $quantity: Int!) {
+ $quantity: Int!,
+ $trackInventory: Boolean!) {
productVariantUpdate(
id: $id,
sku: $sku,
costPrice: $costPrice,
- quantity: $quantity) {
+ quantity: $quantity,
+ trackInventory: $trackInventory) {
productVariant {
name
sku
@@ -115,7 +120,8 @@ def test_update_product_variant(admin_api_client, product):
'id': variant_id,
'sku': sku,
'quantity': quantity,
- 'costPrice': cost_price})
+ 'costPrice': cost_price,
+ 'trackInventory': True})
response = admin_api_client.post(
reverse('api'), {'query': query, 'variables': variables})
diff --git a/tests/test_cart.py b/tests/test_cart.py
index 0c69633f3c..043982a1a4 100644
--- a/tests/test_cart.py
+++ b/tests/test_cart.py
@@ -416,7 +416,7 @@ def test_replace_cartline_form_when_insufficient_stock(
add_variant_to_cart(cart, variant, initial_quantity)
exception_mock = InsufficientStock(
- Mock(get_stock_quantity=Mock(return_value=2)))
+ Mock(quantity_available=2))
monkeypatch.setattr(
'saleor.product.models.ProductVariant.check_quantity',
Mock(side_effect=exception_mock))