Skip to content

Commit

Permalink
given step implementation of sharing resource with group in the server (
Browse files Browse the repository at this point in the history
  • Loading branch information
ishabaral authored Sep 23, 2024
1 parent f301411 commit 537033f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
8 changes: 5 additions & 3 deletions test/gui/shared/scripts/helpers/api/sharing_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,20 @@ def download_last_public_link_resource(user, resource, public_link_password=None
raise AssertionError(f'Server returned status code: {response.status_code}')


def share_resource(user, resource, receiver, permissions):
def share_resource(user, resource, receiver, permissions, receiver_type):
permissions = get_permission_value(permissions)
url = get_share_url()
body = {
'path': resource,
'shareType': share_types['user'],
'shareType': share_types[receiver_type],
'shareWith': receiver,
'permissions': permissions,
}
response = request.post(url, body, user=user)
request.assertHttpStatus(
response, 200, f"Failed to share resource '{resource}' to user '{user}'"
response,
200,
f"Failed to share resource '{resource}' to {receiver_type} '{receiver}'",
)
checkSuccessOcsStatus(response)

Expand Down
6 changes: 3 additions & 3 deletions test/gui/shared/steps/server_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ def step(context, user):

@Given(
# pylint: disable=line-too-long
r'user "([^"].*)" has shared (?:file|folder) "([^"].*)" in the server with user "([^"].*)" with "([^"].*)" permission(?:s)?',
r'user "([^"].*)" has shared (?:file|folder) "([^"].*)" in the server with (user|group) "([^"].*)" with "([^"].*)" permission(?:s)?',
regexp=True,
)
def step(context, user, resource, receiver, permissions):
sharing_helper.share_resource(user, resource, receiver, permissions)
def step(context, user, resource, receiver_type, receiver, permissions):
sharing_helper.share_resource(user, resource, receiver, permissions, receiver_type)


@Given('user "|any|" has created the following public link share in the server')
Expand Down
4 changes: 2 additions & 2 deletions test/gui/tst_sharing/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ Feature: Sharing
And user "Alice" has created folder "Folder" in the server
And user "Alice" has shared file "/textfile0.txt" in the server with user "Brian" with "read, share, update" permission
And user "Alice" has shared folder "Folder" in the server with user "Brian" with "read, share, update" permission
And user "Alice" has shared file "/textfile0.txt" on the server with group "grp1" with "read, share, update" permission
And user "Alice" has shared folder "Folder" on the server with group "grp1" with "read, share, update" permission
And user "Alice" has shared file "/textfile0.txt" in the server with group "grp1" with "read, share, update" permission
And user "Alice" has shared folder "Folder" in the server with group "grp1" with "read, share, update" permission
And user "Brian" has set up a client with default settings
When the user tires to share resource "textfile0.txt" with the group "grp1" using the client-UI
Then the error "Path already shared with this group" should be displayed in the sharing dialog
Expand Down

0 comments on commit 537033f

Please sign in to comment.