Coverage for mpcforces_extractor\api\test_main.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-06 21:34 +0100

1import os 

2from fastapi.testclient import TestClient 

3from mpcforces_extractor.api.main import app 

4from mpcforces_extractor.api.config import OUTPUT_FOLDER 

5 

6 

7class TestRoutesFileUpload: 

8 """ 

9 Test the routes 

10 """ 

11 

12 def test_get_output_folder(self): 

13 """ 

14 Test the get_output_folder endpoint 

15 """ 

16 client = TestClient(app) 

17 response = client.get("api/v1/get-output-folder") 

18 assert response.status_code == 200 

19 assert response.json() == {"output_folder": str(OUTPUT_FOLDER)} 

20 actual_folder = os.getcwd() + "/data/output".replace("/", os.sep) 

21 assert response.json()["output_folder"] == actual_folder