-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/anonymous-user
- Loading branch information
Showing
14 changed files
with
125 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
-r requirements_production.txt | ||
|
||
autoflake==2.3.1 | ||
black==24.4.2 | ||
flake8==7.1.0 | ||
black==24.8.0 | ||
flake8==7.1.1 | ||
isort==5.13.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Flask==3.0.3 | ||
gunicorn==22.0.0 | ||
gunicorn==23.0.0 | ||
psycopg2==2.9.9 | ||
requests==2.32.3 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
-r requirements_development.txt | ||
|
||
pytest==8.2.2 | ||
pytest==8.3.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM python:3.10.13-slim-bookworm | ||
|
||
WORKDIR /app | ||
|
||
RUN pip install flask | ||
|
||
ENV FLASK_APP ./dummy_autoupdate/dummy_autoupdate.py | ||
ENV FLASK_ENV development | ||
|
||
CMD ["flask", "run", "--host", "0.0.0.0", "--port", "9012"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
from flask import Flask, jsonify, request | ||
|
||
app = Flask(__name__) | ||
|
||
app.logger.info("Started Dummy-Autoupdate") | ||
|
||
|
||
# for testing | ||
@app.route("/internal/autoupdate", methods=["POST"]) | ||
def dummy_autoupdate(): | ||
app.logger.debug(f"dummy_autoupdate gets: {request.json}") | ||
file_id = request.json[0]["ids"][0] | ||
|
||
# Valid response from autoupdate, but not found in DB | ||
if file_id == 1: | ||
return jsonify( | ||
{ | ||
f"mediafile/{file_id}/id": file_id, | ||
f"mediafile/{file_id}/filename": "Does not exist", | ||
} | ||
) | ||
|
||
# OK-cases for dummy data | ||
if file_id == 2: | ||
return jsonify( | ||
{ | ||
f"mediafile/{file_id}/id": file_id, | ||
f"mediafile/{file_id}/filename": "A.txt", | ||
} | ||
) | ||
if file_id == 3: | ||
return jsonify( | ||
{ | ||
f"mediafile/{file_id}/id": file_id, | ||
f"mediafile/{file_id}/filename": "in.jpg", | ||
} | ||
) | ||
|
||
# OK-cases for uploaded data | ||
if file_id in (4, 5, 6, 7): | ||
return jsonify( | ||
{ | ||
f"mediafile/{file_id}/id": file_id, | ||
f"mediafile/{file_id}/filename": str(file_id), | ||
} | ||
) | ||
|
||
# invalid responses | ||
if file_id == 10: | ||
return jsonify([None]) | ||
if file_id == 11: | ||
return "some text" | ||
if file_id == 12: | ||
return "An error", 500 | ||
if file_id == 13: | ||
return [] | ||
if file_id == 14: | ||
return jsonify({f"mediafile/{file_id}/id": file_id}) | ||
|
||
# not found or no perms | ||
if file_id == 20: | ||
return jsonify({}) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters