Skip to content

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

Drop old tests files

fowczrek5e8e1b14f24b
diff --git a/tests/__init__.py b/tests/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/tests/api/__init__.py b/tests/api/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/tests/api/benchmark/__init__.py b/tests/api/benchmark/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/tests/api/pagination/__init__.py b/tests/api/pagination/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/tests/cassettes/test_new_search_doesnt_show_unpublished.yaml b/tests/cassettes/test_new_search_doesnt_show_unpublished.yaml
deleted file mode 100644
index 1bad296e50..0000000000
--- a/tests/cassettes/test_new_search_doesnt_show_unpublished.yaml
+++ /dev/null
@@ -1,17 +0,0 @@
-interactions:
-- request:
- body: '{"query": {"bool": {"must": [{"multi_match": {"query": "Group", "fields":
- ["name", "description"]}}], "filter": [{"term": {"is_published": true}}]}},
- "_source": false}'
- headers:
- connection: [keep-alive]
- content-type: [application/json]
- method: GET
- uri: http://search:9200/storefront/doc/_search
- response:
- body: {string: '{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":2,"max_score":3.223138,"hits":[{"_index":"storefront","_type":"doc","_id":"15","_score":3.223138},{"_index":"storefront","_type":"doc","_id":"56","_score":3.223138}]}}'}
- headers:
- content-length: ['285']
- content-type: [application/json; charset=UTF-8]
- status: {code: 200, message: OK}
-version: 1
diff --git a/tests/cassettes/test_new_search_with_empty_results.yaml b/tests/cassettes/test_new_search_with_empty_results.yaml
deleted file mode 100644
index e6fdd8532a..0000000000
--- a/tests/cassettes/test_new_search_with_empty_results.yaml
+++ /dev/null
@@ -1,17 +0,0 @@
-interactions:
-- request:
- body: '{"query": {"bool": {"must": [{"multi_match": {"query": "foo", "fields":
- ["name", "description"]}}], "filter": [{"term": {"is_published": true}}]}},
- "_source": false}'
- headers:
- connection: [keep-alive]
- content-type: [application/json]
- method: GET
- uri: http://search:9200/storefront/doc/_search
- response:
- body: {string: '{"took":0,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}'}
- headers:
- content-length: ['122']
- content-type: [application/json; charset=UTF-8]
- status: {code: 200, message: OK}
-version: 1
diff --git a/tests/cassettes/test_new_search_with_result.yaml b/tests/cassettes/test_new_search_with_result.yaml
deleted file mode 100644
index 1bad296e50..0000000000
--- a/tests/cassettes/test_new_search_with_result.yaml
+++ /dev/null
@@ -1,17 +0,0 @@
-interactions:
-- request:
- body: '{"query": {"bool": {"must": [{"multi_match": {"query": "Group", "fields":
- ["name", "description"]}}], "filter": [{"term": {"is_published": true}}]}},
- "_source": false}'
- headers:
- connection: [keep-alive]
- content-type: [application/json]
- method: GET
- uri: http://search:9200/storefront/doc/_search
- response:
- body: {string: '{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":2,"max_score":3.223138,"hits":[{"_index":"storefront","_type":"doc","_id":"15","_score":3.223138},{"_index":"storefront","_type":"doc","_id":"56","_score":3.223138}]}}'}
- headers:
- content-length: ['285']
- content-type: [application/json; charset=UTF-8]
- status: {code: 200, message: OK}
-version: 1
diff --git a/tests/gateway/__init__.py b/tests/gateway/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/tests/gateway/cassettes/test_authorize_error_response.yaml b/tests/gateway/cassettes/test_authorize_error_response.yaml
deleted file mode 100644
index 43c7ef709a..0000000000
--- a/tests/gateway/cassettes/test_authorize_error_response.yaml
+++ /dev/null
@@ -1,278 +0,0 @@
-interactions:
-- request:
- body: payment_method=abcdefghijklmnoprstquwz&amount=4242&currency=usd&confirmation_method=manual&confirm=True
- headers:
- Accept:
- - '*/*'
- Accept-Encoding:
- - gzip, deflate
- Connection:
- - keep-alive
- Content-Length:
- - '103'
- Content-Type:
- - application/x-www-form-urlencoded
- Idempotency-Key:
- - 6172c460-3a9c-424e-a190-036c7406ea53
- User-Agent:
- - Stripe/v1 PythonBindings/2.33.0
- X-Stripe-Client-Telemetry:
- - '{"last_request_metrics": {"request_id": "req_8S93V2YnPF1OyS", "request_duration_ms":
- 75}}'
- X-Stripe-Client-User-Agent:
- - '{"bindings_version": "2.33.0", "lang": "python", "publisher": "stripe", "httplib":
- "requests", "lang_version": "3.7.4", "platform": "Darwin-18.7.0-x86_64-i386-64bit",
- "uname": "Darwin mbp-jakub.lan 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun
- 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64 i386"}'
- method: POST
- uri: https://api.stripe.com/v1/payment_intents
- response:
- body:
- string: "{\n \"error\": {\n \"code\": \"resource_missing\",\n \"doc_url\"\
- : \"https://stripe.com/docs/error-codes/resource-missing\",\n \"message\"\
- : \"No such payment_method: abcdefghijklmnoprstquwz\",\n \"param\": \"\
- payment_method\",\n \"type\": \"invalid_request_error\"\n }\n}\n"
- headers:
- Connection:
- - keep-alive
- Content-Length:
- - '257'
- Content-Type:
- - application/json
- Date:
- - Thu, 08 Aug 2019 13:01:25 GMT
- Server:
- - nginx
- Strict-Transport-Security:
- - max-age=31556926; includeSubDomains; preload
- access-control-allow-credentials:
- - 'true'
- access-control-allow-methods:
- - GET, POST, HEAD, OPTIONS, DELETE
- access-control-allow-origin:
- - '*'
- access-control-expose-headers:
- - Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required
- access-control-max-age:
- - '300'
- cache-control:
- - no-cache, no-store
- idempotency-key:
- - 6172c460-3a9c-424e-a190-036c7406ea53
- original-request:
- - req_6K0JNwQccyE7q0
- request-id:
- - req_6K0JNwQccyE7q0
- stripe-version:
- - '2019-05-16'
- status:
- code: 400
- message: Bad Request
-- request:
- body: payment_method=abcdefghijklmnoprstquwz&amount=4242&currency=usd&confirmation_method=manual&confirm=True&capture_method=automatic
- headers:
- Accept:
- - '*/*'
- Accept-Encoding:
- - gzip, deflate
- Connection:
- - keep-alive
- Content-Length:
- - '128'
- Content-Type:
- - application/x-www-form-urlencoded
- Idempotency-Key:
- - 86b391dc-2c40-4b7d-a879-2a2c4eea9829
- User-Agent:
- - Stripe/v1 PythonBindings/2.33.0
- X-Stripe-Client-Telemetry:
- - '{"last_request_metrics": {"request_id": "req_Xs3SMl52WIayjo", "request_duration_ms":
- 1640}}'
- X-Stripe-Client-User-Agent:
- - '{"bindings_version": "2.33.0", "lang": "python", "publisher": "stripe", "httplib":
- "requests", "lang_version": "3.7.4", "platform": "Darwin-18.7.0-x86_64-i386-64bit",
- "uname": "Darwin mbp-jakub.lan 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun
- 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64 i386"}'
- method: POST
- uri: https://api.stripe.com/v1/payment_intents
- response:
- body:
- string: "{\n \"error\": {\n \"code\": \"resource_missing\",\n \"doc_url\"\
- : \"https://stripe.com/docs/error-codes/resource-missing\",\n \"message\"\
- : \"No such payment_method: abcdefghijklmnoprstquwz\",\n \"param\": \"\
- payment_method\",\n \"type\": \"invalid_request_error\"\n }\n}\n"
- headers:
- Connection:
- - keep-alive
- Content-Length:
- - '257'
- Content-Type:
- - application/json
- Date:
- - Thu, 08 Aug 2019 13:37:52 GMT
- Server:
- - nginx
- Strict-Transport-Security:
- - max-age=31556926; includeSubDomains; preload
- access-control-allow-credentials:
- - 'true'
- access-control-allow-methods:
- - GET, POST, HEAD, OPTIONS, DELETE
- access-control-allow-origin:
- - '*'
- access-control-expose-headers:
- - Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required
- access-control-max-age:
- - '300'
- cache-control:
- - no-cache, no-store
- idempotency-key:
- - 86b391dc-2c40-4b7d-a879-2a2c4eea9829
- original-request:
- - req_RuacIvBFwUqhLp
- request-id:
- - req_RuacIvBFwUqhLp
- stripe-version:
- - '2019-05-16'
- status:
- code: 400
- message: Bad Request
-- request:
- body: payment_method=abcdefghijklmnoprstquwz&amount=4242&currency=usd&confirmation_method=manual&confirm=True&capture_method=automatic
- headers:
- Accept:
- - '*/*'
- Accept-Encoding:
- - gzip, deflate
- Connection:
- - keep-alive
- Content-Length:
- - '128'
- Content-Type:
- - application/x-www-form-urlencoded
- Idempotency-Key:
- - 62996bcb-2954-48a3-9916-209c5993b74d
- User-Agent:
- - Stripe/v1 PythonBindings/2.33.0
- X-Stripe-Client-Telemetry:
- - '{"last_request_metrics": {"request_id": "req_YUZwIYFjguCgKX", "request_duration_ms":
- 1539}}'
- X-Stripe-Client-User-Agent:
- - '{"bindings_version": "2.33.0", "lang": "python", "publisher": "stripe", "httplib":
- "requests", "lang_version": "3.7.4", "platform": "Darwin-18.7.0-x86_64-i386-64bit",
- "uname": "Darwin mbp-jakub.lan 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun
- 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64 i386"}'
- method: POST
- uri: https://api.stripe.com/v1/payment_intents
- response:
- body:
- string: "{\n \"error\": {\n \"code\": \"resource_missing\",\n \"doc_url\"\
- : \"https://stripe.com/docs/error-codes/resource-missing\",\n \"message\"\
- : \"No such payment_method: abcdefghijklmnoprstquwz\",\n \"param\": \"\
- payment_method\",\n \"type\": \"invalid_request_error\"\n }\n}\n"
- headers:
- Connection:
- - keep-alive
- Content-Length:
- - '257'
- Content-Type:
- - application/json
- Date:
- - Thu, 08 Aug 2019 13:40:24 GMT
- Server:
- - nginx
- Strict-Transport-Security:
- - max-age=31556926; includeSubDomains; preload
- access-control-allow-credentials:
- - 'true'
- access-control-allow-methods:
- - GET, POST, HEAD, OPTIONS, DELETE
- access-control-allow-origin:
- - '*'
- access-control-expose-headers:
- - Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required
- access-control-max-age:
- - '300'
- cache-control:
- - no-cache, no-store
- idempotency-key:
- - 62996bcb-2954-48a3-9916-209c5993b74d
- original-request:
- - req_02IDhq6m8xrUYO
- request-id:
- - req_02IDhq6m8xrUYO
- stripe-version:
- - '2019-05-16'
- status:
- code: 400
- message: Bad Request
-- request:
- body: payment_method=abcdefghijklmnoprstquwz&amount=4242&currency=usd&confirmation_method=manual&confirm=True&capture_method=automatic
- headers:
- Accept:
- - '*/*'
- Accept-Encoding:
- - gzip, deflate
- Connection:
- - keep-alive
- Content-Length:
- - '128'
- Content-Type:
- - application/x-www-form-urlencoded
- Idempotency-Key:
- - 19b4617d-3ac2-4e6a-9437-6968cc4f7a0d
- User-Agent:
- - Stripe/v1 PythonBindings/2.33.0
- X-Stripe-Client-Telemetry:
- - '{"last_request_metrics": {"request_id": "req_Yp2Xralp4YSSas", "request_duration_ms":
- 1884}}'
- X-Stripe-Client-User-Agent:
- - '{"bindings_version": "2.33.0", "lang": "python", "publisher": "stripe", "httplib":
- "requests", "lang_version": "3.7.4", "platform": "Darwin-18.7.0-x86_64-i386-64bit",
- "uname": "Darwin mbp-jakub.lan 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun
- 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64 i386"}'
- method: POST
- uri: https://api.stripe.com/v1/payment_intents
- response:
- body:
- string: "{\n \"error\": {\n \"code\": \"resource_missing\",\n \"doc_url\"\
- : \"https://stripe.com/docs/error-codes/resource-missing\",\n \"message\"\
- : \"No such payment_method: abcdefghijklmnoprstquwz\",\n \"param\": \"\
- payment_method\",\n \"type\": \"invalid_request_error\"\n }\n}\n"
- headers:
- Connection:
- - keep-alive
- Content-Length:
- - '257'
- Content-Type:
- - application/json
- Date:
- - Thu, 08 Aug 2019 13:41:58 GMT
- Server:
- - nginx
- Strict-Transport-Security:
- - max-age=31556926; includeSubDomains; preload
- access-control-allow-credentials:
- - 'true'
- access-control-allow-methods:
- - GET, POST, HEAD, OPTIONS, DELETE
- access-control-allow-origin:
- - '*'
- access-control-expose-headers:
- - Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required
- access-control-max-age:
- - '300'
- cache-control:
- - no-cache, no-store
- idempotency-key:
- - 19b4617d-3ac2-4e6a-9437-6968cc4f7a0d
- original-request:
- - req_KxLRnayybvlIeS
- request-id:
- - req_KxLRnayybvlIeS
- stripe-version:
- - '2019-05-16'
- status:
- code: 400
- message: Bad Request
-version: 1
diff --git a/tests/gateway/cassettes/test_authorize_incorrect_token.yaml b/tests/gateway/cassettes/test_authorize_incorrect_token.yaml
deleted file mode 100644
index 895c72684c..0000000000
--- a/tests/gateway/cassettes/test_authorize_incorrect_token.yaml
+++ /dev/null
@@ -1,75 +0,0 @@
-interactions:
-- request:
- body: <transaction><amount>80.00</amount><payment_method_nonce>payment-token</payment_method_nonce><options><submit_for_settlement
- type="boolean">true</submit_for_settlement><store_in_vault_on_success type="boolean">false</store_in_vault_on_success><three_d_secure><required
- type="boolean">false</required></three_d_secure></options><order_id type="integer">6</order_id><billing><first_name>John</first_name><last_name>Doe</last_name><company>Mirumee
- Software</company><postal_code>53-601</postal_code><street_address>T&#281;czowa
- 7</street_address><extended_address></extended_address><locality>WROC&#321;AW</locality><region></region><country_code_alpha2>PL</country_code_alpha2></billing><risk_data><customer_ip></customer_ip></risk_data><customer><email>[email protected]</email></customer><type>sale</type></transaction>
- headers:
- Accept:
- - application/xml
- Accept-Encoding:
- - gzip
- Connection:
- - keep-alive
- Content-Length:
- - '818'
- Content-type:
- - application/xml
- User-Agent:
- - Braintree Python 3.49.0
- X-ApiVersion:
- - '5'
- method: POST
- uri: https://api.sandbox.braintreegateway.com/merchants/9m6qhfxsqzm3cgzw/transactions
- response:
- body:
- string: !!binary |
- H4sIAEyyFF0AA6RUTW/bMAy991cYLtCb4qRFuwx11A0bdhg2bNha9FgwNtMI1YdH0W28Xz/ZiWIn
- c3fZTeQjn8hHUfnNxujkGckrZxfpbDJNE7SFK5V9XKR3t5/EPL2RJzlUSiCRI0HoK2c9ypMkyTuX
- b497I+GmwkUKRNCk2Q5iAuuh4HDJ1jMeHrGI9nbwhKJQvp1dXl3mWXcegsBMalkz7vh8Y5ZOp7KC
- xqDlB4O8duWDdbbAPNtHH3AY9B4eUd7ZJ+tebOIowU2lCMtkjGaSZzGjLzs7qHtnRoGyIxmGcF4B
- gfH/0AuMqy3L+XQynYYWtlYEdwWKbYGiKzA2L9g9oc2z0ZhI4Kr2Mj9oxddLo1iswsw9MmtskyVT
- HQQcxwa57AiFsuIZas3CWeHroghqyRVo3xK8GtCT8JoQRRluKGo6HBXhr7odTKTb24NJjKfn2VGn
- uaMSSahSXgUsniO4VFqHVRjwrhR5FhYMys9uHWQdOPooDdH30YX6erMPKZypwDbyq6LaICY/3Ypf
- gLB93Vukj62cZ9Cie/aXF+JqOgvjHPiGyoeuWUBZUqvm7dnp+Xx2Xfx2L5C8aXU/gAf7tmG0JZYR
- SqzSi7SddlzibV+uAK24kfc/vn04O704n12/vw/9RXcfSfgYZH6FpmgfLzVd8QJ0tYZz+f1L2/nf
- /v3gjmaRk/JPogSGIXEdXpZpZ1iNXR1eynHSPmUohgGlJaPnd7gBU2mchJmEde38e67jzLz9e6QH
- HWbYHV9b+37X/+fTCZ/AyK/8BwAA//8DAHErh2zSBQAA
- headers:
- Cache-Control:
- - no-cache
- Content-Encoding:
- - gzip
- Content-Security-Policy:
- - frame-ancestors 'self'
- Content-Type:
- - application/xml; charset=utf-8
- Date:
- - Thu, 27 Jun 2019 12:10:52 GMT
- Strict-Transport-Security:
- - max-age=31536000; includeSubDomains
- Transfer-Encoding:
- - chunked
- Vary:
- - Accept-Encoding
- X-Authentication:
- - basic_auth
- X-BroxyId:
- - 02-1561637451.810-79.110.196.19-2197475
- X-Content-Type-Options:
- - nosniff
- X-Frame-Options:
- - SAMEORIGIN
- X-Request-Id:
- - 02-1561637451.810-79.110.196.19-2197475
- X-Runtime:
- - '0.211300'
- X-User:
- - wgs3tg8h39pyypyc
- X-XSS-Protection:
- - 1; mode=block
- status:
- code: 422
- message: Unprocessable Entity
-version: 1
diff --git a/tests/plugins/__init__.py b/tests/plugins/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/tests/utils.py b/tests/utils.py
deleted file mode 100644
index 4facfc227b..0000000000
--- a/tests/utils.py
+++ /dev/null
@@ -1,47 +0,0 @@
-from typing import Dict, Set, Union
-from urllib.parse import urlparse
-
-from prices import Money
-
-from saleor.product.models import Product, ProductVariant
-
-
-def get_url_path(url):
- parsed_url = urlparse(url)
- return parsed_url.path
-
-
-def get_redirect_location(response):
- # Due to Django 1.8 compatibility, we have to handle both cases
- return get_url_path(response["Location"])
-
-
-def get_form_errors(response, form_name="form"):
- errors = response.context.get(form_name).errors
- return errors.get("__all__") if errors else []
-
-
-def money(amount):
- return Money(amount, "USD")
-
-
-def generate_attribute_map(obj: Union[Product, ProductVariant]) -> Dict[int, Set[int]]:
- """Generate a map from a product or variant instance.
-
- Useful to quickly compare the assigned attribute values against expected IDs.
-
- The below association map will be returned.
-
- {
- attribute_pk (int) => {attribute_value_pk (int), ...}
- ...
- }
- """
-
- qs = obj.attributes.select_related("assignment__attribute")
- qs = qs.prefetch_related("values")
-
- return {
- assignment.attribute.pk: {value.pk for value in assignment.values.all()}
- for assignment in qs
- }