mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
BUGFIX Unit tests for RestfulServer (see r64439)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@64440 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
118efae75d
commit
c0a94a7c82
@ -186,11 +186,19 @@ class RestfulServerTest extends SapphireTest {
|
||||
$this->assertEquals($response->getStatusCode(), 405);
|
||||
}
|
||||
|
||||
public function testConflictOnExistingResourceWhenUsingPost() {
|
||||
$rating1 = $this->objFromFixture('RestfulServerTest_AuthorRating', 'rating1');
|
||||
|
||||
$url = "/api/v1/RestfulServerTest_AuthorRating/" . $rating1->ID;
|
||||
$response = Director::test($url, null, null, 'POST');
|
||||
$this->assertEquals($response->getStatusCode(), 409);
|
||||
}
|
||||
|
||||
public function testUnsupportedMediaType() {
|
||||
$_SERVER['PHP_AUTH_USER'] = 'user@test.com';
|
||||
$_SERVER['PHP_AUTH_PW'] = 'user';
|
||||
|
||||
$url = "/api/v1/RestfulServerTest_Comment/1";
|
||||
$url = "/api/v1/RestfulServerTest_Comment";
|
||||
$data = "Comment||\/||updated"; // weird format
|
||||
$headers = array('Content-Type' => 'text/weirdformat');
|
||||
$response = Director::test($url, null, null, 'POST', $data, $headers);
|
||||
@ -341,6 +349,10 @@ class RestfulServerTest_Page extends DataObject implements TestOnly {
|
||||
'Content' => 'HTMLText',
|
||||
);
|
||||
|
||||
static $has_many = array(
|
||||
'TestComments' => 'RestfulServerTest_Comment'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
class RestfulServerTest_Author extends DataObject implements TestOnly {
|
||||
|
Loading…
Reference in New Issue
Block a user