plain.oauth 0.15.0__tar.gz → 0.16.1__tar.gz

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 (45) hide show
  1. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/PKG-INFO +6 -7
  2. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/plain/oauth/README.md +5 -6
  3. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/plain/oauth/migrations/0001_initial.py +2 -2
  4. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/pyproject.toml +1 -1
  5. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/tests/app/users/migrations/0001_initial.py +2 -2
  6. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/tests/provider_tests/test_github.py +4 -1
  7. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/tests/test_backends.py +7 -2
  8. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/tests/test_providers.py +13 -4
  9. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/.gitignore +0 -0
  10. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/LICENSE +0 -0
  11. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/README.md +0 -0
  12. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/plain/oauth/__init__.py +0 -0
  13. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/plain/oauth/admin.py +0 -0
  14. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/plain/oauth/config.py +0 -0
  15. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/plain/oauth/default_settings.py +0 -0
  16. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/plain/oauth/exceptions.py +0 -0
  17. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/plain/oauth/migrations/0002_alter_oauthconnection_options_and_more.py +0 -0
  18. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/plain/oauth/migrations/0003_alter_oauthconnection_access_token_and_more.py +0 -0
  19. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/plain/oauth/migrations/0004_alter_oauthconnection_access_token_and_more.py +0 -0
  20. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/plain/oauth/migrations/0005_alter_oauthconnection_unique_together_and_more.py +0 -0
  21. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/plain/oauth/migrations/0006_remove_oauthconnection_unique_oauth_provider_user_id_and_more.py +0 -0
  22. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/plain/oauth/migrations/0007_alter_oauthconnection_provider_key_and_more.py +0 -0
  23. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/plain/oauth/migrations/__init__.py +0 -0
  24. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/plain/oauth/models.py +0 -0
  25. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/plain/oauth/providers.py +0 -0
  26. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/plain/oauth/templates/oauth/error.html +0 -0
  27. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/plain/oauth/urls.py +0 -0
  28. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/plain/oauth/views.py +0 -0
  29. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/provider_examples/__init__.py +0 -0
  30. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/provider_examples/bitbucket.py +0 -0
  31. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/provider_examples/github.py +0 -0
  32. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/provider_examples/gitlab.py +0 -0
  33. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/tests/app/settings.py +0 -0
  34. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/tests/app/templates/base.html +0 -0
  35. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/tests/app/templates/index.html +0 -0
  36. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/tests/app/templates/login.html +0 -0
  37. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/tests/app/urls.py +0 -0
  38. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/tests/app/users/migrations/__init__.py +0 -0
  39. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/tests/app/users/models.py +0 -0
  40. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/tests/provider_tests/__init__.py +0 -0
  41. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/tests/providers/__init__.py +0 -0
  42. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/tests/providers/bitbucket.py +0 -0
  43. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/tests/providers/github.py +0 -0
  44. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/tests/providers/gitlab.py +0 -0
  45. {plain_oauth-0.15.0 → plain_oauth-0.16.1}/tests/test_checks.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plain.oauth
3
- Version: 0.15.0
3
+ Version: 0.16.1
4
4
  Summary: OAuth login and API access for Plain.
5
5
  Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
6
6
  License-Expression: BSD-3-Clause
@@ -29,7 +29,6 @@ There are three OAuth flows that it makes possible:
29
29
  2. Login via OAuth (existing user, existing OAuth connection)
30
30
  3. Connect/disconnect OAuth accounts to a user (existing user, new OAuth connection)
31
31
 
32
-
33
32
  ## Usage
34
33
 
35
34
  Install the package from PyPi:
@@ -156,7 +155,7 @@ That's pretty much it!
156
155
  The most common error you'll run into is if an existing user clicks a login button,
157
156
  but they haven't yet connected that provider to their account.
158
157
  For security reasons,
159
- the required flow here is that the user actually logs in with another method (however they signed up) and then *connects* the OAuth provider from a settings page.
158
+ the required flow here is that the user actually logs in with another method (however they signed up) and then _connects_ the OAuth provider from a settings page.
160
159
 
161
160
  For this error (and a couple others),
162
161
  there is an error template that is rendered.
@@ -250,7 +249,7 @@ response = requests.get(...)
250
249
 
251
250
  ### Using the Django system check
252
251
 
253
- This library comes with a Django system check to ensure you don't *remove* a provider from `settings.py` that is still in use in your database.
252
+ This library comes with a Django system check to ensure you don't _remove_ a provider from `settings.py` that is still in use in your database.
254
253
  You do need to specify the `--database` for this to run when using the check command by itself:
255
254
 
256
255
  ```sh
@@ -261,7 +260,7 @@ python manage.py check --database default
261
260
 
262
261
  ### How is this different from [Django OAuth libraries](https://djangopackages.org/grids/g/oauth/)?
263
262
 
264
- The short answer is that *it does less*.
263
+ The short answer is that _it does less_.
265
264
 
266
265
  In [django-allauth](https://github.com/pennersr/django-allauth)
267
266
  (maybe the most popular alternative)
@@ -276,7 +275,7 @@ Personally, I don't like the way that your OAuth settings are stored in the data
276
275
  and the implications for doing it one way or another.
277
276
 
278
277
  The other popular OAuth libraries have similar issues,
279
- and I think their *weight* outweighs their usefulness for 80% of the use cases.
278
+ and I think their _weight_ outweighs their usefulness for 80% of the use cases.
280
279
 
281
280
  ### Why aren't providers included in the library itself?
282
281
 
@@ -295,7 +294,7 @@ Just copy that code and paste it in your project.
295
294
  Tweak as necessary!
296
295
 
297
296
  This might sound strange at first.
298
- But in the long run we think it's actually *much* more maintainable for both us (as library authors) and you (as app author).
297
+ But in the long run we think it's actually _much_ more maintainable for both us (as library authors) and you (as app author).
299
298
  If something breaks with a provider, you can fix it immediately!
300
299
  You don't need to try to run changes through us or wait for an upstream update.
301
300
  You're welcome to contribute an example to this repo,
@@ -15,7 +15,6 @@ There are three OAuth flows that it makes possible:
15
15
  2. Login via OAuth (existing user, existing OAuth connection)
16
16
  3. Connect/disconnect OAuth accounts to a user (existing user, new OAuth connection)
17
17
 
18
-
19
18
  ## Usage
20
19
 
21
20
  Install the package from PyPi:
@@ -142,7 +141,7 @@ That's pretty much it!
142
141
  The most common error you'll run into is if an existing user clicks a login button,
143
142
  but they haven't yet connected that provider to their account.
144
143
  For security reasons,
145
- the required flow here is that the user actually logs in with another method (however they signed up) and then *connects* the OAuth provider from a settings page.
144
+ the required flow here is that the user actually logs in with another method (however they signed up) and then _connects_ the OAuth provider from a settings page.
146
145
 
147
146
  For this error (and a couple others),
148
147
  there is an error template that is rendered.
@@ -236,7 +235,7 @@ response = requests.get(...)
236
235
 
237
236
  ### Using the Django system check
238
237
 
239
- This library comes with a Django system check to ensure you don't *remove* a provider from `settings.py` that is still in use in your database.
238
+ This library comes with a Django system check to ensure you don't _remove_ a provider from `settings.py` that is still in use in your database.
240
239
  You do need to specify the `--database` for this to run when using the check command by itself:
241
240
 
242
241
  ```sh
@@ -247,7 +246,7 @@ python manage.py check --database default
247
246
 
248
247
  ### How is this different from [Django OAuth libraries](https://djangopackages.org/grids/g/oauth/)?
249
248
 
250
- The short answer is that *it does less*.
249
+ The short answer is that _it does less_.
251
250
 
252
251
  In [django-allauth](https://github.com/pennersr/django-allauth)
253
252
  (maybe the most popular alternative)
@@ -262,7 +261,7 @@ Personally, I don't like the way that your OAuth settings are stored in the data
262
261
  and the implications for doing it one way or another.
263
262
 
264
263
  The other popular OAuth libraries have similar issues,
265
- and I think their *weight* outweighs their usefulness for 80% of the use cases.
264
+ and I think their _weight_ outweighs their usefulness for 80% of the use cases.
266
265
 
267
266
  ### Why aren't providers included in the library itself?
268
267
 
@@ -281,7 +280,7 @@ Just copy that code and paste it in your project.
281
280
  Tweak as necessary!
282
281
 
283
282
  This might sound strange at first.
284
- But in the long run we think it's actually *much* more maintainable for both us (as library authors) and you (as app author).
283
+ But in the long run we think it's actually _much_ more maintainable for both us (as library authors) and you (as app author).
285
284
  If something breaks with a provider, you can fix it immediately!
286
285
  You don't need to try to run changes through us or wait for an upstream update.
287
286
  You're welcome to contribute an example to this repo,
@@ -26,8 +26,8 @@ class Migration(migrations.Migration):
26
26
  ),
27
27
  ("created_at", models.DateTimeField(auto_now_add=True)),
28
28
  ("updated_at", models.DateTimeField(auto_now=True)),
29
- ("provider_key", models.CharField(db_index=True, max_length=100)),
30
- ("provider_user_id", models.CharField(db_index=True, max_length=100)),
29
+ ("provider_key", models.CharField(max_length=100)),
30
+ ("provider_user_id", models.CharField(max_length=100)),
31
31
  ("access_token", models.CharField(required=False, max_length=100)),
32
32
  ("refresh_token", models.CharField(required=False, max_length=100)),
33
33
  (
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "plain.oauth"
3
- version = "0.15.0"
3
+ version = "0.16.1"
4
4
  description = "OAuth login and API access for Plain."
5
5
  authors = [{name = "Dave Gaeddert", email = "dave.gaeddert@dropseed.dev"}]
6
6
  license = "BSD-3-Clause"
@@ -14,8 +14,8 @@ class Migration(migrations.Migration):
14
14
  name="User",
15
15
  fields=[
16
16
  ("id", models.BigAutoField(auto_created=True, primary_key=True)),
17
- ("email", models.EmailField(max_length=254, unique=True)),
18
- ("username", models.CharField(max_length=100, unique=True)),
17
+ ("email", models.EmailField(max_length=254)),
18
+ ("username", models.CharField(max_length=100)),
19
19
  ],
20
20
  ),
21
21
  ]
@@ -1,6 +1,7 @@
1
1
  from tests.providers.github import GitHubOAuthProvider
2
2
 
3
3
  from plain.oauth.providers import OAuthToken, OAuthUser
4
+ from plain.test import Client
4
5
 
5
6
 
6
7
  class DummyGitHubOAuthProvider(GitHubOAuthProvider):
@@ -18,7 +19,7 @@ class DummyGitHubOAuthProvider(GitHubOAuthProvider):
18
19
  )
19
20
 
20
21
 
21
- def test_github_provider(db, client, settings):
22
+ def test_github_provider(db, settings):
22
23
  settings.OAUTH_LOGIN_PROVIDERS = {
23
24
  "github": {
24
25
  "class": "provider_tests.test_github.DummyGitHubOAuthProvider",
@@ -30,6 +31,8 @@ def test_github_provider(db, client, settings):
30
31
  }
31
32
  }
32
33
 
34
+ client = Client()
35
+
33
36
  # Login required for this view
34
37
  response = client.get("/")
35
38
  assert response.status_code == 302
@@ -1,4 +1,5 @@
1
1
  from plain.oauth.providers import OAuthProvider, OAuthToken, OAuthUser
2
+ from plain.test import Client
2
3
 
3
4
 
4
5
  class DummyProvider(OAuthProvider):
@@ -19,7 +20,7 @@ class DummyProvider(OAuthProvider):
19
20
  return
20
21
 
21
22
 
22
- def test_single_backend(db, client, settings):
23
+ def test_single_backend(db, settings):
23
24
  settings.OAUTH_LOGIN_PROVIDERS = {
24
25
  "dummy": {
25
26
  "class": "test_backends.DummyProvider",
@@ -31,6 +32,8 @@ def test_single_backend(db, client, settings):
31
32
  }
32
33
  }
33
34
 
35
+ client = Client()
36
+
34
37
  response = client.get("/oauth/dummy/callback/?code=test_code&state=dummy_state")
35
38
  assert response.status_code == 302
36
39
  assert response.url == "/"
@@ -40,7 +43,7 @@ def test_single_backend(db, client, settings):
40
43
  assert response.user
41
44
 
42
45
 
43
- def test_multiple_backends(db, client, settings):
46
+ def test_multiple_backends(db, settings):
44
47
  settings.OAUTH_LOGIN_PROVIDERS = {
45
48
  "dummy": {
46
49
  "class": "test_backends.DummyProvider",
@@ -52,6 +55,8 @@ def test_multiple_backends(db, client, settings):
52
55
  }
53
56
  }
54
57
 
58
+ client = Client()
59
+
55
60
  response = client.get("/oauth/dummy/callback/?code=test_code&state=dummy_state")
56
61
  assert response.status_code == 302
57
62
  assert response.url == "/"
@@ -3,6 +3,7 @@ import datetime
3
3
  from plain.auth import get_user_model
4
4
  from plain.oauth.models import OAuthConnection
5
5
  from plain.oauth.providers import OAuthProvider, OAuthToken, OAuthUser
6
+ from plain.test import Client
6
7
 
7
8
 
8
9
  class DummyProvider(OAuthProvider):
@@ -43,7 +44,7 @@ class DummyProvider(OAuthProvider):
43
44
  )
44
45
 
45
46
 
46
- def test_dummy_signup(db, client, settings):
47
+ def test_dummy_signup(db, settings):
47
48
  settings.OAUTH_LOGIN_PROVIDERS = {
48
49
  "dummy": {
49
50
  "class": "test_providers.DummyProvider",
@@ -55,6 +56,8 @@ def test_dummy_signup(db, client, settings):
55
56
  }
56
57
  }
57
58
 
59
+ client = Client()
60
+
58
61
  assert get_user_model().objects.count() == 0
59
62
  assert OAuthConnection.objects.count() == 0
60
63
 
@@ -102,7 +105,7 @@ def test_dummy_signup(db, client, settings):
102
105
  assert OAuthConnection.objects.count() == 1
103
106
 
104
107
 
105
- def test_dummy_login_connection(db, client, settings):
108
+ def test_dummy_login_connection(db, settings):
106
109
  settings.OAUTH_LOGIN_PROVIDERS = {
107
110
  "dummy": {
108
111
  "class": "test_providers.DummyProvider",
@@ -114,6 +117,8 @@ def test_dummy_login_connection(db, client, settings):
114
117
  }
115
118
  }
116
119
 
120
+ client = Client()
121
+
117
122
  assert get_user_model().objects.count() == 0
118
123
  assert OAuthConnection.objects.count() == 0
119
124
 
@@ -182,7 +187,7 @@ def test_dummy_login_connection(db, client, settings):
182
187
  assert OAuthConnection.objects.count() == 1
183
188
 
184
189
 
185
- def test_dummy_login_without_connection(db, client, settings):
190
+ def test_dummy_login_without_connection(db, settings):
186
191
  settings.OAUTH_LOGIN_PROVIDERS = {
187
192
  "dummy": {
188
193
  "class": "test_providers.DummyProvider",
@@ -194,6 +199,8 @@ def test_dummy_login_without_connection(db, client, settings):
194
199
  }
195
200
  }
196
201
 
202
+ client = Client()
203
+
197
204
  assert get_user_model().objects.count() == 0
198
205
  assert OAuthConnection.objects.count() == 0
199
206
 
@@ -224,7 +231,7 @@ def test_dummy_login_without_connection(db, client, settings):
224
231
  assert b"OAuth Error" in response.content
225
232
 
226
233
 
227
- def test_dummy_connect(db, client, settings):
234
+ def test_dummy_connect(db, settings):
228
235
  settings.OAUTH_LOGIN_PROVIDERS = {
229
236
  "dummy": {
230
237
  "class": "test_providers.DummyProvider",
@@ -236,6 +243,8 @@ def test_dummy_connect(db, client, settings):
236
243
  }
237
244
  }
238
245
 
246
+ client = Client()
247
+
239
248
  assert get_user_model().objects.count() == 0
240
249
  assert OAuthConnection.objects.count() == 0
241
250
 
File without changes
File without changes
File without changes