diff --git a/tests/conftest.py b/tests/conftest.py index 98b74e6712..d513472ee3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1604,36 +1604,30 @@ def load_default_data_uses(db): DataUse.create(db=db, data=data_use.model_dump(mode="json")) -def generate_role_header_for_user(user) -> Dict[str, str]: - payload = { - JWE_PAYLOAD_ROLES: user.permissions.roles, - JWE_PAYLOAD_CLIENT_ID: user.client.id, - JWE_ISSUED_AT: datetime.now().isoformat(), - } - jwe = generate_jwe(json.dumps(payload), CONFIG.security.app_encryption_key) - return {"Authorization": "Bearer " + jwe} - - @pytest.fixture def owner_auth_header(owner_user): - return generate_role_header_for_user(owner_user) + return generate_role_header_for_user(owner_user, owner_user.client.roles) @pytest.fixture def contributor_auth_header(contributor_user): - return generate_role_header_for_user(contributor_user) + return generate_role_header_for_user( + contributor_user, contributor_user.client.roles + ) @pytest.fixture def viewer_auth_header(viewer_user): - return generate_role_header_for_user(viewer_user) + return generate_role_header_for_user(viewer_user, viewer_user.client.roles) @pytest.fixture def approver_auth_header(approver_user): - return generate_role_header_for_user(approver_user) + return generate_role_header_for_user(approver_user, approver_user.client.roles) @pytest.fixture def viewer_and_approver_auth_header(viewer_and_approver_user): - return generate_role_header_for_user(viewer_and_approver_user) + return generate_role_header_for_user( + viewer_and_approver_user, viewer_and_approver_user.client.roles + ) diff --git a/tests/ops/api/v1/endpoints/test_dataset_test_endpoints.py b/tests/ops/api/v1/endpoints/test_dataset_test_endpoints.py index 0808ea2d4c..c5056aec61 100644 --- a/tests/ops/api/v1/endpoints/test_dataset_test_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_dataset_test_endpoints.py @@ -194,6 +194,8 @@ def test_dataset_reachability( assert set(response.json().keys()) == {"reachable", "details"} +@pytest.mark.integration_external +@pytest.mark.integration_postgres class TestDatasetTest: @pytest.fixture(scope="function") def default_access_policy(self, db) -> None: diff --git a/tests/ops/service/dataset/test_dataset_service.py b/tests/ops/service/dataset/test_dataset_service.py index c60943d4fc..c1e56f8d01 100644 --- a/tests/ops/service/dataset/test_dataset_service.py +++ b/tests/ops/service/dataset/test_dataset_service.py @@ -111,6 +111,8 @@ def test_get_identities_and_references( assert required_identities == expected_required_identities +@pytest.mark.integration_external +@pytest.mark.integration_postgres class TestRunTestAccessRequest: @pytest.mark.usefixtures("postgres_integration_db") def test_run_test_access_request(