diff --git a/Backend/requirements.txt b/Backend/requirements.txt index 0509fb7b..316249a8 100644 --- a/Backend/requirements.txt +++ b/Backend/requirements.txt @@ -6,6 +6,7 @@ colorama==0.4.6 distro==1.8.0 et-xmlfile==1.1.0 fastapi==0.87.0 +flake8==6.0.0 greenlet==2.0.1 gunicorn==20.1.0 h11==0.14.0 @@ -13,16 +14,20 @@ httpcore==0.16.1 httptools==0.5.0 httpx==0.23.1 idna==3.4 +mccabe==0.7.0 mysql-connector-python==8.0.31 newrelic==8.4.0 numpy==1.23.5 openai==0.25.0 +opencv-python==4.6.0.66 openpyxl==3.0.10 pandas==1.5.2 pandas-stubs==1.5.2.221124 pdfkit==1.0.0 protobuf==3.20.1 +pycodestyle==2.10.0 pydantic==1.10.2 +pyflakes==3.0.1 PyMySQL==1.0.2 PyMysqlDB==0.0.2 python-dateutil==2.8.2 @@ -42,7 +47,7 @@ starlette==0.21.0 tabula-py==2.6.0 tqdm==4.64.1 types-pytz==2022.6.0.1 -typing-extensions==4.4.0 +typing_extensions==4.4.0 urllib3==1.26.13 uvicorn==0.19.0 uvloop==0.17.0 diff --git a/tests/test_backend/flask8_script.txt b/tests/test_backend/flask8_script.txt new file mode 100644 index 00000000..999fffd4 --- /dev/null +++ b/tests/test_backend/flask8_script.txt @@ -0,0 +1 @@ +flake8 Backenf \ No newline at end of file diff --git a/tests/test_backend/test_controllers/test_convert_file.py b/tests/test_backend/test_controllers/test_convert_file.py index 3a390149..fd66ebe3 100644 --- a/tests/test_backend/test_controllers/test_convert_file.py +++ b/tests/test_backend/test_controllers/test_convert_file.py @@ -1,2 +1,40 @@ #!/usr/bin/python3 -""" TEST FOR CONVERT FILE FUNCTIONS """ \ No newline at end of file +""" TEST FOR CONVERT FILE FUNCTIONS """ +from fastapi.testclient import TestClient +from fastapi import File, UploadFile, FASTAPI +from fastapi import Response, status + +app = FASTAPI() + +def read_root(): + return {"Hello": "World"} + +client = TestClient(app) +test_file = ["dummy_account_statement.csv", "dummy_sales_record.csv",] + +# def test_file_conversion(filename): +# response = client.post("/upload") +# files = [("files", open("dummy_account_statement.csv", "rb")), ("files", open("dummy_sales_record.csv", "rb"))] +# #TODO how to upload a file +# # Initialize an empty string to store the letters after the period +# letters_after_period = "" + +# # Loop through each character in the string +# for ch in test_file: +# # Check if the current character is a period +# if ch == ".": +# # If it is, save all the remaining characters in the string after the period +# letters_after_period = test_file[test_file.index(ch)+1:] + +# # Print the letters after the period +# print(letters_after_period) + +# assert response.status_code == 200 +# assert response.j + + +def test_file_upload(): + files = [("files", open("dummy_account_statement.csv", "rb")), ("files", open("dummy_sales_record.csv", "rb"))] + #TODO how to upload a file + response = client.post('/upload', files=files) + assert response.status_code == status.HTTP_201_CREATED \ No newline at end of file