Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Jun 7, 2024
1 parent adee146 commit c8a462f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
7 changes: 0 additions & 7 deletions test/integration/TestREST.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,6 @@ def test_05_version(self):
self.assertEqual(
resp.text, version, msg="Incorrect version. Expected %s, obtained: %s" % (version, resp.text))

def test_07_index(self):
resp = self.create_request("GET", "/")
self.assertEqual(resp.status_code, 200,
msg="ERROR getting IM index:" + resp.text)
res = json.loads(resp.text)
self.assertEqual(res['openapi'], '3.0.0')

def test_10_list(self):
resp = self.create_request("GET", "/infrastructures")
self.assertEqual(resp.status_code, 200,
Expand Down
7 changes: 0 additions & 7 deletions test/integration/TestREST_JSON.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,6 @@ def wait_inf_state(self, state, timeout, incorrect_states=None, vm_ids=None):

return all_ok

def test_10_index(self):
resp = self.create_request("GET", "/")
self.assertEqual(resp.status_code, 200,
msg="ERROR getting IM index:" + resp.text)
res = json.loads(resp.text)
self.assertEqual(res['openapi'], '3.0.0')

def test_20_create(self):
radl = read_file_as_string('../files/test_simple.json')
resp = self.create_request("POST", "/infrastructures",
Expand Down
12 changes: 10 additions & 2 deletions test/unit/REST.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,8 +570,16 @@ def test_GeVersion(self):

def test_Index(self):
res = self.client.get('/')
self.assertEqual(res.json['openapi'], '3.0.0')
self.assertEqual(res.json['servers'][0]['url'], 'http://localhost/')
self.assertEqual(res.status_code, 302)
self.assertEqual(res.headers['Location'], '/api/docs')
res = self.client.get('http://localhost/api/docs/')
self.assertEqual(res.status_code, 200)
self.assertIn("Swagger UI", res.text)
self.assertIn('"url": "/swagger.json"', res.text)
res = self.client.get('/swagger.json')
self.assertEqual(res.status_code, 200)
self.assertEqual(res.json["openapi"], "3.0.0")


@patch("IM.InfrastructureManager.InfrastructureManager.CreateDiskSnapshot")
def test_CreateDiskSnapshot(self, CreateDiskSnapshot):
Expand Down

0 comments on commit c8a462f

Please sign in to comment.