-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added `ALL` ApiScope to allow the use of OCS Apis that we have not yet defined in the AppAPI. --------- Signed-off-by: Andrey Borysenko <[email protected]> Co-authored-by: Andrey Borysenko <[email protected]>
- Loading branch information
1 parent
2ad52f0
commit a8863df
Showing
8 changed files
with
117 additions
and
66 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
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
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,25 @@ | ||
import sys | ||
import pytest | ||
import nc_py_api | ||
|
||
# sys.argv[1] = 0 -> System App, ALL Scope | ||
# sys.argv[1] = 1 -> System App, No ALL Scope | ||
# sys.argv[1] = 2 -> No System App, ALL Scope | ||
|
||
if __name__ == "__main__": | ||
nc = nc_py_api.NextcloudApp(user="admin") | ||
assert nc.capabilities | ||
if int(sys.argv[1]) == 0: | ||
nc.ocs("GET", "/ocs/v2.php/core/whatsnew") | ||
else: | ||
with pytest.raises(nc_py_api.NextcloudException) as e: | ||
nc.ocs("GET", "/ocs/v2.php/core/whatsnew") | ||
assert e.value.status_code == 401 | ||
|
||
if int(sys.argv[1]) == 2: | ||
# as NextcloudApp was initialized with `user="admin"` this will fail for non-system app. | ||
with pytest.raises(nc_py_api.NextcloudException) as e: | ||
nc.users_list() | ||
assert e.value.status_code == 401 | ||
else: | ||
assert nc.users_list() |
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