Skip to content

Commit 9331606

Browse files
committed
merge upstream
2 parents 87b2ec1 + 4eced47 commit 9331606

31 files changed

+375
-152
lines changed

.circleci/config.yml

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,28 @@ 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:9.6-alpine
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-v6-{{ arch }}-{{ checksum "requirements-test.txt" }}-{{ checksum "demo/requirements.txt" }}
29+
- rest-auth-toolkit-py37-v6-{{ arch }}-{{ checksum "requirements-test.txt" }}
30+
- rest-auth-toolkit-py37-v6-{{ arch }}-
2231
- run:
2332
name: Install CI tools
2433
command: |
@@ -27,20 +36,34 @@ jobs:
2736
- run:
2837
name: Test with Python 3.7
2938
command: venv/bin/tox -e py37
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-v6-{{ arch }}-{{ checksum "requirements-test.txt" }}-{{ checksum "demo/requirements.txt" }}
3244
paths:
3345
- venv
3446
- .tox
3547

3648
test-py36:
3749
docker:
3850
- image: circleci/python:3.6
51+
- image: circleci/postgres:9.6-alpine
52+
environment:
53+
POSTGRES_DB: circle_test
54+
POSTGRES_USER: testapp
55+
POSTGRES_PASSWORD: ""
3956
working_directory: ~/rest-auth-toolkit
57+
environment:
58+
DATABASE_URL: postgres://testapp@localhost/circle_test
4059
steps:
4160
- checkout
4261
- restore_cache:
43-
key: rest-auth-toolkit-py36-v2
62+
keys:
63+
- rest-auth-toolkit-py36-v3-{{ arch }}-{{ checksum "requirements-test.txt" }}-{{ checksum "demo/requirements.txt" }}
64+
- rest-auth-toolkit-py36-v2-{{ arch }}-{{ checksum "requirements-test.txt" }}-{{ checksum "demo/requirements.txt" }}
65+
- rest-auth-toolkit-py36-v3-{{ arch }}-{{ checksum "requirements-test.txt" }}
66+
- rest-auth-toolkit-py36-v3-{{ arch }}-
4467
- run:
4568
name: Install CI tools
4669
command: |
@@ -50,54 +73,29 @@ jobs:
5073
name: Test with Python 3.6
5174
command: venv/bin/tox -e py36
5275
- 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
76+
key: rest-auth-toolkit-py36-v3-{{ arch }}-{{ checksum "requirements-test.txt" }}-{{ checksum "demo/requirements.txt" }}
7977
paths:
8078
- venv
8179
- .tox
8280

8381
check:
8482
docker:
85-
- image: circleci/python:3.6
83+
- image: circleci/python:3.7
8684
working_directory: ~/rest-auth-toolkit
8785
steps:
8886
- checkout
8987
- restore_cache:
90-
key: rest-auth-toolkit-check-v3
88+
key: rest-auth-toolkit-check-v5
9189
- run:
9290
name: Install CI tools
9391
command: |
94-
python3.6 -m venv venv
92+
python3.7 -m venv venv
9593
venv/bin/pip install tox
9694
- run:
9795
name: Check packaging and dependencies
9896
command: venv/bin/tox -e pkg
9997
- save_cache:
100-
key: rest-auth-toolkit-check-v3
98+
key: rest-auth-toolkit-check-v5
10199
paths:
102100
- venv
103101
- .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

demo/README.md

Lines changed: 4 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)

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')
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{% load i18n %}
2+
<!doctype html>
3+
<html>
4+
<head>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
</head>
8+
<body style="background-color: #F7F8FA;">
9+
<div>
10+
11+
<p>
12+
{% trans "Follow this link to validate your email:" %}<br>
13+
{% url "pages:confirm-email" token=confirmation.external_id as confirmation_url %}
14+
<a href="{{ base_url }}{{ confirmation_url }}">{{ base_url }}{{ confirmation_url }}</a>
15+
</p>
16+
17+
<p>
18+
{% trans "Or send an API request to simulate a front-end application:" %}<br>
19+
<code>HTTP POST {% url "auth:confirm" %} token="{{ confirmation.external_id }}"</code>
20+
</p>
21+
22+
</div>
23+
</body>
24+
</html>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{% autoescape off %}
2+
{% load i18n %}
3+
4+
{% trans "Follow this link to validate your email:" %}
5+
{{ base_url }}{% url "pages:confirm-email" token=confirmation.external_id %}
6+
7+
{% trans "Or send an API request to simulate a front-end application:" %}
8+
HTTP POST {% url "auth:confirm" %} token="{{ confirmation.external_id }}"
9+
10+
{% endautoescape %}

demo/demo/pages/auth_urls.py

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{% load i18n %}
2+
{% get_current_language as LANGUAGE_CODE %}
3+
<!doctype html>
4+
<html lang="{{ LANGUAGE_CODE }}">
5+
<head>
6+
<meta charset="utf-8">
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
<title>{% block title %}{% endblock %}</title>
9+
</head>
10+
<body>
11+
{% block body %}{% endblock %}
12+
</body>
13+
</html>
Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
1+
{% extends "base.html" %}
12
{% load i18n %}
2-
{% get_current_language as LANGUAGE_CODE %}
3-
<!doctype html>
4-
<html lang="{{ LANGUAGE_CODE }}">
5-
<head>
6-
<meta charset="utf-8">
7-
<meta name="viewport" content="width=device-width, initial-scale=1">
8-
<title>{{ site_name }}</title>
9-
</head>
10-
<body>
3+
{% block title %}Error! {{ site_name }}{% endblock %}
114

5+
{% block body %}
126
<div>
137
<h1>{% trans "Error!" %}</h1>
148
<p>{{ error }}</p>
159
</div>
16-
17-
</body>
18-
</html>
10+
{% endblock %}

demo/demo/pages/templates/index.html

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
{% load i18n %}
2-
{% get_current_language as LANGUAGE_CODE %}
3-
<!doctype html>
4-
<html lang="{{ LANGUAGE_CODE }}">
5-
<head>
6-
<meta charset="utf-8">
7-
<meta name="viewport" content="width=device-width, initial-scale=1">
8-
<title>{{ site_name }}</title>
9-
</head>
10-
<body>
1+
{% extends "base.html" %}
2+
{% block title %}{{ site_name }}{% endblock %}
3+
4+
{% block body %}
115
<script>
126
window.fbAsyncInit = function() {
137
FB.init({appId: "{{ fb_app_id }}", xfbml: true, version: "v2.9"});
@@ -34,12 +28,11 @@
3428
<div id="fb-root"></div>
3529

3630
<div>
37-
<h1>Hello!</h1>
31+
<h1>Hello world!</h1>
3832
<button onclick="fb_login()">Login with Facebook</button>
3933
</div>
4034

4135
<script src="https://code.jquery.com/jquery-3.2.1.min.js"
4236
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
4337
crossorigin="anonymous"></script>
44-
</body>
45-
</html>
38+
{% endblock %}

0 commit comments

Comments
 (0)