From f2a952325c7c108e861dc08a6f7e689bffa746eb Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Tue, 7 May 2024 08:12:45 +0200 Subject: [PATCH 1/6] Increase vers in reqs --- app/__init__.py | 3 ++- requirements.txt | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 949d47826..816bd3266 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -40,7 +40,8 @@ from app.vault_info import VaultInfo from oauthlib.oauth2.rfc6749.errors import InvalidTokenError, TokenExpiredError, InvalidGrantError from werkzeug.exceptions import Forbidden -from flask import Flask, json, render_template, request, redirect, url_for, flash, session, Markup, g, make_response +from flask import Flask, json, render_template, request, redirect, url_for, flash, session, g, make_response +from markupsafe import Markup from functools import wraps from urllib.parse import urlparse from radl import radl_parse diff --git a/requirements.txt b/requirements.txt index cc7dcf1d6..031913b11 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,15 +1,15 @@ -Flask_Dance==6.2.0 -Werkzeug==2.3.8 -Flask==2.3.3 +Flask_Dance==7.1.0 +Werkzeug==3.0.3 +Flask==3.0.3 requests==2.31.0 PyYAML==6.0.1 -packaging==23.1 +packaging==24.0 xmltodict==0.13.0 radl==1.3.2 -cryptography==42.0.4 +cryptography==42.0.7 apscheduler==3.10.4 # 3.8.1 version fails Flask-APScheduler==1.13.1 Flask-WTF==1.2.1 -hvac==1.2.1 -tosca-parser==2.9.1 -mysqlclient==2.2.1 +hvac==2.2.0 +tosca-parser==2.10.0 +mysqlclient==2.2.4 From 6d615b18668bb5011390b1de1cc66382812130e2 Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Tue, 7 May 2024 08:15:28 +0200 Subject: [PATCH 2/6] Change deprecated warn to warning --- app/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 816bd3266..4e227af55 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -1231,7 +1231,7 @@ def addresources(infid=None): images = [(image['uri'], image['name'], image['uri'] == image_url_str) for image in response.json()["images"]] except Exception as ex: - app.logger.warn('Error getting site images: %s', (ex)) + app.logger.warning('Error getting site images: %s', (ex)) return render_template('addresource.html', infid=infid, systems=systems, image_url=image_url, images=images) @@ -1505,7 +1505,7 @@ def reconfigure(infid=None): raise Exception(response.text) template = response.text except Exception as ex: - app.logger.warn("Error getting infrastructure template: %s" % ex) + app.logger.warning("Error getting infrastructure template: %s" % ex) infra_name = "" inputs = utils.getReconfigureInputs(template) @@ -1524,7 +1524,7 @@ def logout(next_url=None): try: oidc_blueprint.session.get("/logout") except Exception as ex: - app.logger.warn("Error in OIDC logout: %s" % ex) + app.logger.warning("Error in OIDC logout: %s" % ex) return redirect(url_for('login', next_url=next_url)) @app.errorhandler(403) From 7e3fdc6fa46dbd3077c94c9fb2576d75b3ab28e0 Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Tue, 7 May 2024 08:21:12 +0200 Subject: [PATCH 3/6] Change deprecated assertEquals --- app/tests/test_app.py | 40 ++++++++++++++++++++-------------------- app/tests/test_infra.py | 8 ++++---- app/tests/test_utils.py | 6 +++--- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/app/tests/test_app.py b/app/tests/test_app.py index c611e4def..5a5814b6b 100644 --- a/app/tests/test_app.py +++ b/app/tests/test_app.py @@ -253,7 +253,7 @@ def test_manageinf_stop(self, flash, avatar, put, user_data): res = self.client.post('/manage_inf/infid/stop') self.assertEqual(302, res.status_code) self.assertIn('/infrastructures', res.headers['location']) - self.assertEquals(flash.call_args_list[0][0], + self.assertEqual(flash.call_args_list[0][0], ("Operation 'stop' successfully made on Infrastructure ID: infid", 'success')) @patch("app.utils.getUserAuthData") @@ -268,7 +268,7 @@ def test_manageinf_change_user(self, flash, avatar, post, user_data): res = self.client.post('/manage_inf/infid/change_user', data=params) self.assertEqual(302, res.status_code) self.assertIn('/infrastructures', res.headers['location']) - self.assertEquals(flash.call_args_list[0][0], + self.assertEqual(flash.call_args_list[0][0], ("Infrastructure owner successfully changed.", 'success')) @patch("app.utils.getUserAuthData") @@ -284,7 +284,7 @@ def test_manageinf_migrate(self, flash, avatar, get, put, user_data): res = self.client.post('/manage_inf/infid/migrate', data={"new_im_url": "http://newim.com/im"}) self.assertEqual(302, res.status_code) self.assertIn('/infrastructures', res.headers['location']) - self.assertEquals(flash.call_args_list[0][0], + self.assertEqual(flash.call_args_list[0][0], ("Infrastructure successfully migrated to http://server.com/im/infrastructures/infid.", 'success')) @@ -311,7 +311,7 @@ def test_managevm_stop(self, flash, avatar, put, user_data): res = self.client.post('/managevm/stop/infid/0') self.assertEqual(302, res.status_code) self.assertIn('/vminfo?infId=infid&vmId=0', res.headers['location']) - self.assertEquals(flash.call_args_list[0][0], ("Operation 'stop' successfully made on VM ID: 0", 'success')) + self.assertEqual(flash.call_args_list[0][0], ("Operation 'stop' successfully made on VM ID: 0", 'success')) @patch("app.utils.getUserAuthData") @patch('requests.delete') @@ -324,7 +324,7 @@ def test_managevm_delete(self, flash, avatar, delete, user_data): res = self.client.post('/managevm/terminate/infid/0') self.assertEqual(302, res.status_code) self.assertIn('/infrastructures', res.headers['location']) - self.assertEquals(flash.call_args_list[0][0], ("Operation 'terminate' successfully made on VM ID: 0", + self.assertEqual(flash.call_args_list[0][0], ("Operation 'terminate' successfully made on VM ID: 0", 'success')) @patch("app.utils.getUserAuthData") @@ -344,7 +344,7 @@ def test_managevm_resize(self, flash, avatar, put, get, user_data): res = self.client.post('/managevm/resize/infid/0', data=params) self.assertEqual(302, res.status_code) self.assertIn('/vminfo?infId=infid&vmId=0', res.headers['location']) - self.assertEquals(flash.call_args_list[0][0], ("Operation 'resize' successfully made on VM ID: 0", 'success')) + self.assertEqual(flash.call_args_list[0][0], ("Operation 'resize' successfully made on VM ID: 0", 'success')) @patch("app.utils.getUserAuthData") @patch('requests.put') @@ -357,7 +357,7 @@ def test_reconfigure(self, flash, avatar, put, user_data): res = self.client.post('/manage_inf/infid/reconfigure') self.assertEqual(302, res.status_code) self.assertIn('/infrastructures', res.headers['location']) - self.assertEquals(flash.call_args_list[0][0], ("Reconfiguration process successfuly started.", 'success')) + self.assertEqual(flash.call_args_list[0][0], ("Reconfiguration process successfuly started.", 'success')) @patch("app.utils.getUserAuthData") @patch('requests.get') @@ -418,7 +418,7 @@ def test_delete(self, flash, avatar, delete, user_data): res = self.client.post('/manage_inf/infid/delete') self.assertEqual(302, res.status_code) self.assertIn('/infrastructures', res.headers['location']) - self.assertEquals(flash.call_args_list[0][0], ("Infrastructure 'infid' successfuly deleted.", 'success')) + self.assertEqual(flash.call_args_list[0][0], ("Infrastructure 'infid' successfuly deleted.", 'success')) @patch("app.utils.avatar") @patch("app.db_cred.DBCredentials.get_creds") @@ -506,7 +506,7 @@ def test_submit(self, flash, get_ssh_keys, get_cred, get_site_info, avatar, post res = self.client.post('/submit?template=simple-node-disk.yml', data=params) self.assertEqual(302, res.status_code) self.assertIn('/infrastructures', res.headers['location']) - self.assertEquals(flash.call_count, 0) + self.assertEqual(flash.call_count, 0) @patch('app.utils.get_site_info') @patch("app.utils.getUserAuthData") @@ -532,7 +532,7 @@ def test_submit2(self, flash, get_cred, avatar, post, user_data, get_site_info): res = self.client.post('/submit?template=simple-node-disk.yml', data=params) self.assertEqual(302, res.status_code) self.assertIn('/infrastructures', res.headers['location']) - self.assertEquals(flash.call_count, 0) + self.assertEqual(flash.call_count, 0) @patch("app.utils.getUserAuthData") @patch('requests.post') @@ -556,7 +556,7 @@ def test_submit_tosca(self, flash, get_cred, get_site_info, avatar, post, user_d res = self.client.post('/submit?template=tosca.yml', data=params) self.assertEqual(302, res.status_code) self.assertIn('/infrastructures', res.headers['location']) - self.assertEquals(flash.call_count, 0) + self.assertEqual(flash.call_count, 0) @patch("app.utils.avatar") @patch("app.db_cred.DBCredentials.get_creds") @@ -596,8 +596,8 @@ def test_write_creds(self, flash, write_creds, get_cred, avatar): "type": "OpenNebula"}) self.assertEqual(302, res.status_code) self.assertIn('/manage_creds', res.headers['location']) - self.assertEquals(flash.call_args_list[0][0], ("Credentials successfully written!", 'success')) - self.assertEquals(write_creds.call_args_list[0][0], ('credid', 'userid', {'host': 'SITE_URL2', + self.assertEqual(flash.call_args_list[0][0], ("Credentials successfully written!", 'success')) + self.assertEqual(write_creds.call_args_list[0][0], ('credid', 'userid', {'host': 'SITE_URL2', 'id': 'credid', 'type': "OpenNebula"}, False)) res = self.client.post('/write_creds?cred_id=&cred_type=OpenNebula', data={"host": "SITE_URL3", @@ -605,8 +605,8 @@ def test_write_creds(self, flash, write_creds, get_cred, avatar): "type": "OpenNebula"}) self.assertEqual(302, res.status_code) self.assertIn('/manage_creds', res.headers['location']) - self.assertEquals(flash.call_args_list[1][0], ("Credentials successfully written!", 'success')) - self.assertEquals(write_creds.call_args_list[1][0], ('credid', 'userid', {'host': 'SITE_URL3', + self.assertEqual(flash.call_args_list[1][0], ("Credentials successfully written!", 'success')) + self.assertEqual(write_creds.call_args_list[1][0], ('credid', 'userid', {'host': 'SITE_URL3', 'id': 'credid', 'type': 'OpenNebula'}, True)) @@ -619,7 +619,7 @@ def test_delete_creds(self, flash, delete_cred, avatar): res = self.client.get('/delete_creds?service_id=SERVICE_ID') self.assertEqual(302, res.status_code) self.assertIn('/manage_creds', res.headers['location']) - self.assertEquals(flash.call_args_list[0][0], ("Credentials successfully deleted!", 'success')) + self.assertEqual(flash.call_args_list[0][0], ("Credentials successfully deleted!", 'success')) @patch("app.utils.getUserAuthData") @patch('requests.get') @@ -645,7 +645,7 @@ def test_addresources(self, flash, avatar, post, get, user_data): self.login(avatar) res = self.client.post('/addresources/infid', data={"wn_num": "1"}) self.assertEqual(302, res.status_code) - self.assertEquals(flash.call_args_list[0][0], ("1 nodes added successfully", 'success')) + self.assertEqual(flash.call_args_list[0][0], ("1 nodes added successfully", 'success')) @patch("app.utils.avatar") @patch("app.utils.getUserAuthData") @@ -662,7 +662,7 @@ def test_quotas(self, get, user_data, avatar): "instances": {"used": 1, "limit": 10}, "floating_ips": {"used": 1, "limit": 10}, "security_groups": {"used": 1, "limit": 10}} - self.assertEquals(expected_res, json.loads(res.data)) + self.assertEqual(expected_res, json.loads(res.data)) @patch("app.utils.avatar") @patch("app.ssh_key.SSHKey.get_ssh_keys") @@ -697,7 +697,7 @@ def test_delete_ssh_key(self, flash, delete_ssh_key, avatar): res = self.client.get('/delete_ssh_key?ssh_id=1') self.assertEqual(302, res.status_code) self.assertIn('/ssh_key', res.headers['location']) - self.assertEquals(flash.call_args_list[0][0], ("SSH Key successfully deleted!", 'success')) + self.assertEqual(flash.call_args_list[0][0], ("SSH Key successfully deleted!", 'success')) @patch("app.utils.getUserAuthData") @patch('requests.delete') @@ -710,7 +710,7 @@ def test_removeresources(self, flash, avatar, delete, user_data): res = self.client.post('/manage_inf/infid/removeresources', data={'vm_list': '1,2'}) self.assertEqual(302, res.status_code) self.assertIn('/infrastructures', res.headers['location']) - self.assertEquals(flash.call_args_list[0][0], ("VMs 1,2 successfully deleted.", 'success')) + self.assertEqual(flash.call_args_list[0][0], ("VMs 1,2 successfully deleted.", 'success')) @patch("app.utils.getUserAuthData") @patch('requests.get') diff --git a/app/tests/test_infra.py b/app/tests/test_infra.py index eb8e9385a..2c1227b6a 100644 --- a/app/tests/test_infra.py +++ b/app/tests/test_infra.py @@ -37,22 +37,22 @@ def test_get_infra(self): res.close() res = infra.get_infra("infid") - self.assertEquals(res, {'name': 'infra_name'}) + self.assertEqual(res, {'name': 'infra_name'}) def test_write_infra(self): infra = Infrastructures("sqlite:///tmp/creds.db") infra.write_infra("infid", {"name": "infra_name"}) res = infra.get_infra("infid") - self.assertEquals(res, {"name": "infra_name"}) + self.assertEqual(res, {"name": "infra_name"}) infra.write_infra("infid", {"state": "infra_state"}) res = infra.get_infra("infid") - self.assertEquals(res, {"name": "infra_name", "state": "infra_state"}) + self.assertEqual(res, {"name": "infra_name", "state": "infra_state"}) def test_delete_infra(self): infra = Infrastructures("sqlite:///tmp/creds.db") infra.delete_infra("infid") res = infra.get_infra("infid") - self.assertEquals(res, {}) + self.assertEqual(res, {}) if __name__ == '__main__': diff --git a/app/tests/test_utils.py b/app/tests/test_utils.py index 0843b76de..34bab3c61 100644 --- a/app/tests/test_utils.py +++ b/app/tests/test_utils.py @@ -30,7 +30,7 @@ def test_getUserVOs(self): 'urn:mace:egi.eu:group:vo.test.egi.eu:role=vm_operator#aai.egi.eu', 'urn:mace:egi.eu:group:vo.test2.egi.eu:role=member#aai.egi.eu'] res = utils.getUserVOs(entitlements) - self.assertEquals(res, ['vo.test.egi.eu', 'vo.test2.egi.eu']) + self.assertEqual(res, ['vo.test.egi.eu', 'vo.test2.egi.eu']) @patch("app.utils.getCachedProjectIDs") @patch("app.utils.getCachedSiteList") @@ -52,7 +52,7 @@ def test_getUserAuthData(self, getCachedSiteList, getCachedProjectIDs): flask_context.g.settings = MagicMock() flask_context.g.settings.im_auth = "" res = utils.getUserAuthData("token", cred, "user") - self.assertEquals(res, ("type = InfrastructureManager; token = token\\nid = one; type = 'OpenNebula';" + self.assertEqual(res, ("type = InfrastructureManager; token = token\\nid = one; type = 'OpenNebula';" " username = 'user'; password = 'pass'\\n" "id = fed; type = OpenStack; username = egi.eu;" " tenant = oidc; auth_version = 3.x_oidc_access_token; host =" @@ -64,7 +64,7 @@ def test_getUserAuthData(self, getCachedSiteList, getCachedProjectIDs): flask_context.g.settings.im_auth = "Bearer" res = utils.getUserAuthData("token", cred, "user") - self.assertEquals(res, ("Bearer token")) + self.assertEqual(res, ("Bearer token")) def test_merge_template(self): template = {"topology_template": {"node_templates": {"n1": {"type": "Compute"}}}} From 46b574ceeca0a9a39dd3e33e96a11b516c4fbf65 Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Tue, 7 May 2024 08:25:29 +0200 Subject: [PATCH 4/6] Fix style --- app/tests/test_app.py | 16 ++++++++-------- app/tests/test_utils.py | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/tests/test_app.py b/app/tests/test_app.py index 5a5814b6b..2819ef931 100644 --- a/app/tests/test_app.py +++ b/app/tests/test_app.py @@ -254,7 +254,7 @@ def test_manageinf_stop(self, flash, avatar, put, user_data): self.assertEqual(302, res.status_code) self.assertIn('/infrastructures', res.headers['location']) self.assertEqual(flash.call_args_list[0][0], - ("Operation 'stop' successfully made on Infrastructure ID: infid", 'success')) + ("Operation 'stop' successfully made on Infrastructure ID: infid", 'success')) @patch("app.utils.getUserAuthData") @patch('requests.post') @@ -269,7 +269,7 @@ def test_manageinf_change_user(self, flash, avatar, post, user_data): self.assertEqual(302, res.status_code) self.assertIn('/infrastructures', res.headers['location']) self.assertEqual(flash.call_args_list[0][0], - ("Infrastructure owner successfully changed.", 'success')) + ("Infrastructure owner successfully changed.", 'success')) @patch("app.utils.getUserAuthData") @patch('requests.put') @@ -285,8 +285,8 @@ def test_manageinf_migrate(self, flash, avatar, get, put, user_data): self.assertEqual(302, res.status_code) self.assertIn('/infrastructures', res.headers['location']) self.assertEqual(flash.call_args_list[0][0], - ("Infrastructure successfully migrated to http://server.com/im/infrastructures/infid.", - 'success')) + ("Infrastructure successfully migrated to http://server.com/im/infrastructures/infid.", + 'success')) @patch("app.utils.getUserAuthData") @patch('requests.get') @@ -325,7 +325,7 @@ def test_managevm_delete(self, flash, avatar, delete, user_data): self.assertEqual(302, res.status_code) self.assertIn('/infrastructures', res.headers['location']) self.assertEqual(flash.call_args_list[0][0], ("Operation 'terminate' successfully made on VM ID: 0", - 'success')) + 'success')) @patch("app.utils.getUserAuthData") @patch('requests.get') @@ -598,7 +598,7 @@ def test_write_creds(self, flash, write_creds, get_cred, avatar): self.assertIn('/manage_creds', res.headers['location']) self.assertEqual(flash.call_args_list[0][0], ("Credentials successfully written!", 'success')) self.assertEqual(write_creds.call_args_list[0][0], ('credid', 'userid', {'host': 'SITE_URL2', - 'id': 'credid', 'type': "OpenNebula"}, False)) + 'id': 'credid', 'type': "OpenNebula"}, False)) res = self.client.post('/write_creds?cred_id=&cred_type=OpenNebula', data={"host": "SITE_URL3", "id": "credid", @@ -607,8 +607,8 @@ def test_write_creds(self, flash, write_creds, get_cred, avatar): self.assertIn('/manage_creds', res.headers['location']) self.assertEqual(flash.call_args_list[1][0], ("Credentials successfully written!", 'success')) self.assertEqual(write_creds.call_args_list[1][0], ('credid', 'userid', {'host': 'SITE_URL3', - 'id': 'credid', - 'type': 'OpenNebula'}, True)) + 'id': 'credid', + 'type': 'OpenNebula'}, True)) @patch("app.utils.avatar") @patch("app.db_cred.DBCredentials.delete_cred") diff --git a/app/tests/test_utils.py b/app/tests/test_utils.py index 34bab3c61..1d23a1a7e 100644 --- a/app/tests/test_utils.py +++ b/app/tests/test_utils.py @@ -53,14 +53,14 @@ def test_getUserAuthData(self, getCachedSiteList, getCachedProjectIDs): flask_context.g.settings.im_auth = "" res = utils.getUserAuthData("token", cred, "user") self.assertEqual(res, ("type = InfrastructureManager; token = token\\nid = one; type = 'OpenNebula';" - " username = 'user'; password = 'pass'\\n" - "id = fed; type = OpenStack; username = egi.eu;" - " tenant = oidc; auth_version = 3.x_oidc_access_token; host =" - " https://api.cloud.ifca.es:5000; password = 'token'; vo = vo_name;" - " domain = project_id\\n" - "id = ch; type = OpenStack; auth_version = 3.x_password;" - " host = https://identity-f1a.cloudandheat.com:5000; username = user;" - " tenant = tenant; password = 'pass'")) + " username = 'user'; password = 'pass'\\n" + "id = fed; type = OpenStack; username = egi.eu;" + " tenant = oidc; auth_version = 3.x_oidc_access_token; host =" + " https://api.cloud.ifca.es:5000; password = 'token'; vo = vo_name;" + " domain = project_id\\n" + "id = ch; type = OpenStack; auth_version = 3.x_password;" + " host = https://identity-f1a.cloudandheat.com:5000; username = user;" + " tenant = tenant; password = 'pass'")) flask_context.g.settings.im_auth = "Bearer" res = utils.getUserAuthData("token", cred, "user") From 6312345ab09ca8897a56a419ed7a9a993a6f5bca Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Tue, 7 May 2024 08:29:10 +0200 Subject: [PATCH 5/6] Change deprecated assertEquals --- app/tests/test_appdb.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/tests/test_appdb.py b/app/tests/test_appdb.py index 7b4662894..2df0cb6b8 100644 --- a/app/tests/test_appdb.py +++ b/app/tests/test_appdb.py @@ -57,7 +57,7 @@ def requests_response(method, url, **kwargs): def test_appdb_call(self, requests): requests.side_effect = self.requests_response res = appdb.appdb_call('/rest/1.0/vos') - self.assertEquals(res["vo:vo"]["@name"], "acc-comp.egi.eu") + self.assertEqual(res["vo:vo"]["@name"], "acc-comp.egi.eu") @patch('app.appdb.appdb_call') def test_vo_list(self, appdb_call): @@ -65,14 +65,14 @@ def test_vo_list(self, appdb_call): vos = '' appdb_call.return_value = xmltodict.parse(vos.replace('\n', '')) res = appdb.get_vo_list() - self.assertEquals(res, ['acc-comp.egi.eu']) + self.assertEqual(res, ['acc-comp.egi.eu']) appdb.VO_LIST = [] vos = '' vos += '' appdb_call.return_value = xmltodict.parse(vos)["appdb:appdb"] res = appdb.get_vo_list() - self.assertEquals(res, ['acc-comp.egi.eu', 'vo.access.egi.eu']) + self.assertEqual(res, ['acc-comp.egi.eu', 'vo.access.egi.eu']) @patch('app.appdb.appdb_call') def test_get_services(self, appdb_call): @@ -84,7 +84,7 @@ def test_get_services(self, appdb_call): """ appdb_call.return_value = xmltodict.parse(site.replace('\n', '')) res = appdb._get_services() - self.assertEquals(res[0]["@type"], "openstack") + self.assertEqual(res[0]["@type"], "openstack") site = """ @@ -97,7 +97,7 @@ def test_get_services(self, appdb_call): """ appdb_call.return_value = xmltodict.parse(site.replace('\n', ''))["appdb:appdb"] res = appdb._get_services() - self.assertEquals(res[0]["@type"], "openstack") + self.assertEqual(res[0]["@type"], "openstack") @patch('app.appdb.appdb_call') @patch('app.appdb._get_services') @@ -106,7 +106,7 @@ def test_get_sites(self, get_services, appdb_call): va_provider = read_file_as_string("files/va_provider.xml") appdb_call.return_value = xmltodict.parse(va_provider.replace('\n', ''))["appdb:appdb"] res = appdb.get_sites("vo.access.egi.eu") - self.assertEquals(res, {'CESGA': {'url': 'https://fedcloud-osservices.egi.cesga.es:5000', + self.assertEqual(res, {'CESGA': {'url': 'https://fedcloud-osservices.egi.cesga.es:5000', 'state': '', 'id': '1', 'name': 'CESGA'}}) # self.assertIn(appdb_call.call_args_list[0][0][0], ["/rest/1.0/va_providers/1"]) @@ -120,7 +120,7 @@ def test_get_project_ids(self, appdb_call): """ appdb_call.return_value = xmltodict.parse(shares.replace('\n', '')) res = appdb.get_project_ids("11548G0") - self.assertEquals(res, {"vo.access.egi.eu": "3a8e9d966e644405bf19b536adf7743d", + self.assertEqual(res, {"vo.access.egi.eu": "3a8e9d966e644405bf19b536adf7743d", "covid-19.eosc-synergy.eu": "972298c557184a2192ebc861f3184da8"}) @patch('app.appdb.appdb_call') @@ -131,7 +131,7 @@ def test_get_images(self, appdb_call): """ appdb_call.return_value = xmltodict.parse(images.replace('\n', '')) res = appdb.get_images('11548G0', 'vo.access.egi.eu') - self.assertEquals(res, [("ScipionCloud-GPU", "scipioncloud.gpu")]) + self.assertEqual(res, [("ScipionCloud-GPU", "scipioncloud.gpu")]) if __name__ == '__main__': From af993a04537611d3cc3f56fd20ed274c2a54be98 Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Tue, 7 May 2024 08:31:23 +0200 Subject: [PATCH 6/6] Fix style --- app/tests/test_appdb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/tests/test_appdb.py b/app/tests/test_appdb.py index 2df0cb6b8..243f77bd8 100644 --- a/app/tests/test_appdb.py +++ b/app/tests/test_appdb.py @@ -107,7 +107,7 @@ def test_get_sites(self, get_services, appdb_call): appdb_call.return_value = xmltodict.parse(va_provider.replace('\n', ''))["appdb:appdb"] res = appdb.get_sites("vo.access.egi.eu") self.assertEqual(res, {'CESGA': {'url': 'https://fedcloud-osservices.egi.cesga.es:5000', - 'state': '', 'id': '1', 'name': 'CESGA'}}) + 'state': '', 'id': '1', 'name': 'CESGA'}}) # self.assertIn(appdb_call.call_args_list[0][0][0], ["/rest/1.0/va_providers/1"]) @patch('app.appdb.appdb_call') @@ -121,7 +121,7 @@ def test_get_project_ids(self, appdb_call): appdb_call.return_value = xmltodict.parse(shares.replace('\n', '')) res = appdb.get_project_ids("11548G0") self.assertEqual(res, {"vo.access.egi.eu": "3a8e9d966e644405bf19b536adf7743d", - "covid-19.eosc-synergy.eu": "972298c557184a2192ebc861f3184da8"}) + "covid-19.eosc-synergy.eu": "972298c557184a2192ebc861f3184da8"}) @patch('app.appdb.appdb_call') def test_get_images(self, appdb_call):