Integration test for a disabled user

This commit is contained in:
Thomas Müller 2016-04-08 17:06:53 +02:00
parent 8486926a14
commit 0eed6b5189
No known key found for this signature in database
GPG Key ID: A943788A3BBEC44C
3 changed files with 33 additions and 1 deletions

View File

@ -35,7 +35,6 @@ trait Provisioning {
}
$this->userExists($user);
PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
}
/**
@ -230,6 +229,20 @@ trait Provisioning {
}
}
/**
* @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
@ -588,4 +601,5 @@ trait Provisioning {
}
$this->usingServer($previousServer);
}
}

View File

@ -424,5 +424,15 @@ trait WebDav {
}
/**
* @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();
}
}
}

View File

@ -286,3 +286,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"