aboutsummaryrefslogtreecommitdiff
path: root/tests/www/rssTest.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2011-06-27 19:39:38 +0200
committerChristian Weiske <cweiske@cweiske.de>2011-06-27 19:39:38 +0200
commit6ec3b102aa896df8ddcf6323e0635dc42ac25f98 (patch)
tree5215bb0cc69d68b69767292afc7838217d48b8b5 /tests/www/rssTest.php
parentd2aecd8a76a8c1f0d326cae13f158b74b6e60709 (diff)
downloadsemanticscuttle-6ec3b102aa896df8ddcf6323e0635dc42ac25f98.tar.gz
semanticscuttle-6ec3b102aa896df8ddcf6323e0635dc42ac25f98.tar.bz2
make the private tests really test something
Diffstat (limited to 'tests/www/rssTest.php')
-rw-r--r--tests/www/rssTest.php73
1 files changed, 18 insertions, 55 deletions
diff --git a/tests/www/rssTest.php b/tests/www/rssTest.php
index 9d4e41b..fc49264 100644
--- a/tests/www/rssTest.php
+++ b/tests/www/rssTest.php
@@ -7,44 +7,23 @@ class www_rssTest extends TestBaseApi
protected $urlPart = 'rss.php';
/**
- * Test a user who does not have RSS private key enabled
- * and with a private bookmark.
+ * A private bookmark should not show up in an rss feed if the
+ * user is not logged in nor passes the private key
*/
- public function testNoRSSPrivateKeyEnabled()
+ public function testPrivateNotLoggedIn()
{
- $this->setUnittestConfig(
- array('defaults' => array('privacy' => 2))
+ list($uId, $username) = $this->addUserData();
+ $this->addBookmark(
+ $uId, null, SemanticScuttle_Model_Bookmark::SPRIVATE
);
- /* create user without RSS private Key */
- list($req, $uId) = $this->getLoggedInRequest(null, true, false, false);
-
- /* create private bookmark */
- $this->bs->addBookmark(
- 'http://test', 'test', 'desc', 'note',
- 2,//private
- array(), null, null, false, false, $uId
- );
- /* create public bookmark */
- $this->bs->addBookmark(
- 'http://example.org', 'title', 'desc', 'priv',
- 0,//public
- array(), null, null, false, false, $uId
- );
-
- /* get user details */
- $user = $this->us->getUser($uId);
-
- $req->setMethod(HTTP_Request2::METHOD_POST);
- $req->setUrl($this->getTestUrl('/' . $user['username'] . '?sort=date_desc'));
- $response = $req->send();
- $response_body = $response->getBody();
+ $req = $this->getRequest('/' . $username);
+ $response_body = $req->send()->getBody();
$rss = simplexml_load_string($response_body);
$items = $rss->channel->item;
- $this->assertEquals(1, count($items), 'Incorrect Number of RSS Items');
- $this->assertEquals('title', (string)$items[0]->title);
+ $this->assertEquals(0, count($items), 'I see a private bookmark');
}//end testNoRSSPrivateKeyEnabled
@@ -54,38 +33,22 @@ class www_rssTest extends TestBaseApi
*/
public function testRSSPrivateKeyEnabled()
{
- $this->setUnittestConfig(
- array('defaults' => array('privacy' => 2))
+ list($uId, $username, $password, $privateKey) = $this->addUserData(
+ null, null, true
);
-
- /* create user with RSS private Key */
- list($req, $uId) = $this->getLoggedInRequest(null, true, false, true);
-
- /* create private bookmark */
- $this->bs->addBookmark(
- 'http://test', 'test', 'desc', 'note',
- 2,//private
- array(), null, null, false, false, $uId
+ $this->addBookmark(
+ $uId, null, SemanticScuttle_Model_Bookmark::SPRIVATE,
+ null, 'private bookmark'
);
- /* create public bookmark */
- $this->bs->addBookmark(
- 'http://example.org', 'title', 'desc', 'priv',
- 0,//public
- array(), null, null, false, false, $uId
- );
-
- /* get user details */
- $user = $this->us->getUser($uId);
- $req->setMethod(HTTP_Request2::METHOD_POST);
- $req->setUrl($this->getTestUrl('/' . $user['username'] . '?sort=date_desc&privatekey=' . $user['privateKey']));
- $response = $req->send();
- $response_body = $response->getBody();
+ $req = $this->getRequest('/' . $username . '?privatekey=' . $privateKey);
+ $response_body = $req->send()->getBody();
$rss = simplexml_load_string($response_body);
$items = $rss->channel->item;
- $this->assertEquals(2, count($items), 'Incorrect Number of RSS Items');
+ $this->assertEquals(1, count($items), 'I miss the private bookmark');
+ $this->assertEquals('private bookmark', (string)$items[0]->title);
}//end testRSSPrivateKeyEnabled