Skip to content

Commit

Permalink
Remove replaced tests
Browse files Browse the repository at this point in the history
  • Loading branch information
index-git committed Dec 20, 2023
1 parent a750618 commit 1f3495f
Showing 1 changed file with 1 addition and 42 deletions.
43 changes: 1 addition & 42 deletions tests/static_data/single_publication/publications_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

import crs as crs_def
from layman import app, util as layman_util, settings
from layman import app, settings
from layman.common import bbox as bbox_util
from layman.layer.filesystem import gdal
from test_tools import assert_util, process_client
Expand Down Expand Up @@ -44,47 +44,6 @@ def test_infos(workspace, publ_type, publication):
assert rest_detail['geodata_type'] == exp_geodata_type


@pytest.mark.parametrize('workspace, publ_type, publication', data.LIST_ALL_PUBLICATIONS)
@pytest.mark.usefixtures('oauth2_provider_mock', 'ensure_layman')
def test_auth_get_publications(workspace, publ_type, publication):
ensure_publication(workspace, publ_type, publication)

all_auth_info = util.get_users_and_headers_for_publication(workspace, publ_type, publication)
headers_list_in = all_auth_info['read'][util.KEY_AUTH][util.KEY_HEADERS]
headers_list_out = all_auth_info['read'][util.KEY_NOT_AUTH][util.KEY_HEADERS]

for in_headers in headers_list_in:
infos = process_client.get_publications(publ_type, workspace=workspace, headers=in_headers)
publication_names = [li['name'] for li in infos]
assert publication in publication_names, in_headers

for out_headers in headers_list_out:
infos = process_client.get_publications(publ_type, workspace=workspace, headers=out_headers)
publication_names = [li['name'] for li in infos]
assert publication not in publication_names, out_headers


@pytest.mark.parametrize('workspace, publ_type, publication', data.LIST_ALL_PUBLICATIONS)
@pytest.mark.usefixtures('oauth2_provider_mock', 'ensure_layman')
def test_auth_get_publication(workspace, publ_type, publication):
ensure_publication(workspace, publ_type, publication)

all_auth_info = util.get_users_and_headers_for_publication(workspace, publ_type, publication)
readers = all_auth_info['read'][util.KEY_AUTH][util.KEY_USERS]
non_readers = all_auth_info['read'][util.KEY_NOT_AUTH][util.KEY_USERS]

for user in readers:
with app.app_context():
pub_info = layman_util.get_publication_info(workspace, publ_type, publication, {'actor_name': user})
assert pub_info['name'] == publication, f'pub_info={pub_info}'
assert pub_info['type'] == publ_type, f'pub_info={pub_info}'

for user in non_readers:
with app.app_context():
pub_info = layman_util.get_publication_info(workspace, publ_type, publication, {'actor_name': user})
assert not pub_info, pub_info


@pytest.mark.parametrize('workspace, publ_type, publication', data.LIST_ALL_PUBLICATIONS)
@pytest.mark.usefixtures('oauth2_provider_mock', 'ensure_layman')
def test_internal_info(workspace, publ_type, publication):
Expand Down

0 comments on commit 1f3495f

Please sign in to comment.