Merge pull request #149 from SDSRV-IDP/dev/logging

Update: testcases
This commit is contained in:
Phan Thành Trung 2024-06-28 13:46:38 +07:00 committed by GitHub Enterprise
commit c01596bd4c
4 changed files with 7 additions and 4 deletions

View File

@ -1,4 +1,5 @@
MEDIA_ROOT=/app/media MEDIA_ROOT=/app/media
LOG_ROOT=/app/log
# DATABASE django setup # DATABASE django setup
DB_ENGINE=django.db.backends.postgresql_psycopg2 DB_ENGINE=django.db.backends.postgresql_psycopg2
DB_SCHEMA=sbt_dev DB_SCHEMA=sbt_dev

View File

@ -67,8 +67,9 @@ services:
volumes: volumes:
- BE_media:${MEDIA_ROOT} - BE_media:${MEDIA_ROOT}
- BE_static:/app/static - BE_static:/app/static
- /var/log:${LOG_ROOT}
working_dir: /app working_dir: /app
command: sh -c "chmod -R 777 /app; sleep 5; python manage.py collectstatic --no-input && command: sh -c "sudo chmod -R 777 /app; sleep 5; python manage.py collectstatic --no-input &&
python manage.py migrate && python manage.py migrate &&
python manage.py compilemessages && python manage.py compilemessages &&
gunicorn fwd.asgi:application -k uvicorn.workers.UvicornWorker --timeout 300 -b 0.0.0.0:9000" # pre-makemigrations on prod gunicorn fwd.asgi:application -k uvicorn.workers.UvicornWorker --timeout 300 -b 0.0.0.0:9000" # pre-makemigrations on prod
@ -145,6 +146,7 @@ services:
rabbitmq-sbt: rabbitmq-sbt:
condition: service_started condition: service_started
volumes: volumes:
- /var/log:${LOG_ROOT}
- BE_media:${MEDIA_ROOT} - BE_media:${MEDIA_ROOT}
working_dir: /app working_dir: /app
command: sh -c "celery -A fwd_api.celery_worker.worker worker -l INFO -c 5" command: sh -c "celery -A fwd_api.celery_worker.worker worker -l INFO -c 5"

View File

@ -14,13 +14,13 @@ def check_invoice_data(document):
assert document["doc_type"] == "sbt_document" assert document["doc_type"] == "sbt_document"
assert get_field(document, "retailername") == "Arrow Communication" assert get_field(document, "retailername") == "Arrow Communication"
assert get_field(document, "sold_to_party") is None assert get_field(document, "sold_to_party") is None
assert "2021-02-09" in get_field(document, "purchase_date") assert "2024-02-09" in get_field(document, "purchase_date")
def check_invoice_data_2(document): def check_invoice_data_2(document):
assert document["doc_type"] == "sbt_document" assert document["doc_type"] == "sbt_document"
assert get_field(document, "retailername") == "Starhub Shop" assert get_field(document, "retailername") == "Starhub Shop"
assert get_field(document, "sold_to_party") is None assert get_field(document, "sold_to_party") is None
assert "2022-02-22" in get_field(document, "purchase_date") assert "2024-02-22" in get_field(document, "purchase_date")
def test_1_invoice_1_imei(): def test_1_invoice_1_imei():
invoice_files = [ invoice_files = [

View File

@ -14,7 +14,7 @@ def check_invoice_data_2(document):
assert document["doc_type"] == "sbt_document" assert document["doc_type"] == "sbt_document"
assert get_field(document, "retailername") == "Starhub Shop" assert get_field(document, "retailername") == "Starhub Shop"
assert get_field(document, "sold_to_party") is None assert get_field(document, "sold_to_party") is None
assert "2022-02-22" in get_field(document, "purchase_date") assert "2024-02-22" in get_field(document, "purchase_date")
def test_invoice_only(): def test_invoice_only():