From 3a3eddde32aa02bf09ba33a027694c826bbd2613 Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Fri, 13 Dec 2024 11:36:04 +0100 Subject: [PATCH] Fix test --- app/tests/test_app.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/tests/test_app.py b/app/tests/test_app.py index 197c0bf4..1a7158da 100644 --- a/app/tests/test_app.py +++ b/app/tests/test_app.py @@ -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') @@ -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", @@ -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")