Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
our_own_cloud_project
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
6936f45f
Commit
6936f45f
authored
Mar 28, 2017
by
Sergio Bertolin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test scenario for multiple link shares
parent
31d09676
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
1 deletion
+88
-1
tests/integration/features/bootstrap/Sharing.php
tests/integration/features/bootstrap/Sharing.php
+47
-1
tests/integration/features/sharing-v1.feature
tests/integration/features/sharing-v1.feature
+41
-0
No files found.
tests/integration/features/bootstrap/Sharing.php
View file @
6936f45f
...
...
@@ -174,7 +174,8 @@ trait Sharing {
$shareWith
=
null
,
$publicUpload
=
null
,
$password
=
null
,
$permissions
=
null
){
$permissions
=
null
,
$linkName
=
null
)
{
$fullUrl
=
$this
->
baseUrl
.
"v
{
$this
->
apiVersion
}
.php/apps/files_sharing/api/v
{
$this
->
sharingApiVersion
}
/shares"
;
$client
=
new
Client
();
$options
=
[];
...
...
@@ -203,6 +204,9 @@ trait Sharing {
if
(
!
is_null
(
$permissions
)){
$fd
[
'permissions'
]
=
$permissions
;
}
if
(
!
is_null
(
$linkName
)){
$fd
[
'name'
]
=
$linkName
;
}
$options
[
'body'
]
=
$fd
;
...
...
@@ -507,5 +511,47 @@ trait Sharing {
throw
new
\
Exception
(
'Expected the same link share to be returned'
);
}
}
/**
* @When /^user "([^"]*)" gets shares of (file|folder) "([^"]*)"$/
* @param string $user
* @param string $type
* @param string $path
* @param \Behat\Gherkin\Node\TableNode|null $body
*/
public
function
getShares
(
$user
,
$type
,
$path
,
$TableNode
){
$fullUrl
=
$this
->
baseUrl
.
"v
{
$this
->
apiVersion
}
.php/apps/files_sharing/api/v
{
$this
->
sharingApiVersion
}
/shares"
;
$fullUrl
=
$fullUrl
.
'?path='
.
$path
;
$client
=
new
Client
();
$options
=
[];
if
(
$user
===
'admin'
)
{
$options
[
'auth'
]
=
$this
->
adminUser
;
}
else
{
$options
[
'auth'
]
=
[
$user
,
$this
->
regularUser
];
}
$this
->
response
=
$client
->
send
(
$client
->
createRequest
(
"GET"
,
$fullUrl
,
$options
));
$dataResponded
=
$this
->
response
->
xml
()
->
data
->
element
;
if
(
$TableNode
instanceof
\
Behat\Gherkin\Node\TableNode
)
{
$elementRows
=
$TableNode
->
getRows
();
foreach
(
$elementRows
as
$expectedElementsArray
)
{
//0 path, 1 permissions, 2 name
$nameFound
=
false
;
foreach
(
$dataResponded
as
$elementResponded
)
{
if
((
string
)
$elementResponded
->
name
[
0
]
===
$expectedElementsArray
[
2
])
{
PHPUnit_Framework_Assert
::
assertEquals
(
$expectedElementsArray
[
0
],
(
string
)
$elementResponded
->
path
[
0
]);
PHPUnit_Framework_Assert
::
assertEquals
(
$expectedElementsArray
[
1
],
(
string
)
$elementResponded
->
permissions
[
0
]);
$nameFound
=
true
;
break
;
}
}
PHPUnit_Framework_Assert
::
assertTrue
(
$nameFound
,
"Shared link name "
.
$expectedElementsArray
[
2
]
.
" not found"
);
}
}
}
}
tests/integration/features/sharing-v1.feature
View file @
6936f45f
...
...
@@ -1161,3 +1161,44 @@ Feature: sharing
And
as
"user0"
the folder
"/sub"
exists in trash
And
as
"user0"
the file
"/sub/shared_file.txt"
exists in trash
Scenario
:
Creating three public shares of a folder
Given
user
"user0"
exists
And
As an
"user0"
And
creating a share with
|
path
|
FOLDER
|
|
shareType
|
3
|
|
password
|
publicpw
|
|
expireDate
|
+3
days
|
|
publicUpload
|
true
|
|
permissions
|
15
|
|
name
|
sharedlink1
|
And
the OCS status code should be
"100"
And
the HTTP status code should be
"200"
And
creating a share with
|
path
|
FOLDER
|
|
shareType
|
3
|
|
password
|
publicpw
|
|
expireDate
|
+3
days
|
|
publicUpload
|
true
|
|
permissions
|
15
|
|
name
|
sharedlink2
|
And
the OCS status code should be
"100"
And
the HTTP status code should be
"200"
And
creating a share with
|
path
|
FOLDER
|
|
shareType
|
3
|
|
password
|
publicpw
|
|
expireDate
|
+3
days
|
|
publicUpload
|
true
|
|
permissions
|
15
|
|
name
|
sharedlink3
|
And
the OCS status code should be
"100"
And
the HTTP status code should be
"200"
When
Updating last share with
|
permissions
|
1
|
Then
the
OCS
status
code
should
be
"100"
And
the HTTP status code should be
"200"
And
user
"user0"
gets shares of folder
"/FOLDER"
|
/FOLDER
|
15
|
sharedlink2
|
|
/FOLDER
|
15
|
sharedlink1
|
|
/FOLDER
|
1
|
sharedlink3
|
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment