From af8a28eff3b9f112f90df56e0f74da85baa294d8 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 30 Apr 2013 12:56:04 -0700 Subject: [PATCH] CiviSeleniumSettings - Use and document "siteKey" (instead of "sitekey") --- .../CiviTest/CiviSeleniumSettings.php.txt | 6 +++++ tests/phpunit/WebTest/Utils/RestTest.php | 26 +++++++++---------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/tests/phpunit/CiviTest/CiviSeleniumSettings.php.txt b/tests/phpunit/CiviTest/CiviSeleniumSettings.php.txt index ec8fe93ee6..23a5fc11f7 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumSettings.php.txt +++ b/tests/phpunit/CiviTest/CiviSeleniumSettings.php.txt @@ -9,6 +9,7 @@ class CiviSeleniumSettings { var $sandboxURL = 'http://devel.drupal.tests.dev.civicrm.org'; var $sandboxPATH = ''; + var $username = 'demo'; @@ -20,6 +21,11 @@ class CiviSeleniumSettings { var $UFemail = 'noreply@civicrm.org'; + /** + * @var string site API key + */ + var $siteKey = NULL; + /** * @var int seconds */ diff --git a/tests/phpunit/WebTest/Utils/RestTest.php b/tests/phpunit/WebTest/Utils/RestTest.php index 0c644b2c1b..fd88e779a5 100644 --- a/tests/phpunit/WebTest/Utils/RestTest.php +++ b/tests/phpunit/WebTest/Utils/RestTest.php @@ -46,7 +46,7 @@ class WebTest_Utils_RestTest extends CiviSeleniumTestCase { $client = CRM_Utils_HttpClient::singleton(); $params = array( "q" => "civicrm/login", - "key" => $this->settings->sitekey, + "key" => $this->settings->siteKey, "json" => "1", "name" => $this->settings->adminUsername, "pass" => $this->settings->adminPassword @@ -75,11 +75,11 @@ class WebTest_Utils_RestTest extends CiviSeleniumTestCase { } function testValidLoginCMSUser() { - if (property_exists($this->settings, 'sitekey') && !empty($this->settings->sitekey)){ + if (property_exists($this->settings, 'siteKey') && !empty($this->settings->siteKey)){ $client = CRM_Utils_HttpClient::singleton(); $params = array( "q" => "civicrm/login", - "key" => $this->settings->sitekey, + "key" => $this->settings->siteKey, "json" => "1", "name" => $this->settings->adminUsername, "pass" => $this->settings->adminPassword @@ -93,12 +93,12 @@ class WebTest_Utils_RestTest extends CiviSeleniumTestCase { } function testInvalidPasswordLogin() { - if (property_exists($this->settings, 'sitekey') && !empty($this->settings->sitekey)){ + if (property_exists($this->settings, 'siteKey') && !empty($this->settings->siteKey)){ $client = CRM_Utils_HttpClient::singleton(); $badPassword = $this->settings->adminPassword . "badpass"; $params = array( "q" => "civicrm/login", - "key" => $this->settings->sitekey, + "key" => $this->settings->siteKey, "json" => "1", "name" => $this->settings->adminUsername, "pass" => $badPassword @@ -111,13 +111,13 @@ class WebTest_Utils_RestTest extends CiviSeleniumTestCase { } } - function testValidCallSiteKey() { - if (property_exists($this->settings, 'sitekey') && !empty($this->settings->sitekey)){ + function testValidCallsiteKey() { + if (property_exists($this->settings, 'siteKey') && !empty($this->settings->siteKey)){ $client = CRM_Utils_HttpClient::singleton(); $params = array( "entity" => "Contact", "action" => "get", - "key" => $this->settings->sitekey, + "key" => $this->settings->siteKey, "json" => "1", "api_key" => $this->api_key ); @@ -130,7 +130,7 @@ class WebTest_Utils_RestTest extends CiviSeleniumTestCase { } function testValidCallPHPSessionID() { - if (property_exists($this->settings, 'sitekey') && !empty($this->settings->sitekey)){ + if (property_exists($this->settings, 'siteKey') && !empty($this->settings->siteKey)){ $client = CRM_Utils_HttpClient::singleton(); $params = array( "entity" => "Contact", @@ -149,12 +149,12 @@ class WebTest_Utils_RestTest extends CiviSeleniumTestCase { } function testInvalidAPIKey() { - if (property_exists($this->settings, 'sitekey') && !empty($this->settings->sitekey)){ + if (property_exists($this->settings, 'siteKey') && !empty($this->settings->siteKey)){ $client = CRM_Utils_HttpClient::singleton(); $params = array( "entity" => "Contact", "action" => "get", - "key" => $this->settings->sitekey, + "key" => $this->settings->siteKey, "json" => "1", "api_key" => "zzzzzzzzzzzzzzaaaaaaaaaaaaaaaaabadasdasd" ); @@ -167,7 +167,7 @@ class WebTest_Utils_RestTest extends CiviSeleniumTestCase { } function testNotCMSUser() { - if (property_exists($this->settings, 'sitekey') && !empty($this->settings->sitekey)){ + if (property_exists($this->settings, 'siteKey') && !empty($this->settings->siteKey)){ $client = CRM_Utils_HttpClient::singleton(); //Create contact with api_key $test_key = "testing1234"; @@ -182,7 +182,7 @@ class WebTest_Utils_RestTest extends CiviSeleniumTestCase { $params = array( "entity" => "Contact", "action" => "get", - "key" => $this->settings->sitekey, + "key" => $this->settings->siteKey, "json" => "1", "api_key" => $test_key ); -- 2.25.1