-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 disableSharing #31674
API test for disableSharing #31674
Conversation
48fff14
to
e72d848
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also add scenarios that try to share a folder, and make sure that does not work.
And as user "admin" | ||
When parameter "shareapi_enabled" of app "core" has been set to "no" | ||
Then user "user0" should not be able to share file "welcome.txt" with user "user1" using the API | ||
Then the OCS status code should be "404" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And...
And as user "admin" | ||
When parameter "shareapi_enabled" of app "core" has been set to "no" | ||
Then user "user0" should not be able to share file "welcome.txt" with group "sharinggroup" using the API | ||
Then the OCS status code should be "404" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And...
Given using API version "1" | ||
And using old DAV path | ||
|
||
Scenario: user tries to share a file with another user when an sharing api has been disabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/an sharing api/the sharing api/
Then the OCS status code should be "404" | ||
And the HTTP status code should be "200" | ||
|
||
Scenario: user tries to share a file with group when an sharing api has been disabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/an sharing api/the sharing api/
$options['auth'] = $this->getAuthOptionForUser($sharer); | ||
$this->response = $client->get($fullUrl, $options); | ||
if ($this->isUserOrGroupInSharedData($sharee, $permissions)) { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to do this check?
If it returns true
here then this return
will make this step pass.
8e0ec7b
to
6fad514
Compare
What are other scenarios you think I should add here? I will add scenarios for public share after #31677 is merged. |
Codecov Report
@@ Coverage Diff @@
## master #31674 +/- ##
=========================================
Coverage 62.89% 62.89%
Complexity 18418 18418
=========================================
Files 1154 1154
Lines 69157 69157
Branches 1260 1260
=========================================
Hits 43499 43499
Misses 25289 25289
Partials 369 369
Continue to review full report at Codecov.
|
6fad514
to
0dbf7a3
Compare
This seems a good set of tests. So I will merge when CI finishes. |
0dbf7a3
to
02c598b
Compare
php-cs-fixer failed:
It is good to do:
before pushing code up. That saves having these annoying little format issues. I removed the extra space, squash, rebased... |
Thank you, @phil-davis I will remember it form next time. |
Backport on #31694 |
1 line of code was bonus unused - see PR #31695 |
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. |
Description
This PR adds test to check API behavior when link sharing is disabled.
Related Issue
#31531
How Has This Been Tested?
Locally
Types of changes
Checklist: