<?php
require_once("ARESTAPITest.php");
class UserRESTAPITest extends ARESTAPITest{
    
    public $user = "apitestcases";
    
    public function __construct(){
        $this->module = "user";
    }
    
    public function testLogin(){
        $params = array();
        $params['user']= $this->user;
        $params['password']="7c6a180b36896a0a8c02787eeafb0e4c"; // post-md5 password
        $params['version']="1";
        $result = $this->makeRequest($this->module, $this->version, "login", $params);
        $this->assertTrue(is_string($result['token']));
   }
   
   public function testgetInfo(){
        $params = array();
        $params['token']= $this->token;
        $result = $this->makeSignedRequest($this->module, $this->version, "getInfo", $params);
        $this->assertTrue(is_numeric($result['token_age']));
        $this->assertTrue(is_numeric($result['user_id']));
        $this->assertTrue(is_string($result['login']));
        $this->assertEquals($this->user, $result['login']);
        echo $result['user_id'];
    }
    
    public function testgetSparkCashBalance(){
        $params = array();
        $params['userID']= $this->userId;
        $result = $this->makeSignedRequest($this->module, $this->version, "getSparkCashBalance", $params);
        $this->assertTrue(is_numeric($result['balance']));
    }
    
}
?>
