Skip to content

Commit

Permalink
Fixes missing imports and undefined variables with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
azmeuk committed Aug 16, 2023
1 parent 7fc82fe commit 1a582ea
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 20 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,5 @@ testpaths = "web"
ignore = [
"E501", # line too long
"E722", # bare expect
"E402", # import not at the top of the file
]
5 changes: 1 addition & 4 deletions web/flaskr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def global_processor():
"config": app.config,
"beta": app.config["BETA"],
"documentation_link": app.config["DOCUMENTATION_LINK"],
"LANGUAGES": LANGUAGES,
**app.config["WORDINGS"],
}

Expand All @@ -67,10 +68,6 @@ def global_processor():
csrf = CSRFProtect()
csrf.init_app(app)

@app.context_processor
def global_processor():
return {"LANGUAGES": LANGUAGES}

# init database
with app.app_context():
import flaskr.routes
Expand Down
2 changes: 2 additions & 0 deletions web/flaskr/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
from datetime import date, datetime, timedelta, timezone

from flaskr.utils import secret_key
import os


db = SQLAlchemy()

Expand Down
2 changes: 1 addition & 1 deletion web/flaskr/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ def add_meeting_file_nextcloud(path, meeting_id, is_default):
return jsonify(
status=500,
isfrom="nextcloud",
msg=f"Fichier {title} TROP VOLUMINEUX, ne pas dépasser 20Mo",
msg=f"Fichier {path} TROP VOLUMINEUX, ne pas dépasser 20Mo",
)

meetingFile = MeetingFiles()
Expand Down
4 changes: 3 additions & 1 deletion web/misc/gunicorn.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ def when_ready(server):
def worker_int(worker):
worker.log.info("worker received INT or QUIT signal")
## get traceback info
import threading, sys, traceback
import threading
import sys
import traceback

id2name = {th.ident: th.name for th in threading.enumerate()}
code = []
Expand Down
20 changes: 6 additions & 14 deletions web/tests/meeting/test_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,14 @@ def test_auth_attendee_disabled(client_app, app, meeting):
the attendee authentication step.
https://github.com/numerique-gouv/b3desk/issues/9
"""
# TODO: refactor this test with modern test conventions when #6 is merged

app.config["OIDC_ATTENDEE_ENABLED"] = False
meeting_hash = meeting.get_hash("authenticated")

with app.app_context():
user_id = 1
meeting = Meeting.query.get(1)
meeting_id = meeting.id
meeting_hash = meeting.get_hash("authenticated")

url = f"/meeting/signin/{meeting_id}/creator/{user_id}/hash/{meeting_hash}"
response = client_app.get(url)

assert response.status_code == 200
form_action_url = "/meeting/join"
assert form_action_url in response.data.decode()
url = f"/meeting/signin/{meeting.id}/creator/{meeting.user.id}/hash/{meeting_hash}"
response = client_app.get(
url, extra_environ={"REMOTE_ADDR": "127.0.0.1"}, status=200
)
response.mustcontain("/meeting/join")


def test_join_meeting_as_authenticated_attendee(
Expand Down

0 comments on commit 1a582ea

Please sign in to comment.