From f0d032a9e656e8540913282fc9a521f7680c0157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20L=C3=A1szl=C3=B3?= <rlacko99@gmail.com> Date: Sat, 30 Jan 2021 19:53:46 +0100 Subject: [PATCH] fix flake8 --- .gitlab-ci.yml | 18 +++++++++--------- src/authsch/authentication.py | 2 +- src/common/email.py | 3 +-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c685f8b..7909394 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,15 +7,15 @@ variables: POSTGRES_DB: database_name cache: - key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" + key: '$CI_JOB_NAME-$CI_COMMIT_REF_SLUG' paths: - .cache/pip - venv/ before_script: - - python -V + - python -V - python3 -m venv venv - - source venv/bin/activate + - source venv/bin/activate - pip install -r requirements/production.txt stages: @@ -24,14 +24,14 @@ stages: Flake8: stage: Build script: - - flake8 --max-line-length=125 --exclude=src/kszkepzes,migrations,venv + - flake8 --max-line-length=125 --exclude=src/kszkepzes,migrations,venv,env Test: stage: Build variables: - DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/$POSTGRES_DB" - SECRET_KEY: "secret" - AUTHSCH_KEY: "secret" - AUTHSCH_SECRET: "secret" + DATABASE_URL: 'postgresql://postgres:postgres@postgres:5432/$POSTGRES_DB' + SECRET_KEY: 'secret' + AUTHSCH_KEY: 'secret' + AUTHSCH_SECRET: 'secret' script: - - python src/manage.py test + - python src/manage.py test diff --git a/src/authsch/authentication.py b/src/authsch/authentication.py index b7e105a..86d6334 100644 --- a/src/authsch/authentication.py +++ b/src/authsch/authentication.py @@ -21,7 +21,7 @@ class AuthSCHOAuth2(BaseOAuth2): def get_user_details(self, response): """Return user details from AuthSCH account""" return { - 'username': response.get('linkedAccounts').get('schacc'), + 'username': response.get('linkedAccounts').get('schacc'), 'email': response.get('mail'), 'first_name': response.get('givenName'), 'last_name': response.get('sn') diff --git a/src/common/email.py b/src/common/email.py index 838bf7f..7273ce6 100644 --- a/src/common/email.py +++ b/src/common/email.py @@ -2,8 +2,6 @@ from django.core.mail import send_mail import codecs import sys - - sender_email = 'noreply@ujonc.kszk.bme.hu' link = 'https://ujonc.kszk.bme.hu/homework' @@ -13,6 +11,7 @@ def read_email(name): data = myfile.read() return data + def send_out_mail(subject, message, sender_email, receiver_email): if 'runserver' in sys.argv: # It is in development -- GitLab