Skip to content

Commit

Permalink
Added test for retreiving all lists
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Tuke committed Jun 15, 2014
1 parent cc5b68b commit 60f51be
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions plugins/restapi/tests/restapi.php
Expand Up @@ -12,7 +12,7 @@ class TestRestapi extends \PHPUnit_Framework_TestCase
public $url;
public $tmpPath;

function setUp()
public function setUp()
{
// Set values from constants stored in phpunit.xml
$this->loginName = API_LOGIN_USERNAME;
Expand All @@ -21,7 +21,7 @@ function setUp()
$this->tmpPath = TMP_PATH;
}

function tearDown() {
public function tearDown() {
}

/**
Expand Down Expand Up @@ -63,7 +63,7 @@ private function callApi( $command, $post_params, $decode = true )
* Use a real login to test login api call
* @return bool true if user exists and login successful
*/
function testLogin()
public function testLogin()
{
// Set the username and pwd to login with
$post_params = array(
Expand All @@ -72,12 +72,27 @@ function testLogin()
);

// Execute the login with the credentials as params
$result = $this->callAPI( 'login', $post_params );
$result = $this->callApi( 'login', $post_params );

// Check if the login was successful
$this->assertEquals( 'success', $result->status );

}

/**
* Test for simple success of fetching of all lists
* @note Only the 'status' property is tested
*/
public function testListsGet()
{
//Post Data
$post_params = array();

$result = $this->callApi( 'listsGet', $post_params);

// Check if the lists were fetched successfully
$this->assertEquals( 'success', $result->status );
}

}

Expand Down

0 comments on commit 60f51be

Please sign in to comment.