Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Dec 13, 2024
1 parent df6e4f8 commit 3a3eddd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ def test_settings(self, avatar):
def test_infrastructures(self, avatar, get, user_data, get_creds):
user_data.return_value = "type = InfrastructureManager; token = access_token"
get_creds.return_value = []
utils.CREDS_CACHE = {}
get.side_effect = self.get_response
self.login(avatar)
res = self.client.get('/infrastructures')
Expand Down Expand Up @@ -431,6 +432,7 @@ def test_configure(self, get, get_creds, avatar):
self.assertEqual(200, res.status_code)
self.assertIn(b"Select Optional Features:", res.data)

utils.CREDS_CACHE = {}
get_creds.return_value = [{"id": "credid", "type": "fedcloud", "host": "site_url",
"vo": "voname", "enabled": True},
{"id": "credid1", "type": "OpenStack", "host": "site_url1",
Expand Down Expand Up @@ -575,6 +577,16 @@ def test_manage_creds(self, get_project_ids, get_sites, get_creds, avatar):
self.assertIn(b'credid', res.data)
self.assertIn(b'site_url', res.data)
self.assertIn(b'fedcloudRow.png', res.data)
self.assertEqual(utils.CREDS_CACHE, {"userid": [{"id": "credid", "type": "fedcloud",
"host": "site_url", "project_id": "project"}]})
self.assertEqual(get_creds.call_count, 2)

res = self.client.get('/manage_creds')
self.assertEqual(200, res.status_code)
self.assertIn(b'credid', res.data)
self.assertIn(b'site_url', res.data)
self.assertIn(b'fedcloudRow.png', res.data)
self.assertEqual(get_creds.call_count, 2)

@patch("app.utils.avatar")
@patch("app.db_cred.DBCredentials.get_cred")
Expand Down

0 comments on commit 3a3eddd

Please sign in to comment.