Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests-only] Adds api tests for renaming received shares #38262

Merged
merged 2 commits into from
Jan 8, 2021

Conversation

SwikritiT
Copy link
Contributor

@SwikritiT SwikritiT commented Jan 1, 2021

Description

Adds tests for renaming received shares

Related Issue

How Has This Been Tested?

🤖

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog

Comment on lines 102 to 117
Scenario: receiver renames a received share to different name on the same folder
Given user "Alice" has shared folder "PARENT" with user "Brian"
And user "Brian" has accepted share "/PARENT" offered by user "Alice"
When user "Brian" moves folder "/Shares/PARENT" to "/Shares/myFolder" using the WebDAV API
Then the HTTP status code should be "201"
And as "Brian" folder "/Shares/myFolder" should exist
But as "Alice" folder "myFolder" should not exist

Scenario: receiver renames a received file share to different name on the same folder
Given user "Alice" has shared file "textfile0.txt" with user "Brian"
And user "Brian" has accepted share "/textfile0.txt" offered by user "Alice"
When user "Brian" moves file "/Shares/textfile0.txt" to "/Shares/newFile.txt" using the WebDAV API
Then the HTTP status code should be "201"
And as "Brian" file "/Shares/newFile.txt" should exist
But as "Alice" file "newFile.txt" should not exist

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can make these two scenarios into a single scenario like here

When user "Brian" moves folder "/Shares/RandomFolder/sub-folder" to "/Shares/RandomFolder/renamed-sub-folder" using the WebDAV API
And user "Brian" moves file "/Shares/RandomFolder/file-to-share" to "/Shares/RandomFolder/renamedFile" using the WebDAV API

Comment on lines 118 to 146
Scenario: receiver renames a received share to different name on the same folder for group sharing
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has shared folder "PARENT" with group "grp1"
And user "Brian" has accepted share "/PARENT" offered by user "Alice"
When user "Brian" moves folder "/Shares/PARENT" to "/Shares/myFolder" using the WebDAV API
Then the HTTP status code should be "201"
And as "Brian" folder "/Shares/myFolder" should exist
But as "Alice" folder "myFolder" should not exist

Scenario: receiver renames a received file share to different name on the same folder for group sharing
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has shared file "textfile0.txt" with group "grp1"
And user "Brian" has accepted share "/textfile0.txt" offered by user "Alice"
When user "Brian" moves file "/Shares/textfile0.txt" to "/Shares/newFile.txt" using the WebDAV API
Then the HTTP status code should be "201"
And as "Brian" file "/Shares/newFile.txt" should exist
But as "Alice" file "newFile.txt" should not exist
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@@ -99,3 +99,115 @@ Feature: sharing
And as "Brian" file "/myFolder/renamedFile" should not exist
But as "Brian" file "/myFolder/fileInside" should exist

Scenario: receiver renames a received share to different name on the same folder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Scenario: receiver renames a received share to different name on the same folder
Scenario: receiver renames a received folder share to a different name on the same folder

Then the HTTP status code should be "403"
And as "Brian" file "/myFolder/renamedFile" should not exist
But as "Brian" file "/myFolder/parent.txt" should exist
But as "Alice" file "/PARENT/parent.txt" should exist
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And

Comment on lines 174 to 186
When user "Alice" shares folder "<sharer_folder>" with user "Brian" using the sharing API
And user "Brian" accepts share "/<sharer_folder>" offered by user "Alice" using the sharing API
And user "Brian" moves folder "/Shares/<sharer_folder>" to "/Shares/<receiver_folder>" using the WebDAV API
Then the HTTP status code should be "201"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be Given steps? 🤔

And as "Brian" folder "Shares/PARENT/new-folder" should exist
And as "Alice" folder "PARENT/new-folder" should exist
But as "Alice" folder "PARENT/CHILD" should not exist
When user "Brian" moves file "/Shares/PARENT/parent.txt" to "/Shares/PARENT/newFile.txt" using the WebDAV API
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

split scenarios for file and folder. in this case, if the move fails for the folder, the file move wouldn't get a chance to be checkded

Comment on lines 118 to 163
Scenario: receiver renames a received share to different name on the same folder for group sharing
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has shared folder "PARENT" with group "grp1"
And user "Brian" has accepted share "/PARENT" offered by user "Alice"
And user "Alice" has shared file "textfile0.txt" with group "grp1"
And user "Brian" has accepted share "/textfile0.txt" offered by user "Alice"
When user "Brian" moves folder "/Shares/PARENT" to "/Shares/myFolder" using the WebDAV API
Then the HTTP status code should be "201"
And as "Brian" folder "/Shares/myFolder" should exist
But as "Alice" folder "myFolder" should not exist
When user "Brian" moves file "/Shares/textfile0.txt" to "/Shares/newFile.txt" using the WebDAV API
Then the HTTP status code should be "201"
And as "Brian" file "/Shares/newFile.txt" should exist
But as "Alice" file "newFile.txt" should not exist

Scenario: receiver renames a received share with share, read, change permissions in group sharing
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has shared folder "PARENT" with group "grp1" with permissions "share,read,change"
And user "Brian" has accepted share "/PARENT" offered by user "Alice"
When user "Brian" moves folder "/Shares/PARENT" to "myFolder" using the WebDAV API
Then the HTTP status code should be "201"
And as "Brian" folder "myFolder" should exist
But as "Alice" folder "myFolder" should not exist
When user "Brian" moves file "/myFolder/parent.txt" to "/myFolder/renamedFile" using the WebDAV API
Then the HTTP status code should be "201"
And as "Brian" file "/myFolder/renamedFile" should exist
And as "Alice" file "/PARENT/renamedFile" should exist
But as "Alice" file "/PARENT/parent.txt" should not exist

Scenario: receiver tries to rename a received share with share, read permissions in group sharing
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has shared folder "PARENT" with group "grp1" with permissions "share,read"
And user "Brian" has accepted share "/PARENT" offered by user "Alice"
When user "Brian" moves folder "/Shares/PARENT" to "/myFolder" using the WebDAV API
Then the HTTP status code should be "201"
And as "Brian" folder "myFolder" should exist
But as "Alice" folder "myFolder" should not exist
When user "Brian" moves file "/myFolder/parent.txt" to "/myFolder/renamedFile" using the WebDAV API
Then the HTTP status code should be "403"
And as "Brian" file "/myFolder/renamedFile" should not exist
And as "Brian" file "/myFolder/parent.txt" should exist
And as "Alice" file "/PARENT/parent.txt" should exist
But as "Alice" file "/PARENT/renamedFile" should not exist
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these all scenarios should be separated for files and folders.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 6, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Contributor

@kiranparajuli589 kiranparajuli589 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍

@phil-davis phil-davis self-requested a review January 8, 2021 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants