Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronald Krist committed Jan 14, 2025
1 parent 44c63c1 commit 320f6c6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion pytest_oarepo/communities/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 0 additions & 12 deletions pytest_oarepo/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions pytest_oarepo/functions.py
Original file line number Diff line number Diff line change
@@ -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 :]
Expand Down
4 changes: 2 additions & 2 deletions pytest_oarepo/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ local =
deepmerge
oarepo-runtime
oarepo-workflows
oarepo-requests
oarepo-requests
oarepo-communities

0 comments on commit 320f6c6

Please sign in to comment.