Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
27e3d130
Commit
27e3d130
authored
Nov 10, 2015
by
Thomas Müller
Browse files
Merge pull request #20429 from owncloud/sharing-api-integration-tests-get-share-by-id
Added test to get info of a specific share id
parents
e4900c6c
7aa6e9b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
build/integration/features/bootstrap/FeatureContext.php
View file @
27e3d130
...
...
@@ -672,7 +672,10 @@ class FeatureContext implements Context, SnippetAcceptingContext {
public
function
isFieldInResponse
(
$field
,
$content_expected
){
$data
=
$this
->
response
->
xml
()
->
data
[
0
];
foreach
(
$data
as
$element
)
{
if
(
$element
->
$field
==
$content_expected
){
if
(
$content_expected
==
"A_NUMBER"
){
return
is_numeric
((
string
)
$element
->
$field
);
}
elseif
(
$element
->
$field
==
$content_expected
){
return
True
;
}
}
...
...
@@ -744,10 +747,32 @@ class FeatureContext implements Context, SnippetAcceptingContext {
*/
public
function
deletingLastShare
(){
$share_id
=
$this
->
lastShareData
->
data
[
0
]
->
id
;
$url
=
"/apps/files_sharing/api/v
{
$this
->
a
piVersion
}
/shares/
$share_id
"
;
$url
=
"/apps/files_sharing/api/v
{
$this
->
sharingA
piVersion
}
/shares/
$share_id
"
;
$this
->
sendingToWith
(
"DELETE"
,
$url
,
null
);
}
/**
* @When /^Getting info of last share$/
*/
public
function
gettingInfoOfLastShare
(){
$share_id
=
$this
->
lastShareData
->
data
[
0
]
->
id
;
$url
=
"/apps/files_sharing/api/v
{
$this
->
sharingApiVersion
}
/shares/
$share_id
"
;
$this
->
sendingToWith
(
"GET"
,
$url
,
null
);
}
/**
* @Then /^Share fields of last share match with$/
* @param \Behat\Gherkin\Node\TableNode|null $formData
*/
public
function
checkShareFields
(
$body
){
if
(
$body
instanceof
\
Behat\Gherkin\Node\TableNode
)
{
$fd
=
$body
->
getRowsHash
();
foreach
(
$fd
as
$field
=>
$value
)
{
PHPUnit_Framework_Assert
::
assertEquals
(
True
,
$this
->
isFieldInResponse
(
$field
,
$value
));
}
}
}
public
static
function
removeFile
(
$path
,
$filename
){
if
(
file_exists
(
"
$path
"
.
"
$filename
"
))
{
unlink
(
"
$path
"
.
"
$filename
"
);
...
...
build/integration/features/sharing-v1.feature
View file @
27e3d130
...
...
@@ -108,6 +108,33 @@ Feature: sharing
And
User
"user2"
should be included in the response
And
User
"user3"
should not be included in the response
Scenario
:
getting share info of a share
Given
user
"user0"
exists
And
user
"user1"
exists
And
file
"textfile0.txt"
from user
"user0"
is shared with user
"user1"
And
As an
"user0"
When
Getting info of last share
Then
the OCS status code should be
"100"
And
the HTTP status code should be
"200"
And
Share fields of last share match with
|
id
|
A_NUMBER
|
|
item_type
|
file
|
|
item_source
|
A_NUMBER
|
|
share_type
|
0
|
|
share_with
|
user1
|
|
file_source
|
A_NUMBER
|
|
file_target
|
/textfile0.txt
|
|
path
|
/textfile0.txt
|
|
permissions
|
23
|
|
stime
|
A_NUMBER
|
|
storage
|
A_NUMBER
|
|
mail_send
|
0
|
|
uid_owner
|
user0
|
|
storage_id
|
home::user0
|
|
file_parent
|
A_NUMBER
|
|
share_with_displayname
|
user1
|
|
displayname_owner
|
user0
|
Scenario
:
delete a share
Given
user
"user0"
exists
And
user
"user1"
exists
...
...
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