move privacy tests for api/post_add to the correct location

This commit is contained in:
Christian Weiske 2011-04-06 09:52:02 +02:00
parent 3306261b3e
commit 200cb1d3c5
2 changed files with 36 additions and 13 deletions

View file

@ -420,6 +420,42 @@ TXT;
$this->assertEquals(1, $data['total']);
$this->assertEquals($title2, $data['bookmarks'][0]['bTitle']);
}
public function testDefaultPrivacyPrivate()
{
$this->setUnittestConfig(
array('defaults' => array('privacy' => 2))
);
list($req, $uId) = $this->getAuthRequest('?unittestMode=1');
$req->setMethod(HTTP_Request2::METHOD_POST);
$req->addPostParameter('url', 'http://www.testdefaultprivacyposts_add1.com');
$req->addPostParameter('description', 'Test bookmark 1 for default privacy.');
$req->send();
$this->us->setCurrentUserId($uId);
$bms = $this->bs->getBookmarks(0, null, $uId);
$this->assertEquals(1, count($bms['bookmarks']));
$bm = reset($bms['bookmarks']);
$this->assertEquals('2', $bm['bStatus']);
}
public function testDefaultPrivacyPublic()
{
$this->setUnittestConfig(
array('defaults' => array('privacy' => 0))
);
list($req, $uId) = $this->getAuthRequest('?unittestMode=1');
$req->setMethod(HTTP_Request2::METHOD_POST);
$req->addPostParameter('url', 'http://www.testdefaultprivacyposts_add1.com');
$req->addPostParameter('description', 'Test bookmark 1 for default privacy.');
$req->send();
$this->us->setCurrentUserId($uId);
$bms = $this->bs->getBookmarks(0, null, $uId);
$this->assertEquals(1, count($bms['bookmarks']));
$bm = reset($bms['bookmarks']);
$this->assertEquals('0', $bm['bStatus']);
}
}
if (PHPUnit_MAIN_METHOD == 'Api_PostsAddTest::main') {

View file

@ -1357,19 +1357,6 @@ class BookmarkTest extends TestBase
require_once dirname(__FILE__) . '/../data/config.php';
$this->bs->deleteAll();
$this->us->deleteAll();
$request = new HTTP_Request2('http://localhost/api/posts_add.php', HTTP_Request2::METHOD_POST);
$dpuid = $this->addUser('dpuser', 'dpuserpassword');
$request->setAuth('dpuser', 'dpuserpassword');
$request->addPostParameter('url', 'http://www.testdefaultprivacyposts_add1.com');
$request->addPostParameter('description', 'Test bookmark 1 for default privacy.');
$request->send();
$bm = $this->bs->getBookmark('1');
$this->assertEquals('2', $bm['bStatus']);
$request->addPostParameter('url', 'http://www.testdefaultprivacyposts_add2.com');
$request->addPostParameter('description', 'Test bookmark 2 for default privacy.');
$request->addPostParameter('status', '0');
$request->send();
$request = new HTTP_Request2('http://localhost/edit.php/2', HTTP_Request2::METHOD_POST);
$testcookiekey = md5($GLOBALS['dbname'].$GLOBALS['tableprefix']).'-login';