Skip to content

Commit

Permalink
Resolved merge conflicts between draft-reg-permission and feature/b-a…
Browse files Browse the repository at this point in the history
…nd-i-24-14
  • Loading branch information
Uditi Mehta authored and Uditi Mehta committed Aug 1, 2024
1 parent 3897e7f commit 930e25d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def invisible_and_inactive_schema():
class TestDraftRegistrationListTopLevelEndpoint:

@pytest.fixture()
def url_draft_registrations(self, project_public):
return f'/{API_BASE}draft_registrations/?'
def url_draft_registrations(self):
return f'/{API_BASE}draft_registrations/'

@pytest.fixture()
def user(self):
Expand Down
11 changes: 7 additions & 4 deletions api_tests/nodes/views/test_node_draft_registration_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,13 @@ def test_type_is_draft_registrations(self, app, user, metaschema_open_ended, url
assert res.status_code == 409

def test_admin_can_create_draft(
self, app, user, project_public, url_draft_registrations,
payload, metaschema_open_ended):
url = f'{url_draft_registrations}&embed=branched_from&embed=initiator'
res = app.post_json_api(url, payload, auth=user.auth)
self, app, user, project_public, url_draft_registrations, payload, metaschema_open_ended
):
res = app.post_json_api(
f'{url_draft_registrations}&embed=branched_from&embed=initiator',
payload,
auth=user.auth
)
assert res.status_code == 201
data = res.json['data']
assert metaschema_open_ended._id in data['relationships']['registration_schema']['links']['related']['href']
Expand Down
20 changes: 8 additions & 12 deletions api_tests/users/views/test_user_draft_registration_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ def draft_registration(self, user, project_public, schema):
branched_from=project_public
)

@pytest.fixture()
def url_draft_registrations(self, project_public):
return f'/{API_BASE}users/me/draft_registrations/'

def test_unacceptable_methods(self):
assert only_supports_methods(UserDraftRegistrations, ['GET'])

Expand Down Expand Up @@ -137,16 +133,16 @@ def test_draft_with_deleted_registered_node_shows_up_in_draft_list(
assert data[0]['id'] == draft_registration._id
assert data[0]['attributes']['registration_metadata'] == {}

def test_cannot_access_other_users_draft_registration(
self, app, user, other_admin, project_public,
draft_registration, schema):
url = f'/{API_BASE}users/{user._id}/draft_registrations/'
res = app.get(url, auth=other_admin.auth, expect_errors=True)
def test_cannot_access_other_users_draft_registration(self, app, user, other_admin, draft_registration, schema):
res = app.get(
f'/{API_BASE}users/{user._id}/draft_registrations/',
auth=other_admin.auth,
expect_errors=True
)
assert res.status_code == 403

def test_can_access_own_draft_registrations_with_guid(
self, app, user, draft_registration):
url = f'/{API_BASE}users/{user._id}/draft_registrations/'
def test_can_access_own_draft_registrations_with_guid(self, app, user, draft_registration):
url = '/{}users/{}/draft_registrations/'.format(API_BASE, user._id)
res = app.get(url, auth=user.auth, expect_errors=True)
assert res.status_code == 200
assert len(res.json['data']) == 1

0 comments on commit 930e25d

Please sign in to comment.