Integration test for a disabled user
This commit is contained in:
parent
8486926a14
commit
0eed6b5189
|
@ -35,7 +35,6 @@ trait Provisioning {
|
||||||
}
|
}
|
||||||
$this->userExists($user);
|
$this->userExists($user);
|
||||||
PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
|
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 "([^"]*)"$/
|
* @When /^Deleting the user "([^"]*)"$/
|
||||||
* @param string $user
|
* @param string $user
|
||||||
|
@ -588,4 +601,5 @@ trait Provisioning {
|
||||||
}
|
}
|
||||||
$this->usingServer($previousServer);
|
$this->usingServer($previousServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -286,3 +286,11 @@ Feature: webdav-related
|
||||||
When As an "user0"
|
When As an "user0"
|
||||||
And Downloading file "/files/user0/myChunkedFile.txt"
|
And Downloading file "/files/user0/myChunkedFile.txt"
|
||||||
Then Downloaded content should be "AAAAABBBBBCCCCC"
|
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"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue