Skip to content

Commit

Permalink
Integration test for a disabled user
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepDiver1975 committed Apr 14, 2016
1 parent 3c555b0 commit 2247d33
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
16 changes: 15 additions & 1 deletion build/integration/features/bootstrap/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public function assureUserExists($user) {
}
$this->userExists($user);
PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());

}

/**
Expand Down Expand Up @@ -230,6 +229,20 @@ public function creatingTheGroup($group) {
}
}

/**
* @When /^user "([^"]*)" is disabled$/
*/
public function userIsDisabled($user) {
$fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/cloud/users/$user/disable";
$client = new Client();
$options = [];
if ($this->currentUser === 'admin') {
$options['auth'] = $this->adminUser;
}

$this->response = $client->send($client->createRequest("PUT", $fullUrl, $options));
}

/**
* @When /^Deleting the user "([^"]*)"$/
* @param string $user
Expand Down Expand Up @@ -588,4 +601,5 @@ public function cleanupGroups()
}
$this->usingServer($previousServer);
}

}
10 changes: 10 additions & 0 deletions build/integration/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,5 +405,15 @@ public function userMovesNewChunkFileWithIdToMychunkedfile($user, $id, $dest)
}


/**
* @Given /^Downloading file "([^"]*)" as "([^"]*)"$/
*/
public function downloadingFileAs($fileName, $user) {
try {
$this->response = $this->makeDavRequest($user, 'GET', $fileName, []);
} catch (\GuzzleHttp\Exception\ServerException $ex) {
$this->response = $ex->getResponse();
}
}
}

8 changes: 8 additions & 0 deletions build/integration/features/webdav-related.feature
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,11 @@ Feature: webdav-related
When As an "user0"
And Downloading file "/files/user0/myChunkedFile.txt"
Then Downloaded content should be "AAAAABBBBBCCCCC"

Scenario: A disabled user cannot use webdav
Given user "userToBeDisabled" exists
And As an "admin"
And user "userToBeDisabled" is disabled
When Downloading file "/welcome.txt" as "userToBeDisabled"
Then the HTTP status code should be "503"

0 comments on commit 2247d33

Please sign in to comment.