Skip to content

Commit

Permalink
Add intergration tests for new chunking
Browse files Browse the repository at this point in the history
The same intergration tests as for the old endpoint.
But now using the new chunking.

We upload 3 chunks in different order and the result should be the same
in all three.
  • Loading branch information
rullzer authored and DeepDiver1975 committed Apr 12, 2016
1 parent 72f5c53 commit 629bc18
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
32 changes: 32 additions & 0 deletions build/integration/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,5 +373,37 @@ public function userUploadsChunkFileOfWithToWithChecksum($user, $num, $total, $d
$this->makeDavRequest($user, 'PUT', $file, ['OC-Chunked' => '1'], $data);
}

/**
* @Given user :user creates a new chunking upload with id :id
*/
public function userCreatesANewChunkingUploadWithId($user, $id)
{
$destination = '/uploads/'.$user.'/'.$id;
$this->makeDavRequest($user, 'MKCOL', $destination, []);
}

/**
* @Given user :user uploads new chunk file :num with :data to id :id
*/
public function userUploadsNewChunkFileOfWithToId($user, $num, $data, $id)
{
$data = \GuzzleHttp\Stream\Stream::factory($data);
$destination = '/uploads/'.$user.'/'.$id.'/'.$num;
$this->makeDavRequest($user, 'PUT', $destination, [], $data);
}

/**
* @Given user :user moves new chunk file with id :id to :dest
*/
public function userMovesNewChunkFileWithIdToMychunkedfile($user, $id, $dest)
{
$source = '/uploads/'.$user.'/'.$id.'/.file';
$destination = substr($this->baseUrl, 0, -4) . $this->davPath . '/files/'.$user.$dest;
$this->makeDavRequest($user, 'MOVE', $source, [
'Destination' => $destination
]);
}


}

36 changes: 36 additions & 0 deletions build/integration/features/webdav-related.feature
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,39 @@ Feature: webdav-related
| 0 |
| 1 |
| 3 |

Scenario: Upload chunked file asc with new chunking
Given using dav path "remote.php/dav"
And user "user0" exists
And user "user0" creates a new chunking upload with id "chunking-42"
And user "user0" uploads new chunk file "1" with "AAAAA" to id "chunking-42"
And user "user0" uploads new chunk file "2" with "BBBBB" to id "chunking-42"
And user "user0" uploads new chunk file "3" with "CCCCC" to id "chunking-42"
And user "user0" moves new chunk file with id "chunking-42" to "/myChunkedFile.txt"
When As an "user0"
And Downloading file "/files/user0/myChunkedFile.txt"
Then Downloaded content should be "AAAAABBBBBCCCCC"

Scenario: Upload chunked file desc with new chunking
Given using dav path "remote.php/dav"
And user "user0" exists
And user "user0" creates a new chunking upload with id "chunking-42"
And user "user0" uploads new chunk file "3" with "CCCCC" to id "chunking-42"
And user "user0" uploads new chunk file "2" with "BBBBB" to id "chunking-42"
And user "user0" uploads new chunk file "1" with "AAAAA" to id "chunking-42"
And user "user0" moves new chunk file with id "chunking-42" to "/myChunkedFile.txt"
When As an "user0"
And Downloading file "/files/user0/myChunkedFile.txt"
Then Downloaded content should be "AAAAABBBBBCCCCC"

Scenario: Upload chunked file random with new chunking
Given using dav path "remote.php/dav"
And user "user0" exists
And user "user0" creates a new chunking upload with id "chunking-42"
And user "user0" uploads new chunk file "2" with "BBBBB" to id "chunking-42"
And user "user0" uploads new chunk file "3" with "CCCCC" to id "chunking-42"
And user "user0" uploads new chunk file "1" with "AAAAA" to id "chunking-42"
And user "user0" moves new chunk file with id "chunking-42" to "/myChunkedFile.txt"
When As an "user0"
And Downloading file "/files/user0/myChunkedFile.txt"
Then Downloaded content should be "AAAAABBBBBCCCCC"

0 comments on commit 629bc18

Please sign in to comment.