Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
3fc7357a
Commit
3fc7357a
authored
10 years ago
by
Björn Schießle
Browse files
Options
Downloads
Patches
Plain Diff
add/update unit tests
parent
70ca292f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/files_sharing/tests/permissions.php
+2
-3
2 additions, 3 deletions
apps/files_sharing/tests/permissions.php
apps/files_sharing/tests/sharedstorage.php
+31
-0
31 additions, 0 deletions
apps/files_sharing/tests/sharedstorage.php
with
33 additions
and
3 deletions
apps/files_sharing/tests/permissions.php
+
2
−
3
View file @
3fc7357a
...
...
@@ -145,10 +145,9 @@ class Test_Files_Sharing_Permissions extends Test_Files_Sharing_Base {
$this
->
assertEquals
(
27
,
$contents
[
1
][
'permissions'
]);
$contents
=
$this
->
secondView
->
getDirectoryContent
(
'files/shareddirrestricted'
);
$this
->
assertEquals
(
'subdir'
,
$contents
[
0
][
'name'
]);
$this
->
assertEquals
(
7
|
\OCP\PERMISSION_DELETE
,
$contents
[
0
][
'permissions'
]);
$this
->
assertEquals
(
7
,
$contents
[
0
][
'permissions'
]);
$this
->
assertEquals
(
'textfile1.txt'
,
$contents
[
1
][
'name'
]);
// 3 is correct because create is reserved to folders only
// delete permissions are added since mount points can always be deleted
$this
->
assertEquals
(
3
|
\OCP\PERMISSION_DELETE
,
$contents
[
1
][
'permissions'
]);
$this
->
assertEquals
(
3
,
$contents
[
1
][
'permissions'
]);
}
}
This diff is collapsed.
Click to expand it.
apps/files_sharing/tests/sharedstorage.php
+
31
−
0
View file @
3fc7357a
...
...
@@ -166,4 +166,35 @@ class Test_Files_Sharing_Storage extends Test_Files_Sharing_Base {
$this
->
assertTrue
(
$result
);
}
function
testGetPermissions
()
{
$fileinfoFolder
=
$this
->
view
->
getFileInfo
(
$this
->
folder
);
$result
=
\OCP\Share
::
shareItem
(
'folder'
,
$fileinfoFolder
[
'fileid'
],
\OCP\Share
::
SHARE_TYPE_USER
,
self
::
TEST_FILES_SHARING_API_USER2
,
1
);
$this
->
assertTrue
(
$result
);
self
::
loginHelper
(
self
::
TEST_FILES_SHARING_API_USER2
);
$this
->
assertTrue
(
\OC\Files\Filesystem
::
is_dir
(
$this
->
folder
));
// for the share root we expect:
// the shared permissions (1)
// the delete permission (8), to enable unshare
// the update permission (2), to allow renaming of the mount point
$rootInfo
=
\OC\Files\Filesystem
::
getFileInfo
(
$this
->
folder
);
$this
->
assertSame
(
11
,
$rootInfo
->
getPermissions
());
// for the file within the shared folder we expect:
// the shared permissions (1)
$subfileInfo
=
\OC\Files\Filesystem
::
getFileInfo
(
$this
->
folder
.
$this
->
filename
);
$this
->
assertSame
(
1
,
$subfileInfo
->
getPermissions
());
//cleanup
self
::
loginHelper
(
self
::
TEST_FILES_SHARING_API_USER1
);
$result
=
\OCP\Share
::
unshare
(
'folder'
,
$fileinfoFolder
[
'fileid'
],
\OCP\Share
::
SHARE_TYPE_USER
,
self
::
TEST_FILES_SHARING_API_USER2
);
$this
->
assertTrue
(
$result
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment