fix code style

This commit is contained in:
JensDiemer 2022-04-15 16:59:30 +02:00
parent 5a7500c95f
commit 45701b248b
3 changed files with 11 additions and 9 deletions

View file

@ -64,6 +64,7 @@ atomic=true
profile='black'
line_length=100
skip_glob=["*/htmlcov/*","*/migrations/*"]
known_first_party=["for_runners"]
lines_after_imports=2

View file

@ -39,9 +39,9 @@ class DjangoYnhTestCase(HtmlAssertionMixin, TestCase):
# TODO: https://github.com/jedie/django-for-runners/issues/25
# Serve user uploads via django_tools.serve_media_app:
# assert settings.MEDIA_URL == '/app_path/media/'
# assert reverse('serve_media_app:serve-media', kwargs={'user_token': 'token', 'path': 'foo/bar/'}) == (
# '/app_path/media/token/foo/bar/'
# )
# assert reverse(
# 'serve_media_app:serve-media', kwargs={'user_token': 'token', 'path': 'foo/bar/'}
# ) == ('/app_path/media/token/foo/bar/')
def test_auth(self):
# SecurityMiddleware should redirects all non-HTTPS requests to HTTPS:
@ -51,14 +51,12 @@ class DjangoYnhTestCase(HtmlAssertionMixin, TestCase):
response,
status_code=301, # permanent redirect
expected_url='https://testserver/app_path/',
fetch_redirect_response=False
fetch_redirect_response=False,
)
response = self.client.get('/app_path/', secure=True)
self.assertRedirects(
response,
expected_url='/app_path/login/?next=/app_path/',
fetch_redirect_response=False
response, expected_url='/app_path/login/?next=/app_path/', fetch_redirect_response=False
)
@override_settings(SECURE_SSL_REDIRECT=False)
@ -150,7 +148,9 @@ class DjangoYnhTestCase(HtmlAssertionMixin, TestCase):
path='/app_path/',
HTTP_REMOTE_USER='test',
HTTP_AUTH_USER='test',
HTTP_AUTHORIZATION=generate_basic_auth(username='foobar', password='test123'), # <<< wrong user name
HTTP_AUTHORIZATION=generate_basic_auth(
username='foobar', password='test123'
), # <<< wrong user name
)
assert User.objects.count() == 1

View file

@ -4,10 +4,11 @@ import shutil
import subprocess
from pathlib import Path
import for_runners
from bx_django_utils.filename import clean_filename
from bx_py_utils.path import assert_is_dir, assert_is_file
import for_runners
PACKAGE_ROOT = Path(__file__).parent.parent