-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from oarepo/Krist/be-474-filters-on-apirequests
Krist/be 474 filters on apirequests
- Loading branch information
Showing
6 changed files
with
134 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
def community_role_mappings(identity): | ||
community_roles = [ | ||
(n.value, n.role) for n in identity.provides if n.method == "community" | ||
] | ||
return [ | ||
{"community_role": f"{community_role[0]}:{community_role[1]}"} | ||
for community_role in community_roles | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
|
||
def test_community_role_param_interpreter( | ||
logged_client, | ||
community_owner, | ||
community_reader, | ||
community_curator, | ||
community_with_workflow_factory, | ||
record_service, | ||
create_draft_via_resource, | ||
create_request_by_link, | ||
submit_request_by_link, | ||
inviter, | ||
search_clear, | ||
): | ||
owner_client = logged_client(community_owner) | ||
|
||
community_1 = community_with_workflow_factory("comm1", community_owner) | ||
community_2 = community_with_workflow_factory("comm2", community_owner) | ||
community_3 = community_with_workflow_factory("comm3", community_curator) | ||
inviter("2", community_1.id, "reader") | ||
inviter("2", community_2.id, "reader") | ||
inviter("2", community_3.id, "reader") | ||
|
||
record1 = create_draft_via_resource(owner_client, community=community_1) | ||
record2 = create_draft_via_resource(owner_client, community=community_2) | ||
record3 = create_draft_via_resource( | ||
owner_client, community=community_2, custom_workflow="curator_publish" # owner is creator but not receiver of the third request | ||
) | ||
|
||
response_1 = submit_request_by_link(owner_client, record1, "publish_draft") | ||
response_2 = create_request_by_link(owner_client, record2, "publish_draft") | ||
response_3 = submit_request_by_link(owner_client, record3, "publish_draft") | ||
|
||
search_unfiltered = owner_client.get("/requests/") | ||
assert len(search_unfiltered.json["hits"]["hits"]) == 3 | ||
|
||
search_filtered = owner_client.get("/requests/?assigned=true") | ||
|
||
|
||
assert len(search_filtered.json["hits"]["hits"]) == 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters