From bdf304ec2daaf0c32e9f3211c6b849cce034b14b Mon Sep 17 00:00:00 2001 From: Bohdan Odintsov Date: Wed, 8 Jan 2025 23:39:51 +0200 Subject: [PATCH] fixed test --- .../test_node_request_institutional_access.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/api_tests/requests/views/test_node_request_institutional_access.py b/api_tests/requests/views/test_node_request_institutional_access.py index 8801d80bffc..c38fcfcafd3 100644 --- a/api_tests/requests/views/test_node_request_institutional_access.py +++ b/api_tests/requests/views/test_node_request_institutional_access.py @@ -31,9 +31,9 @@ def user_with_affiliation(self, institution): return user @pytest.fixture() - def user_with_affiliation_on_institution_without_access(self, institution2): + def user_with_affiliation_on_institution_without_access(self, institution_without_access): user = AuthUserFactory() - user.add_or_update_affiliated_institution(institution2) + user.add_or_update_affiliated_institution(institution_without_access) return user @pytest.fixture() @@ -47,9 +47,9 @@ def institutional_admin(self, institution): return admin_user @pytest.fixture() - def institutional_admin_on_institution_without_access(self, institution2): + def institutional_admin_on_institution_without_access(self, institution_without_access): admin_user = AuthUserFactory() - institution2.get_group('institutional_admins').user_set.add(admin_user) + institution_without_access.get_group('institutional_admins').user_set.add(admin_user) return admin_user @pytest.fixture() @@ -183,12 +183,12 @@ def test_institutional_admin_invalid_institution(self, app, project, institution assert res.status_code == 400 assert 'Institution is does not exist.' in res.json['errors'][0]['detail'] - def test_institutional_admin_unauth_institution(self, app, project, institution2, institutional_admin, url, create_payload): + def test_institutional_admin_unauth_institution(self, app, project, institution_without_access, institutional_admin, url, create_payload): """ Test that the view authenticates the relationship between the institution and the user and gives the correct - error message when it's unauthorized.' + error message when it's unauthorized """ - create_payload['data']['relationships']['institution']['data']['id'] = institution2._id + create_payload['data']['relationships']['institution']['data']['id'] = institution_without_access._id res = app.post_json_api(url, create_payload, auth=institutional_admin.auth, expect_errors=True) assert res.status_code == 403