Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
eb6a13c2
Commit
eb6a13c2
authored
9 years ago
by
Sergio Bertolin
Browse files
Options
Downloads
Patches
Plain Diff
Added a test including all the fields of the share update and checking output
parent
7aeda7c9
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
build/integration/features/bootstrap/FeatureContext.php
+49
-2
49 additions, 2 deletions
build/integration/features/bootstrap/FeatureContext.php
build/integration/features/sharing-v1.feature
+37
-1
37 additions, 1 deletion
build/integration/features/sharing-v1.feature
with
86 additions
and
3 deletions
build/integration/features/bootstrap/FeatureContext.php
+
49
−
2
View file @
eb6a13c2
...
@@ -595,7 +595,12 @@ class FeatureContext implements Context, SnippetAcceptingContext {
...
@@ -595,7 +595,12 @@ class FeatureContext implements Context, SnippetAcceptingContext {
public
function
checkPublicSharedFile
(
$filename
)
{
public
function
checkPublicSharedFile
(
$filename
)
{
$client
=
new
Client
();
$client
=
new
Client
();
$options
=
[];
$options
=
[];
$url
=
$this
->
lastShareData
->
data
[
0
]
->
url
;
if
(
count
(
$this
->
lastShareData
->
data
->
element
)
>
0
){
$url
=
$this
->
lastShareData
->
data
[
0
]
->
url
;
}
else
{
$url
=
$this
->
lastShareData
->
data
->
url
;
}
$fullUrl
=
$url
.
"/download"
;
$fullUrl
=
$url
.
"/download"
;
$options
[
'save_to'
]
=
"./
$filename
"
;
$options
[
'save_to'
]
=
"./
$filename
"
;
$this
->
response
=
$client
->
get
(
$fullUrl
,
$options
);
$this
->
response
=
$client
->
get
(
$fullUrl
,
$options
);
...
@@ -613,7 +618,13 @@ class FeatureContext implements Context, SnippetAcceptingContext {
...
@@ -613,7 +618,13 @@ class FeatureContext implements Context, SnippetAcceptingContext {
public
function
checkPublicSharedFileWithPassword
(
$filename
,
$password
)
{
public
function
checkPublicSharedFileWithPassword
(
$filename
,
$password
)
{
$client
=
new
Client
();
$client
=
new
Client
();
$options
=
[];
$options
=
[];
$token
=
$this
->
lastShareData
->
data
[
0
]
->
token
;
if
(
count
(
$this
->
lastShareData
->
data
->
element
)
>
0
){
$token
=
$this
->
lastShareData
->
data
[
0
]
->
token
;
}
else
{
$token
=
$this
->
lastShareData
->
data
->
token
;
}
$fullUrl
=
substr
(
$this
->
baseUrl
,
0
,
-
4
)
.
"public.php/webdav"
;
$fullUrl
=
substr
(
$this
->
baseUrl
,
0
,
-
4
)
.
"public.php/webdav"
;
$options
[
'auth'
]
=
[
$token
,
$password
];
$options
[
'auth'
]
=
[
$token
,
$password
];
$options
[
'save_to'
]
=
"./
$filename
"
;
$options
[
'save_to'
]
=
"./
$filename
"
;
...
@@ -645,6 +656,40 @@ class FeatureContext implements Context, SnippetAcceptingContext {
...
@@ -645,6 +656,40 @@ class FeatureContext implements Context, SnippetAcceptingContext {
PHPUnit_Framework_Assert
::
assertEquals
(
200
,
$this
->
response
->
getStatusCode
());
PHPUnit_Framework_Assert
::
assertEquals
(
200
,
$this
->
response
->
getStatusCode
());
}
}
/**
* @When /^Updating last share with$/
* @param \Behat\Gherkin\Node\TableNode|null $formData
*/
public
function
updatingLastShare
(
$body
)
{
$share_id
=
$this
->
lastShareData
->
data
[
0
]
->
id
;
$fullUrl
=
$this
->
baseUrl
.
"v
{
$this
->
apiVersion
}
.php/apps/files_sharing/api/v
{
$this
->
sharingApiVersion
}
/shares/
$share_id
"
;
$client
=
new
Client
();
$options
=
[];
if
(
$this
->
currentUser
===
'admin'
)
{
$options
[
'auth'
]
=
$this
->
adminUser
;
}
else
{
$options
[
'auth'
]
=
[
$this
->
currentUser
,
$this
->
regularUser
];
}
if
(
$body
instanceof
\Behat\Gherkin\Node\TableNode
)
{
$fd
=
$body
->
getRowsHash
();
if
(
array_key_exists
(
'expireDate'
,
$fd
)){
$dateModification
=
$fd
[
'expireDate'
];
$fd
[
'expireDate'
]
=
date
(
'Y-m-d'
,
strtotime
(
$dateModification
));
}
$options
[
'body'
]
=
$fd
;
}
try
{
$this
->
response
=
$client
->
send
(
$client
->
createRequest
(
"PUT"
,
$fullUrl
,
$options
));
}
catch
(
\GuzzleHttp\Exception\ClientException
$ex
)
{
$this
->
response
=
$ex
->
getResponse
();
}
PHPUnit_Framework_Assert
::
assertEquals
(
200
,
$this
->
response
->
getStatusCode
());
}
public
function
createShare
(
$user
,
public
function
createShare
(
$user
,
$path
=
null
,
$path
=
null
,
$shareType
=
null
,
$shareType
=
null
,
...
@@ -718,6 +763,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
...
@@ -718,6 +763,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
return
True
;
return
True
;
}
}
}
}
return
False
;
return
False
;
}
else
{
}
else
{
if
(
$contentExpected
==
"A_TOKEN"
){
if
(
$contentExpected
==
"A_TOKEN"
){
...
@@ -821,6 +867,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
...
@@ -821,6 +867,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
public
function
checkShareFields
(
$body
){
public
function
checkShareFields
(
$body
){
if
(
$body
instanceof
\Behat\Gherkin\Node\TableNode
)
{
if
(
$body
instanceof
\Behat\Gherkin\Node\TableNode
)
{
$fd
=
$body
->
getRowsHash
();
$fd
=
$body
->
getRowsHash
();
foreach
(
$fd
as
$field
=>
$value
)
{
foreach
(
$fd
as
$field
=>
$value
)
{
PHPUnit_Framework_Assert
::
assertEquals
(
True
,
$this
->
isFieldInResponse
(
$field
,
$value
));
PHPUnit_Framework_Assert
::
assertEquals
(
True
,
$this
->
isFieldInResponse
(
$field
,
$value
));
}
}
...
...
This diff is collapsed.
Click to expand it.
build/integration/features/sharing-v1.feature
+
37
−
1
View file @
eb6a13c2
...
@@ -72,11 +72,47 @@ Feature: sharing
...
@@ -72,11 +72,47 @@ Feature: sharing
|
path
|
welcome.txt
|
|
path
|
welcome.txt
|
|
shareType
|
3
|
|
shareType
|
3
|
|
password
|
publicpw
|
|
password
|
publicpw
|
And
Adding expiration date to last share
#And Adding expiration date to last share
And
Updating last share with
|
expireDate
|
+3
days
|
Then
the
OCS
status
code
should
be
"100"
Then
the
OCS
status
code
should
be
"100"
And
the HTTP status code should be
"200"
And
the HTTP status code should be
"200"
And
Public shared file
"welcome.txt"
with password
"publicpw"
can be downloaded
And
Public shared file
"welcome.txt"
with password
"publicpw"
can be downloaded
Scenario
:
Creating a new public share, updating it and getting it's info
Given
user
"user0"
exists
And
As an
"user0"
When
creating a public share with
|
path
|
FOLDER
|
|
shareType
|
3
|
And
Updating last share with
|
expireDate
|
+3
days
|
|
password
|
publicpw
|
|
publicUpload
|
true
|
|
permissions
|
7
|
And
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
|
folder
|
|
item_source
|
A_NUMBER
|
|
share_type
|
3
|
|
file_source
|
A_NUMBER
|
|
file_target
|
/FOLDER
|
|
permissions
|
7
|
|
stime
|
A_NUMBER
|
|
expiration
|
+3
days
|
|
token
|
A_TOKEN
|
|
storage
|
A_NUMBER
|
|
mail_send
|
0
|
|
uid_owner
|
user0
|
|
storage_id
|
home::user0
|
|
file_parent
|
A_NUMBER
|
|
displayname_owner
|
user0
|
|
url
|
AN_URL
|
Scenario
:
getting all shares of a user using that user
Scenario
:
getting all shares of a user using that user
Given
user
"user0"
exists
Given
user
"user0"
exists
And
user
"user1"
exists
And
user
"user1"
exists
...
...
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