pyramid-fullauth 0.4.0__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.
- EGG-INFO/PKG-INFO +26 -8
- EGG-INFO/SOURCES.txt +1 -0
- EGG-INFO/requires.txt +4 -2
- EGG-INFO/top_level.txt +1 -1
- pyramid_fullauth/__init__.py +3 -4
- pyramid_fullauth/__pycache__/__init__.cpython-33.pyc +0 -0
- pyramid_fullauth/__pycache__/auth.cpython-33.pyc +0 -0
- pyramid_fullauth/__pycache__/compat.cpython-33.pyc +0 -0
- pyramid_fullauth/__pycache__/events.cpython-33.pyc +0 -0
- pyramid_fullauth/__pycache__/exceptions.cpython-33.pyc +0 -0
- pyramid_fullauth/__pycache__/request.cpython-33.pyc +0 -0
- pyramid_fullauth/__pycache__/tools.cpython-33.pyc +0 -0
- pyramid_fullauth/compat.py +18 -0
- pyramid_fullauth/events.py +0 -1
- pyramid_fullauth/models/__pycache__/__init__.cpython-33.pyc +0 -0
- pyramid_fullauth/models/extensions/__pycache__/__init__.cpython-33.pyc +0 -0
- pyramid_fullauth/models/mixins/__pycache__/__init__.cpython-33.pyc +0 -0
- pyramid_fullauth/models/mixins/__pycache__/email.cpython-33.pyc +0 -0
- pyramid_fullauth/models/mixins/__pycache__/password.cpython-33.pyc +0 -0
- pyramid_fullauth/resources/helpers/social.mako +3 -3
- pyramid_fullauth/resources/locale/pyramid_fullauth.pot +23 -23
- pyramid_fullauth/resources/templates/login.mako +1 -4
- pyramid_fullauth/routing/__pycache__/__init__.cpython-33.pyc +0 -0
- pyramid_fullauth/routing/__pycache__/predicates.cpython-33.pyc +0 -0
- pyramid_fullauth/views/__pycache__/__init__.cpython-33.pyc +0 -0
- pyramid_fullauth/views/__pycache__/social.cpython-33.pyc +0 -0
- pyramid_fullauth/views/basic/__pycache__/__init__.cpython-33.pyc +0 -0
- pyramid_fullauth/views/basic/__pycache__/activate.cpython-33.pyc +0 -0
- pyramid_fullauth/views/basic/__pycache__/forbidden.cpython-33.pyc +0 -0
- pyramid_fullauth/views/basic/__pycache__/login.cpython-33.pyc +0 -0
- pyramid_fullauth/views/basic/__pycache__/logout.cpython-33.pyc +0 -0
- pyramid_fullauth/views/basic/__pycache__/register.cpython-33.pyc +0 -0
- pyramid_fullauth/views/basic/profile/__pycache__/__init__.cpython-33.pyc +0 -0
- pyramid_fullauth/views/basic/profile/__pycache__/email.cpython-33.pyc +0 -0
- pyramid_fullauth/views/basic/profile/__pycache__/password.cpython-33.pyc +0 -0
- pyramid_fullauth/views/basic/profile/password.py +1 -1
- tests/__pycache__/__init__.cpython-33.pyc +0 -0
- tests/__pycache__/conftest.cpython-33.pyc +0 -0
- tests/__pycache__/tools.cpython-33.pyc +0 -0
- tests/conftest.py +3 -13
- tests/unit/__pycache__/test_default_settings.cpython-33.pyc +0 -0
- tests/unit/__pycache__/test_groupfinder.cpython-33.pyc +0 -0
- tests/unit/__pycache__/test_social_view.cpython-33.pyc +0 -0
- tests/unit/__pycache__/test_tools.cpython-33.pyc +0 -0
- tests/unit/__pycache__/test_user_active.cpython-33.pyc +0 -0
- tests/unit/__pycache__/test_user_admin.cpython-33.pyc +0 -0
- tests/unit/__pycache__/test_user_email.cpython-33.pyc +0 -0
- tests/unit/__pycache__/test_user_password.cpython-33.pyc +0 -0
- tests/unit/__pycache__/test_user_providers.cpython-33.pyc +0 -0
- tests/unit/__pycache__/test_user_repr.cpython-33.pyc +0 -0
- tests/unit/__pycache__/test_validators.cpython-33.pyc +0 -0
- tests/unit/test_social_view.py +0 -2
- tests/unit/test_user_password.py +1 -1
- tests/views/__pycache__/__init__.cpython-33.pyc +0 -0
- tests/views/__pycache__/conftest.cpython-33.pyc +0 -0
- tests/views/__pycache__/test_activation.cpython-33.pyc +0 -0
- tests/views/__pycache__/test_email.cpython-33.pyc +0 -0
- tests/views/__pycache__/test_events.cpython-33.pyc +0 -0
- tests/views/__pycache__/test_login.cpython-33.pyc +0 -0
- tests/views/__pycache__/test_login_social.cpython-33.pyc +0 -0
- tests/views/__pycache__/test_logout.cpython-33.pyc +0 -0
- tests/views/__pycache__/test_register.cpython-33.pyc +0 -0
- tests/views/__pycache__/test_reset.cpython-33.pyc +0 -0
- tests/views/test_events.py +1 -10
- tests/views/test_login_social.py +11 -18
- tests/views/test_reset.py +1 -1
EGG-INFO/PKG-INFO
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 1.1
|
|
2
2
|
Name: pyramid-fullauth
|
|
3
|
-
Version: 0.
|
|
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=
|
|
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=
|
|
43
|
-
:target: https://coveralls.io/r/fizyk/pyramid_fullauth?branch=
|
|
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.
|
|
47
|
-
|
|
48
|
-
|
|
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,11 +77,25 @@ 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
|
+
|
|
88
|
+
0.4.1
|
|
89
|
+
-------
|
|
90
|
+
|
|
91
|
+
- fixed spelling for error message when user does not exist while trying to reset password.
|
|
92
|
+
- require pyramid_basemodel at least version 0.3
|
|
93
|
+
|
|
76
94
|
0.4.0
|
|
77
95
|
-------
|
|
78
96
|
|
|
79
97
|
- python 3 compatibility (without oauth2 though)
|
|
80
|
-
- cleared use of deprecated
|
|
98
|
+
- cleared use of deprecated function `pyramid.security.authenticated_userid` in favour of `pyramid.request.Request.authenticated_userid` attribute.
|
|
81
99
|
- make email fields case insensitive by using hybrid properties and CaseInsensitive comparator for model.
|
|
82
100
|
|
|
83
101
|
0.3.3
|
EGG-INFO/SOURCES.txt
CHANGED
EGG-INFO/requires.txt
CHANGED
|
@@ -2,7 +2,8 @@ pyramid_localize
|
|
|
2
2
|
pyramid >=1.4
|
|
3
3
|
pyramid_mako
|
|
4
4
|
tzf.pyramid_yml >=1.0
|
|
5
|
-
pyramid_basemodel
|
|
5
|
+
pyramid_basemodel>=0.3
|
|
6
|
+
velruse >=1.1.1
|
|
6
7
|
|
|
7
8
|
[docs]
|
|
8
9
|
sphinx
|
|
@@ -10,4 +11,5 @@ sphinx
|
|
|
10
11
|
[tests]
|
|
11
12
|
mock
|
|
12
13
|
pytest_pyramid
|
|
13
|
-
pytest-cov
|
|
14
|
+
pytest-cov
|
|
15
|
+
pytest-dbfixtures[mysql,postgresql]
|
EGG-INFO/top_level.txt
CHANGED
pyramid_fullauth/__init__.py
CHANGED
|
@@ -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.
|
|
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.
|
|
84
|
+
# check for the social.
|
|
86
85
|
# If social is not available, we will not turn it on!
|
|
87
|
-
if 'social' in fullauth_config
|
|
86
|
+
if 'social' in fullauth_config:
|
|
88
87
|
# Velruse init (for social auth)
|
|
89
88
|
|
|
90
89
|
# scan social views
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -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')
|
pyramid_fullauth/events.py
CHANGED
|
@@ -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
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## -*- coding: utf-8 -*-
|
|
2
2
|
<%doc>
|
|
3
|
-
Copyright (c) 2013 -
|
|
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
|
|
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(
|
|
15
|
+
${login_url(request, name) + ('?{0}'.format(urlencode(kw)) if kw else '')}
|
|
16
16
|
% endif
|
|
17
17
|
</%def>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# Translations template for pyramid_fullauth.
|
|
2
|
-
# Copyright (C)
|
|
2
|
+
# Copyright (C) 2015 ORGANIZATION
|
|
3
3
|
# This file is distributed under the same license as the pyramid_fullauth
|
|
4
4
|
# project.
|
|
5
|
-
# FIRST AUTHOR <EMAIL@ADDRESS>,
|
|
5
|
+
# FIRST AUTHOR <EMAIL@ADDRESS>, 2015.
|
|
6
6
|
#
|
|
7
7
|
#, fuzzy
|
|
8
8
|
msgid ""
|
|
9
9
|
msgstr ""
|
|
10
|
-
"Project-Id-Version: pyramid_fullauth 0.
|
|
10
|
+
"Project-Id-Version: pyramid_fullauth 0.4.0\n"
|
|
11
11
|
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
|
12
|
-
"POT-Creation-Date:
|
|
12
|
+
"POT-Creation-Date: 2015-02-10 00:36+0100\n"
|
|
13
13
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
14
14
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
15
15
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
@@ -18,16 +18,16 @@ msgstr ""
|
|
|
18
18
|
"Content-Transfer-Encoding: 8bit\n"
|
|
19
19
|
"Generated-By: Babel 1.3\n"
|
|
20
20
|
|
|
21
|
-
#: pyramid_fullauth/tools.py:
|
|
21
|
+
#: pyramid_fullauth/tools.py:50
|
|
22
22
|
msgid "Please enter your password"
|
|
23
23
|
msgstr ""
|
|
24
24
|
|
|
25
|
-
#: pyramid_fullauth/tools.py:
|
|
25
|
+
#: pyramid_fullauth/tools.py:56
|
|
26
26
|
msgid "Password is too short"
|
|
27
27
|
msgstr ""
|
|
28
28
|
|
|
29
|
-
#: pyramid_fullauth/tools.py:
|
|
30
|
-
#: pyramid_fullauth/views/basic/profile/password.py:
|
|
29
|
+
#: pyramid_fullauth/tools.py:64
|
|
30
|
+
#: pyramid_fullauth/views/basic/profile/password.py:123
|
|
31
31
|
msgid "password-mismatch"
|
|
32
32
|
msgstr ""
|
|
33
33
|
|
|
@@ -100,7 +100,7 @@ msgid "Change your email"
|
|
|
100
100
|
msgstr ""
|
|
101
101
|
|
|
102
102
|
#: pyramid_fullauth/resources/templates/email_change.mako:15
|
|
103
|
-
#: pyramid_fullauth/resources/templates/login.mako:
|
|
103
|
+
#: pyramid_fullauth/resources/templates/login.mako:12
|
|
104
104
|
#: pyramid_fullauth/resources/templates/register.mako:13
|
|
105
105
|
#: pyramid_fullauth/resources/templates/reset.mako:15
|
|
106
106
|
#: pyramid_fullauth/resources/templates/reset.proceed.mako:14
|
|
@@ -120,7 +120,7 @@ msgstr ""
|
|
|
120
120
|
msgid "Welcome, to pyramid_fullauth!"
|
|
121
121
|
msgstr ""
|
|
122
122
|
|
|
123
|
-
#: pyramid_fullauth/resources/templates/login.mako:
|
|
123
|
+
#: pyramid_fullauth/resources/templates/login.mako:10
|
|
124
124
|
msgid "Please, log in"
|
|
125
125
|
msgstr ""
|
|
126
126
|
|
|
@@ -149,23 +149,23 @@ msgstr ""
|
|
|
149
149
|
msgid "Recover your password - choose new password"
|
|
150
150
|
msgstr ""
|
|
151
151
|
|
|
152
|
-
#: pyramid_fullauth/views/social.py:
|
|
152
|
+
#: pyramid_fullauth/views/social.py:139
|
|
153
153
|
msgid "Your account is already connected to other ${provider} account."
|
|
154
154
|
msgstr ""
|
|
155
155
|
|
|
156
|
-
#: pyramid_fullauth/views/social.py:
|
|
156
|
+
#: pyramid_fullauth/views/social.py:146
|
|
157
157
|
msgid "Your account has been connected to ${provider} account."
|
|
158
158
|
msgstr ""
|
|
159
159
|
|
|
160
|
-
#: pyramid_fullauth/views/social.py:
|
|
160
|
+
#: pyramid_fullauth/views/social.py:152
|
|
161
161
|
msgid "This ${provider} account is already connected with other account."
|
|
162
162
|
msgstr ""
|
|
163
163
|
|
|
164
|
-
#: pyramid_fullauth/views/basic/forbidden.py:
|
|
164
|
+
#: pyramid_fullauth/views/basic/forbidden.py:38
|
|
165
165
|
msgid "forbidden-notallowed"
|
|
166
166
|
msgstr ""
|
|
167
167
|
|
|
168
|
-
#: pyramid_fullauth/views/basic/forbidden.py:
|
|
168
|
+
#: pyramid_fullauth/views/basic/forbidden.py:43
|
|
169
169
|
msgid "forbidden-login"
|
|
170
170
|
msgstr ""
|
|
171
171
|
|
|
@@ -178,35 +178,35 @@ msgid "Already logged in!"
|
|
|
178
178
|
msgstr ""
|
|
179
179
|
|
|
180
180
|
#: pyramid_fullauth/views/basic/login.py:95
|
|
181
|
-
#: pyramid_fullauth/views/basic/login.py:
|
|
181
|
+
#: pyramid_fullauth/views/basic/login.py:126
|
|
182
182
|
msgid "Wrong e-mail or password."
|
|
183
183
|
msgstr ""
|
|
184
184
|
|
|
185
|
-
#: pyramid_fullauth/views/basic/register.py:
|
|
185
|
+
#: pyramid_fullauth/views/basic/register.py:39
|
|
186
186
|
msgid "You have an error in your registration form"
|
|
187
187
|
msgstr ""
|
|
188
188
|
|
|
189
|
-
#: pyramid_fullauth/views/basic/register.py:
|
|
189
|
+
#: pyramid_fullauth/views/basic/register.py:52
|
|
190
190
|
msgid "You have successfully registered"
|
|
191
191
|
msgstr ""
|
|
192
192
|
|
|
193
|
-
#: pyramid_fullauth/views/basic/register.py:
|
|
193
|
+
#: pyramid_fullauth/views/basic/register.py:76
|
|
194
194
|
msgid "User with given e-mail already exists!"
|
|
195
195
|
msgstr ""
|
|
196
196
|
|
|
197
|
-
#: pyramid_fullauth/views/basic/profile/email.py:
|
|
197
|
+
#: pyramid_fullauth/views/basic/profile/email.py:45
|
|
198
198
|
msgid "User with this email exists"
|
|
199
199
|
msgstr ""
|
|
200
200
|
|
|
201
|
-
#: pyramid_fullauth/views/basic/profile/email.py:
|
|
201
|
+
#: pyramid_fullauth/views/basic/profile/email.py:61
|
|
202
202
|
msgid "E-mail is empty"
|
|
203
203
|
msgstr ""
|
|
204
204
|
|
|
205
|
-
#: pyramid_fullauth/views/basic/profile/email.py:
|
|
205
|
+
#: pyramid_fullauth/views/basic/profile/email.py:67
|
|
206
206
|
msgid "Incorrect e-mail format"
|
|
207
207
|
msgstr ""
|
|
208
208
|
|
|
209
|
-
#: pyramid_fullauth/views/basic/profile/email.py:
|
|
209
|
+
#: pyramid_fullauth/views/basic/profile/email.py:74
|
|
210
210
|
msgid "We sent you email to activate your new email address"
|
|
211
211
|
msgstr ""
|
|
212
212
|
|
|
@@ -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
|
-
|
|
16
|
-
<%include file="_social.login.mako"/>
|
|
17
|
-
% endif
|
|
14
|
+
<%include file="_social.login.mako"/>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -46,7 +46,7 @@ class PasswordResetView(BaseView):
|
|
|
46
46
|
except NoResultFound:
|
|
47
47
|
return {'status': False,
|
|
48
48
|
'msg': self.request._('user-not-exists',
|
|
49
|
-
default='User does not
|
|
49
|
+
default='User does not exist',
|
|
50
50
|
domain='pyramid_fullauth'),
|
|
51
51
|
'csrf_token': csrf_token}
|
|
52
52
|
|
|
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=
|
|
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
|
|
@@ -62,7 +51,8 @@ def db_session(request):
|
|
|
62
51
|
|
|
63
52
|
engine = create_engine(connection, echo=False, poolclass=NullPool)
|
|
64
53
|
pyramid_basemodel.Session = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
|
|
65
|
-
pyramid_basemodel.bind_engine(
|
|
54
|
+
pyramid_basemodel.bind_engine(
|
|
55
|
+
engine, pyramid_basemodel.Session, should_create=True, should_drop=True)
|
|
66
56
|
|
|
67
57
|
def destroy():
|
|
68
58
|
transaction.commit()
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
tests/unit/test_social_view.py
CHANGED
tests/unit/test_user_password.py
CHANGED
|
@@ -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()
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
tests/views/test_events.py
CHANGED
|
@@ -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.
|
tests/views/test_login_social.py
CHANGED
|
@@ -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
|
-
|
|
8
|
-
|
|
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
|
-
|
|
32
|
-
|
|
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.
|
tests/views/test_reset.py
CHANGED
|
@@ -40,7 +40,7 @@ def test_reset_email_not_exists(user, db_session, default_app):
|
|
|
40
40
|
res = default_app.get('/password/reset')
|
|
41
41
|
res.form['email'] = text_type('wrong@example.com')
|
|
42
42
|
res = res.form.submit()
|
|
43
|
-
assert 'Error! User does not
|
|
43
|
+
assert 'Error! User does not exist' in res
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
def test_reset_proceed(user, db_session, default_app):
|