Skip to content

Commit

Permalink
Updates and success message
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Jun 4, 2024
1 parent 8c47aea commit 438a0a9
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 22 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main
pull_request:
schedule:
- cron: "37 1 1 * *"
- cron: 37 1 1 * *

jobs:
tests:
Expand All @@ -22,9 +22,9 @@ jobs:
- "3.12"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
28 changes: 17 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
exclude: ".yarn/|yarn.lock|\\.min\\.(css|js)$"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-builtin-literals
Expand All @@ -14,29 +14,35 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/adamchainz/django-upgrade
rev: 1.14.1
rev: 1.16.0
hooks:
- id: django-upgrade
args: [--target-version, "3.2"]
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.290"
- repo: https://github.com/MarcoGorelli/absolufy-imports
rev: v0.3.1
hooks:
- id: ruff
- repo: https://github.com/psf/black
rev: 23.9.1
- id: absolufy-imports
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.3.2"
hooks:
- id: black
- id: ruff
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
rev: v3.1.0
hooks:
- id: prettier
args: [--list-different, --no-semi]
exclude: "^conf/|.*\\.html$"
- repo: https://github.com/biomejs/pre-commit
rev: "v0.1.0"
hooks:
- id: biome-check
additional_dependencies: ["@biomejs/[email protected]"]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: 1.1.0
rev: 1.7.0
hooks:
- id: pyproject-fmt
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.14
rev: v0.16
hooks:
- id: validate-pyproject
1 change: 1 addition & 0 deletions authlib/admin_oauth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def admin_oauth(request):
user = auth.authenticate(email=user_mail)
if user and user.is_staff:
auth.login(request, user)
messages.success(request, _("Welcome, {}!").format(user))
response = redirect(retrieve_next(request) or "admin:index")
response.set_cookie(
ADMIN_OAUTH_LOGIN_HINT, email, expires=30 * 86400
Expand Down
25 changes: 25 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
"organizeImports": {
"enabled": false
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2
},
"javascript": {
"formatter": {
"semicolons": "asNeeded"
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"complexity": {
"noForEach": "off"
}
}
}
}
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ include = ["authlib/"]
path = "authlib/__init__.py"

[tool.ruff]
extend-select = [
lint.extend-select = [
# pyflakes, pycodestyle
"F", "E", "W",
# mmcabe
Expand Down Expand Up @@ -83,7 +83,7 @@ extend-select = [
# unused noqa
"RUF100",
]
extend-ignore = [
lint.extend-ignore = [
# Allow zip() without strict=
"B905",
# No line length errors
Expand All @@ -93,14 +93,14 @@ fix = true
show-fixes = true
target-version = "py39"

[tool.ruff.isort]
[tool.ruff.lint.isort]
combine-as-imports = true
lines-after-imports = 2

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
max-complexity = 15

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"*/migrat*/*" = [
# Allow using PascalCase model names in migrations
"N806",
Expand Down
7 changes: 4 additions & 3 deletions tests/testapp/test_authlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,10 @@ def test_admin_oauth_user_nocreated(self):
)
def test_admin_oauth_user_create_method_not_imported(self):
client = Client()
with google_oauth_data(
{"email": "[email protected]", "email_verified": True}
), self.assertRaises(ImportError):
with (
google_oauth_data({"email": "[email protected]", "email_verified": True}),
self.assertRaises(ImportError),
):
client.get("/admin/__oauth__/?code=bla")

def test_authlib(self):
Expand Down

0 comments on commit 438a0a9

Please sign in to comment.