Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove unused variables from settings and account backends
IKarbowiak79edbbdbbd55
diff --git a/.isort.cfg b/.isort.cfgindex 9b37a55b1d..3fb39b38a9 100644--- a/.isort.cfg+++ b/.isort.cfg@@ -1,2 +1,2 @@[settings]-known_third_party = PIL,babel,bleach,bootstrap4,braintree,celery,dj_database_url,dj_email_url,django,django_countries,django_filters,django_measurement,django_prices,django_prices_openexchangerates,django_prices_vatlayer,draftjs_sanitizer,faker,freezegun,geolite2,google_measurement_protocol,graphene,graphene_django,graphene_django_optimizer,graphene_federation,graphql,graphql_jwt,graphql_relay,html5lib,html_to_draftjs,i18naddress,jwt,markdown,measurement,mptt,oauthlib,phonenumber_field,phonenumbers,prices,promise,pytest,razorpay,requests,sentry_sdk,six,social_core,storages,stripe,templated_email,text_unidecode,tqdm,versatileimagefield+known_third_party = PIL,babel,bleach,bootstrap4,braintree,celery,dj_database_url,dj_email_url,django,django_countries,django_filters,django_measurement,django_prices,django_prices_openexchangerates,django_prices_vatlayer,draftjs_sanitizer,faker,freezegun,geolite2,google_measurement_protocol,graphene,graphene_django,graphene_django_optimizer,graphene_federation,graphql,graphql_jwt,graphql_relay,html5lib,html_to_draftjs,i18naddress,jwt,markdown,measurement,mptt,oauthlib,phonenumber_field,phonenumbers,prices,promise,pytest,razorpay,requests,sentry_sdk,six,storages,stripe,templated_email,text_unidecode,tqdm,versatileimagefielddiff --git a/saleor/account/backends/__init__.py b/saleor/account/backends/__init__.pydeleted file mode 100644index 70e03b6cfc..0000000000--- a/saleor/account/backends/__init__.py+++ /dev/null@@ -1,11 +0,0 @@-from ...site.utils import get_authorization_key_for_backend---class BaseBackend:- def get_key_and_secret(self):- """Return a tuple of `(key, secret)` for current provider."""- # pylint: disable=maybe-no-member- authorization_key = get_authorization_key_for_backend(self.DB_NAME)- if authorization_key:- return authorization_key.key_and_secret()- return Nonediff --git a/saleor/account/backends/facebook.py b/saleor/account/backends/facebook.pydeleted file mode 100644index 408c0744c7..0000000000--- a/saleor/account/backends/facebook.py+++ /dev/null@@ -1,8 +0,0 @@-from social_core.backends.facebook import FacebookOAuth2--from ...site import AuthenticationBackends-from . import BaseBackend---class CustomFacebookOAuth2(BaseBackend, FacebookOAuth2):- DB_NAME = AuthenticationBackends.FACEBOOKdiff --git a/saleor/account/backends/google.py b/saleor/account/backends/google.pydeleted file mode 100644index 4c83a52687..0000000000--- a/saleor/account/backends/google.py+++ /dev/null@@ -1,8 +0,0 @@-from social_core.backends.google import GoogleOAuth2--from ...site import AuthenticationBackends-from . import BaseBackend---class CustomGoogleOAuth2(BaseBackend, GoogleOAuth2):- DB_NAME = AuthenticationBackends.GOOGLEdiff --git a/saleor/settings.py b/saleor/settings.pyindex 5f709e4a02..6ecff30a82 100644--- a/saleor/settings.py+++ b/saleor/settings.py@@ -338,8 +338,6 @@ LOGGING = {AUTH_USER_MODEL = "account.User"-LOGIN_URL = "/account/login/"-AUTH_PASSWORD_VALIDATORS = [{"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",@@ -406,10 +404,6 @@ MESSAGE_TAGS = {messages.ERROR: "danger"}LOW_STOCK_THRESHOLD = 10MAX_CHECKOUT_LINE_QUANTITY = int(os.environ.get("MAX_CHECKOUT_LINE_QUANTITY", 50))-PAGINATE_BY = 16-DASHBOARD_PAGINATE_BY = 30-DASHBOARD_SEARCH_LIMIT = 5-bootstrap4 = {"set_placeholder": False,"set_required": False,@@ -492,8 +486,6 @@ LOGOUT_ON_PASSWORD_CHANGE = FalseSEARCH_BACKEND = "saleor.search.backends.postgresql"AUTHENTICATION_BACKENDS = [- "saleor.account.backends.facebook.CustomFacebookOAuth2",- "saleor.account.backends.google.CustomGoogleOAuth2","graphql_jwt.backends.JSONWebTokenBackend","django.contrib.auth.backends.ModelBackend",]@@ -501,25 +493,6 @@ AUTHENTICATION_BACKENDS = [GRAPHQL_JWT = {"JWT_PAYLOAD_HANDLER": "saleor.graphql.utils.create_jwt_payload"}-SOCIAL_AUTH_PIPELINE = [- "social_core.pipeline.social_auth.social_details",- "social_core.pipeline.social_auth.social_uid",- "social_core.pipeline.social_auth.auth_allowed",- "social_core.pipeline.social_auth.social_user",- "social_core.pipeline.social_auth.associate_by_email",- "social_core.pipeline.user.create_user",- "social_core.pipeline.social_auth.associate_user",- "social_core.pipeline.social_auth.load_extra_data",- "social_core.pipeline.user.user_details",-]--SOCIAL_AUTH_USERNAME_IS_FULL_EMAIL = True-SOCIAL_AUTH_USER_MODEL = AUTH_USER_MODEL-SOCIAL_AUTH_FACEBOOK_SCOPE = ["email"]-SOCIAL_AUTH_FACEBOOK_PROFILE_EXTRA_PARAMS = {"fields": "id, email"}-# As per March 2018, Facebook requires all traffic to go through HTTPS only-SOCIAL_AUTH_REDIRECT_IS_HTTPS = True-# CELERY SETTINGSCELERY_BROKER_URL = (os.environ.get("CELERY_BROKER_URL", os.environ.get("CLOUDAMQP_URL")) or ""diff --git a/tests/conftest.py b/tests/conftest.pyindex b72ab9d60f..2e932640ff 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -21,7 +21,6 @@ from django_countries import countriesfrom PIL import Imagefrom prices import Money, TaxedMoney-from saleor.account.backends import BaseBackendfrom saleor.account.models import (Address,ServiceAccount,@@ -1208,13 +1207,6 @@ def authorization_key(site_settings, authorization_backend_name):)-def base_backend(authorization_backend_name):- base_backend = BaseBackend()- base_backend.DB_NAME = authorization_backend_name- return base_backend--@pytest.fixturedef permission_manage_staff():return Permission.objects.get(codename="manage_staff")diff --git a/tests/test_registration.py b/tests/test_registration.pydeleted file mode 100644index 2bc504c35e..0000000000--- a/tests/test_registration.py+++ /dev/null@@ -1,15 +0,0 @@-from django.contrib.auth import get_user_model--User = get_user_model()---def test_base_backend(authorization_key, base_backend):- assert authorization_key.site_settings.site.domain == "mirumee.com"- key, secret = base_backend.get_key_and_secret()- assert key == "Key"- assert secret == "Password"---def test_backend_no_site(settings, authorization_key, base_backend):- settings.SITE_ID = None- assert base_backend.get_key_and_secret() is None