Skip to content

Commit 4aed44a

Browse files
authored
Merge pull request #68 from caravancoop/feature/release
Release v0.10
2 parents 4c13c8b + faea19c commit 4aed44a

26 files changed

+552
-112
lines changed

.circleci/config.yml

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,98 +6,100 @@ workflows:
66
jobs:
77
- test-py37
88
- test-py36
9-
- test-py27
109
- check
1110

1211
jobs:
1312

1413
test-py37:
1514
docker:
1615
- image: circleci/python:3.7
16+
- image: circleci/postgres:10.5
17+
environment:
18+
POSTGRES_DB: circle_test
19+
POSTGRES_USER: testapp
20+
POSTGRES_PASSWORD: ""
1721
working_directory: ~/rest-auth-toolkit
22+
environment:
23+
DATABASE_URL: postgres://testapp@localhost/circle_test
1824
steps:
1925
- checkout
2026
- restore_cache:
21-
key: rest-auth-toolkit-py37-v2
27+
keys:
28+
- rest-auth-toolkit-py37-v7-{{ arch }}-{{ checksum "requirements-test.txt" }}-{{ checksum "demo/requirements.txt" }}
29+
- rest-auth-toolkit-py37-v7-{{ arch }}-{{ checksum "requirements-test.txt" }}
30+
- rest-auth-toolkit-py37-v7-{{ arch }}-
2231
- run:
2332
name: Install CI tools
2433
command: |
2534
python3.7 -m venv venv
2635
venv/bin/pip install tox
2736
- run:
2837
name: Test with Python 3.7
29-
command: venv/bin/tox -e py37
38+
command: venv/bin/tox -e py37 -- --junitxml=~/reports/tox/coverage.xml
39+
- run:
40+
name: Check coverage with Python 3.7
41+
command: venv/bin/tox -e coverage
3042
- save_cache:
31-
key: rest-auth-toolkit-py37-v2
43+
key: rest-auth-toolkit-py37-v7-{{ arch }}-{{ checksum "requirements-test.txt" }}-{{ checksum "demo/requirements.txt" }}
3244
paths:
3345
- venv
3446
- .tox
47+
- store_test_results:
48+
path: ~/reports
3549

3650
test-py36:
3751
docker:
3852
- image: circleci/python:3.6
53+
- image: circleci/postgres:10.5
54+
environment:
55+
POSTGRES_DB: circle_test
56+
POSTGRES_USER: testapp
57+
POSTGRES_PASSWORD: ""
3958
working_directory: ~/rest-auth-toolkit
59+
environment:
60+
DATABASE_URL: postgres://testapp@localhost/circle_test
4061
steps:
4162
- checkout
4263
- restore_cache:
43-
key: rest-auth-toolkit-py36-v2
64+
keys:
65+
- rest-auth-toolkit-py36-v4-{{ arch }}-{{ checksum "requirements-test.txt" }}-{{ checksum "demo/requirements.txt" }}
66+
- rest-auth-toolkit-py36-v4-{{ arch }}-{{ checksum "requirements-test.txt" }}-{{ checksum "demo/requirements.txt" }}
67+
- rest-auth-toolkit-py36-v4-{{ arch }}-{{ checksum "requirements-test.txt" }}
68+
- rest-auth-toolkit-py36-v4-{{ arch }}-
4469
- run:
4570
name: Install CI tools
4671
command: |
4772
python3.6 -m venv venv
4873
venv/bin/pip install tox
4974
- run:
5075
name: Test with Python 3.6
51-
command: venv/bin/tox -e py36
76+
command: venv/bin/tox -e py36 -- --junitxml=~/reports/tox/coverage.xml
5277
- save_cache:
53-
key: rest-auth-toolkit-py36-v2
54-
paths:
55-
- venv
56-
- .tox
57-
58-
test-py27:
59-
docker:
60-
# This image contains Python 3.6 (to install flit) and 2.7 (to run tests)
61-
- image: circleci/python:3.6
62-
working_directory: ~/rest-auth-toolkit
63-
steps:
64-
- checkout
65-
- restore_cache:
66-
key: rest-auth-toolkit-py27-v2
67-
- run:
68-
name: Install CI tools
69-
command: |
70-
python3.6 -m venv venv
71-
venv/bin/pip install tox
72-
- run:
73-
name: Test with Python 2.7
74-
command: |
75-
venv/bin/tox --sdistonly
76-
venv/bin/tox -e py27
77-
- save_cache:
78-
key: rest-auth-toolkit-py27-v2
78+
key: rest-auth-toolkit-py36-v4-{{ arch }}-{{ checksum "requirements-test.txt" }}-{{ checksum "demo/requirements.txt" }}
7979
paths:
8080
- venv
8181
- .tox
82+
- store_test_results:
83+
path: ~/reports
8284

8385
check:
8486
docker:
85-
- image: circleci/python:3.6
87+
- image: circleci/python:3.7
8688
working_directory: ~/rest-auth-toolkit
8789
steps:
8890
- checkout
8991
- restore_cache:
90-
key: rest-auth-toolkit-check-v3
92+
key: rest-auth-toolkit-check-v6
9193
- run:
9294
name: Install CI tools
9395
command: |
94-
python3.6 -m venv venv
96+
python3.7 -m venv venv
9597
venv/bin/pip install tox
9698
- run:
9799
name: Check packaging and dependencies
98100
command: venv/bin/tox -e pkg
99101
- save_cache:
100-
key: rest-auth-toolkit-check-v3
102+
key: rest-auth-toolkit-check-v6
101103
paths:
102104
- venv
103105
- .tox

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ __pycache__
44
/demo/.env
55

66
# Test artifacts
7-
/.cache/
7+
/.pytest_cache/
8+
/.coverage
89
/.tox/
910
/venv/
1011

CHANGELOG.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Changelog for Rest-Framework-Auth-Toolkit
2+
3+
4+
## v0.10
5+
6+
Django password validators are now applied during signup.
7+
8+
Facebook login is fixed (silent error in previous version due to API change).
9+
10+
Partial test coverage.
11+
12+
API docs for the demo app.
13+
14+
### Upgrade notes
15+
16+
Python 3 is required!
17+
18+
19+
## v0.9
20+
21+
Run tests and demo with Python 3.7 and Django 2.0.
22+
23+
Package library with flit.
24+
25+
### Upgrade notes
26+
27+
The facepy dependency is now optional. Depend on
28+
`rest-framework-auth-toolkit[facebook]` to have it automatically installed.
29+
30+
31+
## v0.8
32+
33+
Set up internationalization.
34+
35+
36+
## v0.7
37+
38+
Added abstract base user model, with email as username.
39+
40+
41+
## v0.6
42+
43+
It is now possible to use login without signup.
44+
45+
46+
## v0.5
47+
48+
First published version.
49+
50+
Includes views for signup (with email confirmation), login and logout.
51+
A demo app shows how to integrate and configure the library.

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,18 @@ See the [demo](demo/) app for example usage.
2525

2626
⚠️ This library is not stable yet, make sure to pin your dependencies.
2727
Recommended form: `rest-framework-auth-toolkit == 0.9.*`
28+
29+
See the [changelog](CHANGELOG.md) for breaking changes.
30+
31+
32+
## Contributing
33+
34+
To run tests:
35+
36+
```
37+
export DATABASE_URL=postgres://ratk@localhost:5432/ratk
38+
tox
39+
```
40+
41+
You will have to create the `ratk` role first, as well as
42+
the `ratk` and `test_ratk` databases.

demo/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
This is a minimal Django project that shows how to use
44
the package and helps checking if changes break usage.
55

6+
This app is also used by the automated tests.
7+
8+
69
## How to install
710

811
Run this command once from the repository root:
@@ -26,7 +29,7 @@ Define the environment variables needed by the app:
2629

2730
```
2831
export DEMO_FACEBOOK_APP_ID="..."
29-
export DEMO_FACEBOOK_SECRET_KEY="..."
32+
export DEMO_FACEBOOK_APP_SECRET_KEY="..."
3033
```
3134

3235
(using a [virtualenvwrapper hook](https://virtualenvwrapper.readthedocs.io/en/latest/scripts.html#postactivate)
@@ -38,3 +41,5 @@ You can then run Django commands:
3841
python manage.py migrate
3942
python manage.py runserver
4043
```
44+
45+
Then head on to `http://localhost:8000/api/` to see the endpoints available.

demo/demo/accounts/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class EmailConfirmationAdmin(admin.ModelAdmin):
1818

1919

2020
class APITokenAdmin(admin.ModelAdmin):
21-
list_display = ('key', 'user', 'created')
21+
list_display = ('__str__', 'created')
2222
ordering = ('user', '-created')
2323
date_hierarchy = 'created'
2424
readonly_fields = ('key', 'created')

demo/demo/settings.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,32 @@
22

33
import os
44

5+
from django.core.management.utils import get_random_secret_key
6+
7+
import dj_database_url
8+
59
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
610

711
# Quick-start development settings - unsuitable for production
812
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
913

14+
if os.getenv('RAT_TESTING'):
15+
os.environ['DEMO_SECRET_KEY'] = get_random_secret_key()
16+
os.environ['DEMO_FACEBOOK_APP_ID'] = 'fb app id'
17+
os.environ['DEMO_FACEBOOK_APP_SECRET_KEY'] = 'fb app key'
18+
19+
1020
SECRET_KEY = os.getenv('DEMO_SECRET_KEY',
1121
'1(9v73@)*ws6i(v_i5*_4ty^+ji0@7u($6onk7pt-_ncxkqs@@')
22+
1223
DEBUG = True
1324

1425
FACEBOOK_APP_ID = os.environ['DEMO_FACEBOOK_APP_ID']
15-
FACEBOOK_APP_SECRET_KEY = os.environ['DEMO_FACEBOOK_SECRET_KEY']
26+
FACEBOOK_APP_SECRET_KEY = os.environ['DEMO_FACEBOOK_APP_SECRET_KEY']
27+
28+
DATABASES = {
29+
'default': dj_database_url.parse(os.environ['DATABASE_URL']),
30+
}
1631

1732
SITE_ID = 1
1833
ROOT_URLCONF = 'demo.urls'
@@ -49,14 +64,6 @@
4964
]
5065

5166

52-
DATABASES = {
53-
'default': {
54-
'ENGINE': 'django.db.backends.sqlite3',
55-
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
56-
}
57-
}
58-
59-
6067
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
6168

6269

@@ -102,8 +109,9 @@
102109
'DEFAULT_AUTHENTICATION_CLASSES': [
103110
# This is the real authn policy for API clients
104111
'demo.accounts.authentication.APITokenAuthentication',
105-
# Allow using the browsable API for protected resources
106-
'rest_framework.authentication.SessionAuthentication',
112+
],
113+
'DEFAULT_RENDERER_CLASSES': [
114+
'rest_framework.renderers.JSONRenderer',
107115
],
108116
'DEFAULT_PERMISSION_CLASSES': [
109117
'rest_framework.permissions.IsAuthenticated',

demo/demo/urls.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@
33
from django.urls import include, path
44
from django.contrib import admin
55

6+
from rest_framework.documentation import include_docs_urls
7+
from rest_framework.renderers import DocumentationRenderer
8+
69
from rest_auth_toolkit.views import FacebookLoginView, LoginView, LogoutView, SignupView
710

811

12+
class GoAwayRenderer(DocumentationRenderer):
13+
# Hide unwanted coreapi code snippets
14+
languages = []
15+
16+
917
auth_urlpatterns = [
1018
path('signup/', SignupView.as_view(), name='signup'),
1119
path('login/', LoginView.as_view(), name='login'),
@@ -15,6 +23,8 @@
1523

1624
api_urlpatterns = [
1725
path('account/', include('demo.accounts.urls')),
26+
path('', include_docs_urls(title='Demo API', permission_classes=[],
27+
renderer_classes=[GoAwayRenderer])),
1828
path('', include((auth_urlpatterns, 'auth'))),
1929
]
2030

demo/requirements.in

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
pip-tools
22

3-
django == 2.0.*
3+
django == 2.1.*
44
djangorestframework
55
django-debug-toolbar
6+
dj-database-url
7+
psycopg2
68

79
django-model-utils
810
django-shortuuidfield
@@ -14,6 +16,5 @@ django-shortuuidfield
1416
# contains all transitive dependencies
1517
facepy
1618

17-
# for the browsable API
18-
markdown
19-
pygments
19+
# API docs
20+
coreapi

0 commit comments

Comments
 (0)