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

API test for disabled public upload share #31697

Merged
merged 1 commit into from
Jun 8, 2018

Conversation

paurakhsharma
Copy link
Member

Description

This PR adds tests to:

  1. Make sure public cannot upload a file to a shared folder when allow public upload is disabled.
  2. Make sure publicly uploading to a publicly shared folder doesn't work when a folder has been shared after allow public upload has been disabled and again enabled after file has been shared.
  3. Make sure publicly uploading to a publicly shared folder works if allow public upload is disabled and re-enabled after the folder has been shared

Related Issue

#31531

How Has This Been Tested?

Locally

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Acceptance test

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link
Contributor

@phil-davis phil-davis left a comment

Choose a reason for hiding this comment

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

See comments

| shareType | 3 |
| permissions | 4 |
When parameter "shareapi_allow_public_upload" of app "core" has been set to "no"
Copy link
Contributor

Choose a reason for hiding this comment

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

Use the When form of this step:

When the administrator sets parameter "xyz" of app "core" to "no" using the API

| shareType | 3 |
| permissions | 4 |
When parameter "shareapi_allow_public_upload" of app "core" has been set to "yes"
Copy link
Contributor

Choose a reason for hiding this comment

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

Use the When form of this step:

When the administrator sets parameter "xyz" of app "core" to "no" using the API

And the HTTP status code should be "403"

Scenario: Uploading file to a public shared folder does not work when allow public uploads has disabled before sharing and again enabled after sharing the folder
Copy link
Contributor

Choose a reason for hiding this comment

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

s/has disabled/has been disabled/

| permissions | 4 |
When parameter "shareapi_allow_public_upload" of app "core" has been set to "yes"
Then publicly uploading a file should not work
Copy link
Contributor

Choose a reason for hiding this comment

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

Why "should not work"?
Is it because the share creation will have failed at line 247?

Copy link
Contributor

Choose a reason for hiding this comment

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

So you could write another scenario also that tests that:

Given parameter "shareapi_allow_public_upload" of app "core" has been set to "no"
When user "user0" creates a share with settings:
   ...

then the status should be 4nn and the share should not exist.

Copy link
Member Author

Choose a reason for hiding this comment

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

No. line 247 should work fine.
I was about to talk to you about it. I think when public upload is disabled then all public shares created thereafter doesn't allow public uploading?

Copy link
Contributor

Choose a reason for hiding this comment

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

What happens when the share is created at line 247?
Does it get created, but without the requested public upload permission?
Or?

Copy link
Member Author

@paurakhsharma paurakhsharma Jun 8, 2018

Choose a reason for hiding this comment

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

Sorry, the share doesn't get created. But if we share it with upload and read permission, it is created with read-only permission.

Copy link
Member Author

Choose a reason for hiding this comment

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

So in this scenario share is not created so line 251 doesn't make sense. So I think I should change this scenario to share with permission 31. I think that would make more sense?

And the HTTP status code should be "401"

Scenario: Uploading file to a public shared folder works when allow public uploads has disabled and again enabled after sharing the folder
Copy link
Contributor

Choose a reason for hiding this comment

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

s/has disabled/has been disabled/

@paurakhsharma paurakhsharma force-pushed the API-test-uploadToPublicShare branch from ec5ae7f to bba20ab Compare June 8, 2018 11:17
@paurakhsharma paurakhsharma force-pushed the API-test-uploadToPublicShare branch from bba20ab to b16165a Compare June 8, 2018 11:20
@codecov
Copy link

codecov bot commented Jun 8, 2018

Codecov Report

Merging #31697 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #31697   +/-   ##
=========================================
  Coverage     62.89%   62.89%           
  Complexity    18417    18417           
=========================================
  Files          1154     1154           
  Lines         69156    69156           
  Branches       1260     1260           
=========================================
  Hits          43498    43498           
  Misses        25289    25289           
  Partials        369      369
Flag Coverage Δ Complexity Δ
#javascript 52.39% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 64.1% <ø> (ø) 18417 <ø> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ed7c59a...b16165a. Read the comment docs.

@phil-davis phil-davis merged commit d87999f into master Jun 8, 2018
@phil-davis phil-davis deleted the API-test-uploadToPublicShare branch June 8, 2018 13:07
@paurakhsharma
Copy link
Member Author

Backport on #31707

@lock
Copy link

lock bot commented Jul 31, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants