This commit is contained in:
Boroumand, Amir A 2024-04-22 14:16:30 -04:00
parent 4c82208be9
commit c875de688b
2 changed files with 9 additions and 5 deletions

View File

@ -1,4 +1,4 @@
name: Pylint
name: Python CI
on: [push]
@ -22,7 +22,10 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r test-requirements.txt
pip install pylint
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')
- name: Run tests with pytest
run: pytest

View File

@ -10,10 +10,11 @@ FILE_NAME = "sunflower.jpg"
def test_read_main():
"""Tests that POST /api/v1/detect returns 200 OK with valid request body"""
response = client.post(
"/api/v1/detect",
files={"file": (FILE_NAME, open(FILE_NAME, "rb"), "image/jpeg")},
)
with open(FILE_NAME, "rb") as file:
response = client.post(
"/api/v1/detect",
files={"file": (FILE_NAME, file, "image/jpeg")},
)
assert response.status_code == 200
assert response.json() == {
"file_name": FILE_NAME,