File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 22import logging
33import os
44import time
5+ import yaml
56
67from fastapi .testclient import TestClient
78
89from bibigrid .core .startup_rest import app
9- from bibigrid .core .utility .paths .basic_path import ROOT_PATH
10+ from bibigrid .core .utility .paths .basic_path import ROOT_PATH , CLOUD_NODE_REQUIREMENTS_PATH
1011
1112logging .basicConfig (level = logging .DEBUG )
1213
1617CLUSTER_ID = "4242424242"
1718
1819client = TestClient (app )
20+ # Read the cloud_node_requirements YAML file and load it into a dictionary
1921
22+ with open (CLOUD_NODE_REQUIREMENTS_PATH , "r" , encoding = "utf-8" ) as cloud_node_requirements_file :
23+ cloud_node_requirements = yaml .safe_load (cloud_node_requirements_file )
24+
25+ def test_get_requirements ():
26+ response = client .get ("/bibigrid/requirements" )
27+
28+ # Assert the response status code is 200
29+ assert response .status_code == 200
30+
31+ # Assert the structure of the returned JSON content
32+ assert response .json () == {"cloud_node_requirements" : cloud_node_requirements }
33+ logging .info (f"Response: { response .json ()} " )
2034
2135def test_validate ():
2236 response = client .post (f"/bibigrid/validate?cluster_id={ CLUSTER_ID } " , json = configurations_json )
@@ -65,6 +79,7 @@ def test_state(state):
6579
6680# Run tests
6781if __name__ == "__main__" :
82+ test_get_requirements ()
6883 test_validate ()
6984 test_create ()
7085 test_state ("starting" )
You can’t perform that action at this time.
0 commit comments