pyramid-fullauth 0.4.1__py3.3.egg → 0.5.0__py3.3.egg

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. EGG-INFO/PKG-INFO +20 -8
  2. EGG-INFO/SOURCES.txt +1 -0
  3. EGG-INFO/requires.txt +2 -0
  4. pyramid_fullauth/__init__.py +3 -4
  5. pyramid_fullauth/__pycache__/__init__.cpython-33.pyc +0 -0
  6. pyramid_fullauth/__pycache__/auth.cpython-33.pyc +0 -0
  7. pyramid_fullauth/__pycache__/compat.cpython-33.pyc +0 -0
  8. pyramid_fullauth/__pycache__/events.cpython-33.pyc +0 -0
  9. pyramid_fullauth/__pycache__/exceptions.cpython-33.pyc +0 -0
  10. pyramid_fullauth/__pycache__/request.cpython-33.pyc +0 -0
  11. pyramid_fullauth/__pycache__/tools.cpython-33.pyc +0 -0
  12. pyramid_fullauth/compat.py +18 -0
  13. pyramid_fullauth/events.py +0 -1
  14. pyramid_fullauth/models/__pycache__/__init__.cpython-33.pyc +0 -0
  15. pyramid_fullauth/models/extensions/__pycache__/__init__.cpython-33.pyc +0 -0
  16. pyramid_fullauth/models/mixins/__pycache__/__init__.cpython-33.pyc +0 -0
  17. pyramid_fullauth/models/mixins/__pycache__/email.cpython-33.pyc +0 -0
  18. pyramid_fullauth/models/mixins/__pycache__/password.cpython-33.pyc +0 -0
  19. pyramid_fullauth/resources/helpers/social.mako +3 -3
  20. pyramid_fullauth/resources/templates/login.mako +1 -4
  21. pyramid_fullauth/routing/__pycache__/__init__.cpython-33.pyc +0 -0
  22. pyramid_fullauth/routing/__pycache__/predicates.cpython-33.pyc +0 -0
  23. pyramid_fullauth/views/__pycache__/__init__.cpython-33.pyc +0 -0
  24. pyramid_fullauth/views/__pycache__/social.cpython-33.pyc +0 -0
  25. pyramid_fullauth/views/basic/__pycache__/__init__.cpython-33.pyc +0 -0
  26. pyramid_fullauth/views/basic/__pycache__/activate.cpython-33.pyc +0 -0
  27. pyramid_fullauth/views/basic/__pycache__/forbidden.cpython-33.pyc +0 -0
  28. pyramid_fullauth/views/basic/__pycache__/login.cpython-33.pyc +0 -0
  29. pyramid_fullauth/views/basic/__pycache__/logout.cpython-33.pyc +0 -0
  30. pyramid_fullauth/views/basic/__pycache__/register.cpython-33.pyc +0 -0
  31. pyramid_fullauth/views/basic/profile/__pycache__/__init__.cpython-33.pyc +0 -0
  32. pyramid_fullauth/views/basic/profile/__pycache__/email.cpython-33.pyc +0 -0
  33. pyramid_fullauth/views/basic/profile/__pycache__/password.cpython-33.pyc +0 -0
  34. tests/__pycache__/__init__.cpython-33.pyc +0 -0
  35. tests/__pycache__/conftest.cpython-33.pyc +0 -0
  36. tests/__pycache__/tools.cpython-33.pyc +0 -0
  37. tests/conftest.py +1 -12
  38. tests/unit/__pycache__/test_default_settings.cpython-33.pyc +0 -0
  39. tests/unit/__pycache__/test_groupfinder.cpython-33.pyc +0 -0
  40. tests/unit/__pycache__/test_social_view.cpython-33.pyc +0 -0
  41. tests/unit/__pycache__/test_tools.cpython-33.pyc +0 -0
  42. tests/unit/__pycache__/test_user_active.cpython-33.pyc +0 -0
  43. tests/unit/__pycache__/test_user_admin.cpython-33.pyc +0 -0
  44. tests/unit/__pycache__/test_user_email.cpython-33.pyc +0 -0
  45. tests/unit/__pycache__/test_user_password.cpython-33.pyc +0 -0
  46. tests/unit/__pycache__/test_user_providers.cpython-33.pyc +0 -0
  47. tests/unit/__pycache__/test_user_repr.cpython-33.pyc +0 -0
  48. tests/unit/__pycache__/test_validators.cpython-33.pyc +0 -0
  49. tests/unit/test_social_view.py +0 -2
  50. tests/unit/test_user_password.py +1 -1
  51. tests/views/__pycache__/__init__.cpython-33.pyc +0 -0
  52. tests/views/__pycache__/conftest.cpython-33.pyc +0 -0
  53. tests/views/__pycache__/test_activation.cpython-33.pyc +0 -0
  54. tests/views/__pycache__/test_email.cpython-33.pyc +0 -0
  55. tests/views/__pycache__/test_events.cpython-33.pyc +0 -0
  56. tests/views/__pycache__/test_login.cpython-33.pyc +0 -0
  57. tests/views/__pycache__/test_login_social.cpython-33.pyc +0 -0
  58. tests/views/__pycache__/test_logout.cpython-33.pyc +0 -0
  59. tests/views/__pycache__/test_register.cpython-33.pyc +0 -0
  60. tests/views/__pycache__/test_reset.cpython-33.pyc +0 -0
  61. tests/views/test_events.py +1 -10
  62. tests/views/test_login_social.py +11 -18
EGG-INFO/PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: pyramid-fullauth
3
- Version: 0.4.1
3
+ Version: 0.5.0
4
4
  Summary: This package intends to provide full authentication / authorisation
5
5
  implementation for pyramid applications
6
6
  Home-page: https://github.com/fizyk/pyramid_fullauth
@@ -14,6 +14,10 @@ Description: pyramid_fullauth
14
14
  :target: https://pypi.python.org/pypi/pyramid_fullauth/
15
15
  :alt: Latest PyPI version
16
16
 
17
+ .. image:: https://readthedocs.org/projects/pyramid_fullauth/badge/?version=v0.4.1
18
+ :target: https://readthedocs.org/projects/pyramid_fullauth/?badge=v0.4.1
19
+ :alt: Documentation Status
20
+
17
21
  .. image:: https://pypip.in/d/pyramid_fullauth/badge.png
18
22
  :target: https://pypi.python.org/pypi/pyramid_fullauth/
19
23
  :alt: Number of PyPI downloads
@@ -35,17 +39,17 @@ Description: pyramid_fullauth
35
39
  Package status
36
40
  --------------
37
41
 
38
- .. image:: https://travis-ci.org/fizyk/pyramid_fullauth.png?branch=master
42
+ .. image:: https://travis-ci.org/fizyk/pyramid_fullauth.png?branch=v0.4.1
39
43
  :target: https://travis-ci.org/fizyk/pyramid_fullauth
40
44
  :alt: Tests
41
45
 
42
- .. image:: https://coveralls.io/repos/fizyk/pyramid_fullauth/badge.png?branch=master
43
- :target: https://coveralls.io/r/fizyk/pyramid_fullauth?branch=master
46
+ .. image:: https://coveralls.io/repos/fizyk/pyramid_fullauth/badge.png?branch=v0.4.1
47
+ :target: https://coveralls.io/r/fizyk/pyramid_fullauth?branch=v0.4.1
44
48
  :alt: Coverage Status
45
49
 
46
- .. image:: https://requires.io/github/fizyk/pyramid_fullauth/requirements.png?branch=master
47
- :target: https://requires.io/github/fizyk/pyramid_fullauth/requirements/?branch=master
48
- :alt: Requirements Status
50
+ .. image:: https://requires.io/github/fizyk/pyramid_fullauth/requirements.svg?tag=v0.4.1
51
+ :target: https://requires.io/github/fizyk/pyramid_fullauth/requirements/?tag=v0.4.1
52
+ :alt: Requirements Status
49
53
 
50
54
  Package resources
51
55
  -----------------
@@ -73,6 +77,14 @@ Description: pyramid_fullauth
73
77
  CHANGELOG
74
78
  =========
75
79
 
80
+ 0.5.0
81
+ -------
82
+
83
+ - full python3 compatibility, since velruse migrated to py3 enabled requests-oauth
84
+ -require velruse 1.1.1
85
+ - run tests with sqlalchemy 1.0.x
86
+ - small updates to conform with new linters versions embedded in pylama
87
+
76
88
  0.4.1
77
89
  -------
78
90
 
@@ -83,7 +95,7 @@ Description: pyramid_fullauth
83
95
  -------
84
96
 
85
97
  - python 3 compatibility (without oauth2 though)
86
- - cleared use of deprecated :func:`pyramid.security.authenticated_userid` in favour of :attr:`pyramid.request.Request.authenticated_userid`
98
+ - cleared use of deprecated function `pyramid.security.authenticated_userid` in favour of `pyramid.request.Request.authenticated_userid` attribute.
87
99
  - make email fields case insensitive by using hybrid properties and CaseInsensitive comparator for model.
88
100
 
89
101
  0.3.3
EGG-INFO/SOURCES.txt CHANGED
@@ -25,6 +25,7 @@ docs/source/api/request.rst
25
25
  docs/source/api/tools.rst
26
26
  pyramid_fullauth/__init__.py
27
27
  pyramid_fullauth/auth.py
28
+ pyramid_fullauth/compat.py
28
29
  pyramid_fullauth/events.py
29
30
  pyramid_fullauth/exceptions.py
30
31
  pyramid_fullauth/request.py
EGG-INFO/requires.txt CHANGED
@@ -3,6 +3,7 @@ pyramid >=1.4
3
3
  pyramid_mako
4
4
  tzf.pyramid_yml >=1.0
5
5
  pyramid_basemodel>=0.3
6
+ velruse >=1.1.1
6
7
 
7
8
  [docs]
8
9
  sphinx
@@ -11,3 +12,4 @@ sphinx
11
12
  mock
12
13
  pytest_pyramid
13
14
  pytest-cov
15
+ pytest-dbfixtures[mysql,postgresql]
@@ -3,7 +3,6 @@
3
3
  # This module is part of pyramid_fullauth and is released under
4
4
  # the MIT License (MIT): http://opensource.org/licenses/MIT
5
5
  """Fullauth's configuration module."""
6
- import sys
7
6
  import logging
8
7
 
9
8
  from tzf.pyramid_yml import config_defaults
@@ -17,7 +16,7 @@ from pyramid_fullauth.auth import groupfinder
17
16
  from pyramid_fullauth.routing import predicates
18
17
  from pyramid_fullauth.request import login_perform, logout, user
19
18
 
20
- __version__ = '0.4.1'
19
+ __version__ = '0.5.0'
21
20
 
22
21
 
23
22
  logger = logging.getLogger(__name__)
@@ -82,9 +81,9 @@ def includeme(configurator):
82
81
  # scan base views
83
82
  configurator.scan('pyramid_fullauth.views.basic')
84
83
 
85
- # check for the social. (And python 2)
84
+ # check for the social.
86
85
  # If social is not available, we will not turn it on!
87
- if 'social' in fullauth_config and sys.version_info.major == 2:
86
+ if 'social' in fullauth_config:
88
87
  # Velruse init (for social auth)
89
88
 
90
89
  # scan social views
@@ -0,0 +1,18 @@
1
+
2
+ # Copyright (c) 2013 - 2015 by pyramid_fullauth authors and contributors <see AUTHORS file>
3
+ #
4
+ # This module is part of pyramid_fullauth and is released under
5
+ # the MIT License (MIT): http://opensource.org/licenses/MIT
6
+ """pyramid_fullauth's compatibility file for python2 and 3."""
7
+
8
+ import sys
9
+
10
+
11
+ if sys.version_info.major == 2:
12
+ from urllib import urlencode
13
+ from urlparse import urlparse, parse_qs
14
+ else:
15
+ from urllib.parse import urlencode, urlparse, parse_qs
16
+
17
+
18
+ __all__ = ('urlencode', 'urlparse', 'parse_qs')
@@ -236,7 +236,6 @@ class SocialAccountAlreadyConnected(_BaseSocialRegister):
236
236
  """
237
237
  Event raised when social account is already connected to some other user.
238
238
 
239
-
240
239
  Allow to add custom logic, when someone tries to connect social account to
241
240
  second user in application.
242
241
 
@@ -1,6 +1,6 @@
1
1
  ## -*- coding: utf-8 -*-
2
2
  <%doc>
3
- Copyright (c) 2013 - 2014 by pyramid_fullauth authors and contributors <see AUTHORS file>
3
+ Copyright (c) 2013 - 2015 by pyramid_fullauth authors and contributors <see AUTHORS file>
4
4
 
5
5
  This module is part of pyramid_fullauth and is released under
6
6
  the MIT License (MIT): http://opensource.org/licenses/MIT
@@ -9,9 +9,9 @@ the MIT License (MIT): http://opensource.org/licenses/MIT
9
9
  <%def name="social_auth_uri(name, **kw)">
10
10
  <%
11
11
  from velruse import login_url
12
- import urllib
12
+ from pyramid_fullauth.compat import urlencode
13
13
  %>
14
14
  % if name in request.registry['config'].fullauth.social:
15
- ${login_url(request, name) + ('?{0}'.format(urllib.urlencode(kw)) if kw else '')}
15
+ ${login_url(request, name) + ('?{0}'.format(urlencode(kw)) if kw else '')}
16
16
  % endif
17
17
  </%def>
@@ -1,5 +1,4 @@
1
1
  ## -*- coding: utf-8 -*-
2
- <% import sys %>
3
2
  <%doc>
4
3
  Copyright (c) 2013 - 2014 by pyramid_fullauth authors and contributors <see AUTHORS file>
5
4
 
@@ -12,6 +11,4 @@ the MIT License (MIT): http://opensource.org/licenses/MIT
12
11
  <div class="alert alert-error">${_('Error!', domain='pyramid_fullauth')} ${msg}</div>
13
12
  % endif
14
13
  <%include file="_form.login.mako"/>
15
- % if sys.version_info.major == 2:
16
- <%include file="_social.login.mako"/>
17
- % endif
14
+ <%include file="_social.login.mako"/>
Binary file
Binary file
Binary file
tests/conftest.py CHANGED
@@ -1,6 +1,4 @@
1
1
  """Most of the fixtures needed."""
2
- import sys
3
-
4
2
  from mock import Mock
5
3
  import pytest
6
4
 
@@ -14,10 +12,6 @@ from pyramid.compat import text_type
14
12
  from pytest_pyramid import factories
15
13
  import pyramid_basemodel
16
14
 
17
- py2only = pytest.mark.skipif(
18
- sys.version_info.major > 2,
19
- reason='oauth2-python and velruse does not support python3')
20
-
21
15
 
22
16
  @pytest.fixture
23
17
  def web_request():
@@ -40,13 +34,8 @@ def web_request():
40
34
 
41
35
  return request
42
36
 
43
- if sys.version_info.major == 2:
44
- databases = ['sqlite', 'mysql', 'postgresql']
45
- else:
46
- databases = ['sqlite']
47
-
48
37
 
49
- @pytest.fixture(scope='function', params=databases)
38
+ @pytest.fixture(scope='function', params=['sqlite', 'mysql', 'postgresql'])
50
39
  def db_session(request):
51
40
  """SQLAlchemy session."""
52
41
  from pyramid_fullauth.models import Base
@@ -4,10 +4,8 @@ import mock
4
4
  from pyramid.compat import text_type
5
5
 
6
6
  from pyramid_fullauth.views.social import SocialLoginViews
7
- from tests.conftest import py2only
8
7
 
9
8
 
10
- @py2only
11
9
  @pytest.mark.parametrize('profile, email', [
12
10
  (
13
11
  {
@@ -45,7 +45,7 @@ def test_password_empty(db_session, user):
45
45
 
46
46
 
47
47
  def test_set_reset(db_session, user):
48
- """User.set_reset - generates reset key for those who forgot their password. """
48
+ """User.set_reset - generates reset key for those who forgot their password."""
49
49
  user = db_session.merge(user)
50
50
  assert not user.reset_key
51
51
  user.set_reset()
@@ -8,12 +8,7 @@ from pyramid.view import view_config
8
8
  from pyramid.httpexceptions import HTTPFound
9
9
  from sqlalchemy.orm.exc import NoResultFound
10
10
  from pytest_pyramid import factories
11
-
12
- try:
13
- from velruse import AuthenticationComplete
14
- except ImportError:
15
- # py3 version doesn't have social auth
16
- pass
11
+ from velruse import AuthenticationComplete
17
12
 
18
13
 
19
14
  from pyramid_fullauth.models import User
@@ -27,7 +22,6 @@ from pyramid_fullauth.events import (
27
22
  BeforeRegister, AfterRegister
28
23
  )
29
24
  from tests.tools import authenticate, is_user_logged, DEFAULT_USER
30
- from tests.conftest import py2only
31
25
  from tests.views.conftest import mock_translate
32
26
 
33
27
  EVENT_PATH = '/event?event={0.__name__}'
@@ -347,7 +341,6 @@ def aftersocialregister_config(evented_config):
347
341
  aftersocialregister_app = factories.pyramid_app('aftersocialregister_config')
348
342
 
349
343
 
350
- @py2only
351
344
  def test_aftersocialregister(aftersocialregister_config, aftersocialregister_app, db_session):
352
345
  """Register fresh user and logs him in and check response if redirect from AfterSocialRegister."""
353
346
  profile = {
@@ -389,7 +382,6 @@ def aftersociallogin_config(evented_config):
389
382
  aftersociallogin_app = factories.pyramid_app('aftersociallogin_config')
390
383
 
391
384
 
392
- @py2only
393
385
  def test_aftersociallogin(aftersociallogin_config, aftersociallogin_app, db_session):
394
386
  """Register fresh user and logs him in and check response if redirect from AfterSocialLogIn."""
395
387
  profile = {
@@ -432,7 +424,6 @@ def alreadyconnected_config(evented_config):
432
424
  alreadyconnected_app = factories.pyramid_app('alreadyconnected_config')
433
425
 
434
426
 
435
- @py2only
436
427
  def test_alreadyconnected(alreadyconnected_config, alreadyconnected_app, facebook_user, db_session):
437
428
  """Try to connect facebook account to logged in user used by other user check redirect from SocialAccountAlreadyConnected."""
438
429
  # this user will be logged and trying to connect facebook's user account.
@@ -4,35 +4,34 @@ from pyramid import testing
4
4
  from pyramid.compat import text_type
5
5
  from mock import MagicMock
6
6
 
7
- try:
8
- from velruse import AuthenticationComplete
9
- from pyramid_fullauth.views.social import SocialLoginViews
10
- except ImportError:
11
- # tests will be skipped anyway
12
- pass
7
+ from velruse import AuthenticationComplete
8
+ from pyramid_fullauth.views.social import SocialLoginViews
13
9
 
14
10
  from pyramid_fullauth.models import User
11
+ from pyramid_fullauth.compat import urlparse, parse_qs
15
12
 
16
- from tests.conftest import py2only
17
13
  from tests.views.conftest import mock_translate
18
14
 
19
15
 
20
- @py2only
21
16
  def test_social_login_link(social_app):
22
17
  """Login:Form displayed social form."""
23
18
  res = social_app.get('/login')
24
19
  assert ('Connect with facebook</a>' in res.body.decode('unicode_escape'))
25
20
 
26
21
 
27
- @py2only
28
22
  def test_social_click_link(social_app):
29
23
  """Click social login link."""
30
24
  res = social_app.get('/login/facebook?scope=email%2Coffline_access', status=302)
31
- assert (res.headers['Location'].startswith(
32
- 'https://www.facebook.com/dialog/oauth/?scope=email%2Coffline_access&state='))
25
+ redirect = urlparse(res.headers['Location'])
26
+ query = parse_qs(redirect.query)
27
+ assert redirect.netloc == 'www.facebook.com', "We should redirect user to facebook"
28
+ assert redirect.path == '/dialog/oauth/', "Path should be oauth"
29
+ assert 'redirect_uri' in query
30
+ assert 'scope' in query
31
+ assert query['redirect_uri'] == ['http://localhost/login/facebook/callback']
32
+ assert query['scope'] == ['email,offline_access']
33
33
 
34
34
 
35
- @py2only
36
35
  def test_social_login_register(social_config, db_session):
37
36
  """Register fresh user and logs him in."""
38
37
  profile = {
@@ -65,7 +64,6 @@ def test_social_login_register(social_config, db_session):
65
64
  assert user.provider_id('facebook') == profile['accounts'][0]['userid']
66
65
 
67
66
 
68
- @py2only
69
67
  def test_login_different_social_account(social_config, db_session, facebook_user):
70
68
  """
71
69
  Login with different social account than connected from same provider.
@@ -101,7 +99,6 @@ def test_login_different_social_account(social_config, db_session, facebook_user
101
99
  assert facebook_user.provider_id('facebook') is not profile['accounts'][0]['userid']
102
100
 
103
101
 
104
- @py2only
105
102
  def test_login_social_connect(social_config, active_user, db_session):
106
103
  """Connect and logs user in."""
107
104
  user = db_session.merge(active_user)
@@ -130,7 +127,6 @@ def test_login_social_connect(social_config, active_user, db_session):
130
127
  assert out == {'status': True}
131
128
 
132
129
 
133
- @py2only
134
130
  def test_logged_social_connect_account(social_config, active_user, db_session):
135
131
  """Connect facebook account to logged in user."""
136
132
  user = db_session.merge(active_user)
@@ -163,7 +159,6 @@ def test_logged_social_connect_account(social_config, active_user, db_session):
163
159
  assert user.provider_id('facebook') == profile['accounts'][0]['userid']
164
160
 
165
161
 
166
- @py2only
167
162
  def test_logged_social_connect_self(social_config, facebook_user, db_session):
168
163
  """Connect self."""
169
164
  user = db_session.merge(facebook_user)
@@ -200,7 +195,6 @@ def test_logged_social_connect_self(social_config, facebook_user, db_session):
200
195
  assert user.provider_id('facebook') == profile['accounts'][0]['userid']
201
196
 
202
197
 
203
- @py2only
204
198
  def test_logged_social_connect_second_account(social_config, facebook_user, db_session):
205
199
  """Connect second facebook account to logged in user."""
206
200
  user = db_session.merge(facebook_user)
@@ -239,7 +233,6 @@ def test_logged_social_connect_second_account(social_config, facebook_user, db_s
239
233
  assert user.provider_id('facebook') is not profile['accounts'][0]['userid']
240
234
 
241
235
 
242
- @py2only
243
236
  def test_logged_social_connect_used_account(social_config, facebook_user, db_session):
244
237
  """Try to connect facebook account to logged in user used by other user."""
245
238
  # this user will be logged and trying to connect facebook's user account.