Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Reorganize tests and dependencies
Patryk Zawadzki46d06385f883
diff --git a/.travis.yml b/.travis.ymlindex d4377970a7..40d66a55f8 100644--- a/.travis.yml+++ b/.travis.yml@@ -2,6 +2,8 @@ language: pythonpython:- 2.6- 2.7+ - 3.2+ - 3.3install:- python setup.py installscript:diff --git a/setup.py b/setup.pyindex 44eaa812fe..6cf262d578 100755--- a/setup.py+++ b/setup.py@@ -23,10 +23,10 @@ setup(include_package_data=True,install_requires=['Django>=1.5',- 'django-images>=0.3.1,<-0.4a0',+ 'django-images>=0.3.2,<-0.4a0','django-mptt>=0.5',- 'django-payments>=0.3,<0.4a0',- 'django-prices>=0.2,<0.3a0',+ 'django-payments>=0.3.3,<0.4a0',+ 'django-prices>=0.2.4,<0.3a0','prices>=0.4.2,<0.5a0','satchless>=1.0.4,<1.1a0','South>=0.7.6',diff --git a/shop/checkout/forms.py b/shop/checkout/forms.pyindex 120ca7e642..cde1b8dd79 100644--- a/shop/checkout/forms.py+++ b/shop/checkout/forms.py@@ -2,6 +2,7 @@ from django import formsfrom django.contrib.auth.models import AnonymousUserfrom django.core import validatorsfrom django.core.exceptions import ValidationError+from django.utils.encoding import smart_textfrom ..order.models import DigitalDeliveryGroupfrom ..userprofile.forms import AddressForm@@ -24,7 +25,6 @@ class DigitalDeliveryForm(forms.ModelForm):email = self.fields['email']email.required = Trueif user.is_authenticated():- print 'asd'email.initial = user.email@@ -32,7 +32,7 @@ class DeliveryField(forms.ChoiceField):def __init__(self, methods, *args, **kwargs):self.methods = list(methods)- choices = [(index, unicode(method)) for index, method in+ choices = [(index, smart_text(method)) for index, method inenumerate(self.methods)]super(DeliveryField, self).__init__(choices, *args, **kwargs)diff --git a/shop/communication/tests.py b/shop/communication/tests.pyindex 3c8b4430a6..c1f6b32c24 100644--- a/shop/communication/tests.py+++ b/shop/communication/tests.py@@ -1,6 +1,7 @@+from unittest import TestCase+from django.template.loader_tags import BlockNodefrom mock import Mock, patch, sentinel-from unittest2 import TestCasefrom .mail import SUBJECT, TEXT, HTML, send_email, render_blocksdiff --git a/shop/core/tests/__init__.py b/shop/core/tests.pysimilarity index 96%rename from shop/core/tests/__init__.pyrename to shop/core/tests.pyindex 398d1d3f48..cedf5945b4 100644--- a/shop/core/tests/__init__.py+++ b/shop/core/tests.py@@ -1,9 +1,10 @@-from ..utils import BaseStepfrom django.template.response import TemplateResponsefrom django.test import TestCasefrom mock import MagicMockfrom satchless.process import InvalidData+from .utils import BaseStep+class SimpleStep(BaseStep):diff --git a/shop/core/utils/__init__.py b/shop/core/utils/__init__.pyindex f72790b6be..7415618945 100644--- a/shop/core/utils/__init__.py+++ b/shop/core/utils/__init__.py@@ -7,7 +7,10 @@ from django.http.request import absolute_http_url_refrom django.template.response import TemplateResponsefrom django.utils.encoding import iri_to_urifrom satchless.process import InvalidData, Step-from urlparse import urljoin+try:+ from urllib.parse import urljoin+except ImportError:+ from urlparse import urljoin__all__ = ['BaseStep', 'CategoryChoiceField', 'build_absolute_uri']diff --git a/shop/registration/tests.py b/shop/registration/tests.pyindex 642b9b63ed..ed3d58b15d 100644--- a/shop/registration/tests.py+++ b/shop/registration/tests.py@@ -1,9 +1,9 @@+from unittest import TestCase+from django.contrib.auth import get_user_modelfrom django.core.urlresolvers import resolve-from mock import call, Mock, MagicMock, patch, sentinelfrom purl import URL-from unittest2 import TestCasefrom .forms import RegisterOrResetPasswordForm, OAuth2CallbackFormfrom .utils import (diff --git a/shop/registration/utils.py b/shop/registration/utils.pyindex f40591a331..f569b9ed8e 100644--- a/shop/registration/utils.py+++ b/shop/registration/utils.py@@ -1,12 +1,16 @@+import logging+try:+ from urllib.parse import parse_qs, urlencode, urljoin, urlunparse+except ImportError:+ from urllib import urlencode+ from urlparse import parse_qs, urljoin, urlunparse+from django.core.urlresolvers import reversefrom django.conf import settingsfrom django.contrib.auth import get_user_modelfrom django.utils.translation import ugettext_lazy as _--import loggingimport requests-import urllib-import urlparse+GOOGLE, FACEBOOK = 'google', 'facebook'JSON_MIME_TYPE = 'application/json'@@ -20,7 +24,7 @@ def get_local_host(request):def url(scheme='', host='', path='', params='', query='', fragment=''):- return urlparse.urlunparse((scheme, host, path, params, query, fragment))+ return urlunparse((scheme, host, path, params, query, fragment))def get_client_class_for_service(service):@@ -39,9 +43,9 @@ def parse_response(response):if JSON_MIME_TYPE in response.headers['Content-Type']:return response.json()else:- content = urlparse.parse_qs(response.text)+ content = parse_qs(response.text)content = dict((x, y[0] if len(y) == 1 else y)- for x, y in content.iteritems())+ for x, y in content.items())return content@@ -80,15 +84,15 @@ class OAuth2Client(object):def get_redirect_uri(self):kwargs = {'service': self.service}path = reverse('registration:oauth_callback', kwargs=kwargs)- return urlparse.urljoin(self.local_host, path)+ return urljoin(self.local_host, path)def get_login_uri(self):data = {'response_type': 'code','scope': self.scope,'redirect_uri': self.get_redirect_uri(),'client_id': self.client_id}- query = urllib.urlencode(data)- return urlparse.urljoin(self.auth_uri, url(query=query))+ query = urlencode(data)+ return urljoin(self.auth_uri, url(query=query))def get_access_token(self, code):data = {'grant_type': 'authorization_code',diff --git a/shop/registration/views.py b/shop/registration/views.pyindex 977fdc7096..edec40b5c9 100644--- a/shop/registration/views.py+++ b/shop/registration/views.py@@ -1,15 +1,16 @@-from urllib import urlencode+try:+ from urllib.parse import urlencode+except ImportError:+ from urllib import urlencodefrom django.conf import settingsfrom django.contrib import messages-from django.contrib.auth import (- login as auth_login,- logout as auth_logout,- get_user_model)+from django.contrib.auth import (login as auth_login,+ logout as auth_logout,+ get_user_model)from django.contrib.auth.decorators import login_required-from django.contrib.auth.views import (- login as django_login_view,- password_change)+from django.contrib.auth.views import (login as django_login_view,+ password_change)from django.core.urlresolvers import reversefrom django.shortcuts import redirectfrom django.template.response import TemplateResponse@@ -46,7 +47,7 @@ def oauth_callback(request, service):try:user = form.get_authenticated_user()return _login_user(request, user)- except ValueError, e:+ except ValueError as e:messages.error(request, unicode(e))else:for _field, errors in form.errors.items():