Procházet zdrojové kódy

Fix broken test case

Arkadiusz Ryś před 2 roky
rodič
revize
d0f07b153d
2 změnil soubory, kde provedl 5 přidání a 3 odebrání
  1. 1 1
      mocka/router.py
  2. 4 2
      tests/test_mock.py

+ 1 - 1
mocka/router.py

@@ -43,7 +43,7 @@ class MockRouter(APIRouter):
                     "dout": {
                         "type": "inline",
                         "content": requirements,
-                        "name": "mock_req.txt",
+                        "name": file_path.name,
                         "encoding": mime
                     }
                 }

+ 4 - 2
tests/test_mock.py

@@ -20,7 +20,8 @@ client = TestClient(get_application(Configuration(Server("localhost", 8585))))
 #             }
 
 def test_post_main():
-    requirements = (Path(__file__).parent.parent / Path("data/mock_requirements.txt")).read_text()
+    file_path = Path(__file__).parent.parent / Path("data/mock_requirements.txt")
+    requirements = file_path.read_text()
     mock_input = {
         "ctrl": "cin",
         "input": {
@@ -32,13 +33,14 @@ def test_post_main():
         }
     }
     response = client.post("/", json=mock_input)
-    assert response.status_code == 201
+    assert response.status_code == 200
     assert response.json() == {
         "ctrl": "ok",
         "output": {
             "dout": {
                 "type": "inline",
                 "content": requirements + "\n\nChecked!",
+                "name": file_path.name,
                 "encoding": "text/plain"
             }
         }