diff --git a/pytest_oarepo/communities/fixtures.py b/pytest_oarepo/communities/fixtures.py index bd407e8..7656f25 100644 --- a/pytest_oarepo/communities/fixtures.py +++ b/pytest_oarepo/communities/fixtures.py @@ -62,7 +62,7 @@ def invite(user_fixture, community_id, role): system_identity, community_id, invitation_data ) index_users() - user_fixture._identity = None + user_fixture._identity = None # otherwise inviting user to more than one community doesn't actualize identity return invite diff --git a/pytest_oarepo/fixtures.py b/pytest_oarepo/fixtures.py index d2540ca..65c1fe8 100644 --- a/pytest_oarepo/fixtures.py +++ b/pytest_oarepo/fixtures.py @@ -16,18 +16,6 @@ def vocab_cf(app, db, cache): prepare_cf_indices() - -# todo - ask whether to use as fixture or function -""" -@pytest.fixture() -def link2testclient(): - def _link2testclient(link, ui=False): - base_string = "https://127.0.0.1:5000/api/" if not ui else "https://127.0.0.1:5000/" - return link[len(base_string) - 1 :] - return _link2testclient -""" - - class LoggedClient: def __init__(self, client, user_fixture): self.client = client diff --git a/pytest_oarepo/functions.py b/pytest_oarepo/functions.py index d3f050e..8985fc4 100644 --- a/pytest_oarepo/functions.py +++ b/pytest_oarepo/functions.py @@ -1,6 +1,8 @@ from collections import defaultdict # todo - it's kind of ugly to request each time we need things like this but can't be called with autouse +# the question - if there is a reason to separate using functions as fixtures and the standard way - what it is? +# and how to determine where to use what? def link2testclient(link, ui=False): base_string = "https://127.0.0.1:5000/api/" if not ui else "https://127.0.0.1:5000/" return link[len(base_string) - 1 :] diff --git a/pytest_oarepo/records.py b/pytest_oarepo/records.py index 67fcefd..dac9860 100644 --- a/pytest_oarepo/records.py +++ b/pytest_oarepo/records.py @@ -102,7 +102,7 @@ def _create_draft( additional_data=additional_data, **service_kwargs, ) - url = f"{urls['BASE_URL']}{draft['id']}/draft" + url = f"{urls['BASE_URL']}{draft['id']}/draft" # todo repeated code + it would probably make more sense to use service outputs as defaults - requires rewriting tests in requests and communities if expand: url += "?expand=true" return client.get(url) @@ -126,7 +126,7 @@ def record(client, custom_workflow=None, additional_data=None, expand=True): @pytest.fixture() -def upload_file(record_service): +def upload_file(): def _upload_file(files_service, identity, record_id): # upload file # Initialize files upload diff --git a/setup.cfg b/setup.cfg index 9a473a7..a4ef592 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,4 +20,5 @@ local = deepmerge oarepo-runtime oarepo-workflows - oarepo-requests \ No newline at end of file + oarepo-requests + oarepo-communities \ No newline at end of file