if (!property_exists($this->settings, 'siteKey') || empty($this->settings->siteKey)) {
$this->markTestSkipped('CiviSeleniumSettings is missing siteKey');
}
+ if (!property_exists($this->settings, 'adminApiKey') || empty($this->settings->adminApiKey)) {
+ $this->markTestSkipped('CiviSeleniumSettings is missing adminApiKey');
+ }
}
protected function tearDown() {
}
}
+ /*
function testValidLoginCMSUser() {
- $this->_setUpAdminSessionIdAndApiKey();
$client = CRM_Utils_HttpClient::singleton();
$params = array(
"q" => "civicrm/login",
}
function testInvalidPasswordLogin() {
- $this->_setUpAdminSessionIdAndApiKey();
$client = CRM_Utils_HttpClient::singleton();
$badPassword = $this->settings->adminPassword . "badpass";
$params = array(
$this->assertAPIErrorCode($result, 1);
}
- function testValidCallsiteKey() {
+ function testValidCallPHPSessionID() {
$this->_setUpAdminSessionIdAndApiKey();
$client = CRM_Utils_HttpClient::singleton();
$params = array(
"entity" => "Contact",
"action" => "get",
- "key" => $this->settings->siteKey,
"json" => "1",
- "api_key" => $this->api_key
+ "PHPSESSID" => $this->session_id,
+ "api_key" => $this->api_key,
);
list($status, $data) = $client->post($this->url, $params);
$this->assertEquals(CRM_Utils_HttpClient::STATUS_OK, $status);
$this->assertNotNull($result);
$this->assertAPIErrorCode($result, 0);
}
+ */
- function testValidCallPHPSessionID() {
- $this->_setUpAdminSessionIdAndApiKey();
+ function testValidCallAPIKey() {
$client = CRM_Utils_HttpClient::singleton();
$params = array(
"entity" => "Contact",
"action" => "get",
+ "key" => $this->settings->siteKey,
"json" => "1",
- "PHPSESSID" => $this->session_id,
- "api_key" => $this->api_key,
+ "api_key" => $this->settings->adminApiKey,
);
list($status, $data) = $client->post($this->url, $params);
$this->assertEquals(CRM_Utils_HttpClient::STATUS_OK, $status);
}
function testInvalidAPIKey() {
- $this->_setUpAdminSessionIdAndApiKey();
$client = CRM_Utils_HttpClient::singleton();
$params = array(
"entity" => "Contact",
"action" => "get",
"key" => $this->settings->siteKey,
"json" => "1",
- "api_key" => "zzzzzzzzzzzzzzaaaaaaaaaaaaaaaaabadasdasd"
+ "api_key" => 'garbage_' . $this->settings->adminApiKey,
);
list($status, $data) = $client->post($this->url, $params);
$this->assertEquals(CRM_Utils_HttpClient::STATUS_OK, $status);
}
function testNotCMSUser() {
- $this->_setUpAdminSessionIdAndApiKey();
$client = CRM_Utils_HttpClient::singleton();
//Create contact with api_key
$test_key = "testing1234";
$this->assertAPIErrorCode($result, 1);
}
+ /*
protected function _setUpAdminSessionIdAndApiKey() {
$client = CRM_Utils_HttpClient::singleton();
$params = array(
$this->assertAPIErrorCode($result, 0);
$this->api_key = $result["api_key"];
$this->session_id = $result["PHPSESSID"];
- $this->asserTrue(isset($this->api_key), 'Failed to find admin API key');
+ $this->assertTrue(isset($this->api_key), 'Failed to find admin API key');
return $result;
- }
-
+ } // */
}