summaryrefslogtreecommitdiffstats
path: root/application/test
diff options
context:
space:
mode:
Diffstat (limited to 'application/test')
-rw-r--r--application/test/tests/test_api_v1.php17
-rw-r--r--application/test/tests/test_api_v2.php17
2 files changed, 12 insertions, 22 deletions
diff --git a/application/test/tests/test_api_v1.php b/application/test/tests/test_api_v1.php
index 43310d7eb..0fb709da8 100644
--- a/application/test/tests/test_api_v1.php
+++ b/application/test/tests/test_api_v1.php
@@ -34,13 +34,8 @@ class test_api_v1 extends \test\Test {
private function createUser($counter)
{
$CI =& get_instance();
- $CI->db->insert("users", array(
- 'username' => "testuser-api_v1-$counter",
- 'password' => $CI->muser->hash_password("testpass$counter"),
- 'email' => "testuser$counter@localhost.invalid",
- 'referrer' => NULL
- ));
-
+ $CI->muser->add_user("apiv1testuser$counter", "testpass$counter",
+ "testuser$counter@testsuite.local", NULL);
return $CI->db->insert_id();
}
@@ -127,7 +122,7 @@ class test_api_v1 extends \test\Test {
{
$this->createUser(1);
$ret = $this->CallEndpoint("POST", "user/create_apikey", array(
- "username" => "testuser-api_v1-1",
+ "username" => "apiv1testuser1",
"password" => "testpass1",
"access_level" => "apikey",
"comment" => "main api key",
@@ -142,7 +137,7 @@ class test_api_v1 extends \test\Test {
$userid = $this->createUser(2);
$apikey = $this->createApikey($userid);
$ret = $this->CallEndpoint("POST", "user/apikeys", array(
- "username" => "testuser-api_v1-2",
+ "username" => "apiv1testuser2",
"password" => "testpass2",
));
$this->expectSuccess("get apikeys", $ret);
@@ -185,7 +180,7 @@ class test_api_v1 extends \test\Test {
{
$userid = $this->createUser(3);
$ret = $this->CallEndpoint("POST", "user/apikeys", array(
- "username" => "testuser-api_v1-3",
+ "username" => "apiv1testuser3",
"password" => "wrongpass",
));
$this->expectError("invalid password", $ret);
@@ -201,7 +196,7 @@ class test_api_v1 extends \test\Test {
{
$userid = $this->createUser(4);
$ret = $this->CallEndpoint("POST", "user/apikeys", array(
- "username" => "testuser-api_v1-invalid",
+ "username" => "apiv1testuserinvalid",
"password" => "testpass4",
));
$this->expectError("invalid username", $ret);
diff --git a/application/test/tests/test_api_v2.php b/application/test/tests/test_api_v2.php
index 912624993..c18cd5b8f 100644
--- a/application/test/tests/test_api_v2.php
+++ b/application/test/tests/test_api_v2.php
@@ -34,13 +34,8 @@ class test_api_v2 extends \test\Test {
private function createUser($counter)
{
$CI =& get_instance();
- $CI->db->insert("users", array(
- 'username' => "testuser-api_v2-$counter",
- 'password' => $CI->muser->hash_password("testpass$counter"),
- 'email' => "testuser$counter@localhost.invalid",
- 'referrer' => NULL
- ));
-
+ $CI->muser->add_user("apiv2testuser$counter", "testpass$counter",
+ "testuser$counter@testsuite.local", NULL);
return $CI->db->insert_id();
}
@@ -127,7 +122,7 @@ class test_api_v2 extends \test\Test {
{
$this->createUser(1);
$ret = $this->CallEndpoint("POST", "user/create_apikey", array(
- "username" => "testuser-api_v2-1",
+ "username" => "apiv2testuser1",
"password" => "testpass1",
"access_level" => "apikey",
"comment" => "main api key",
@@ -142,7 +137,7 @@ class test_api_v2 extends \test\Test {
$userid = $this->createUser(2);
$apikey = $this->createApikey($userid);
$ret = $this->CallEndpoint("POST", "user/apikeys", array(
- "username" => "testuser-api_v2-2",
+ "username" => "apiv2testuser2",
"password" => "testpass2",
));
$this->expectSuccess("get apikeys", $ret);
@@ -185,7 +180,7 @@ class test_api_v2 extends \test\Test {
{
$userid = $this->createUser(3);
$ret = $this->CallEndpoint("POST", "user/apikeys", array(
- "username" => "testuser-api_v2-3",
+ "username" => "apiv2testuser3",
"password" => "wrongpass",
));
$this->expectError("invalid password", $ret);
@@ -201,7 +196,7 @@ class test_api_v2 extends \test\Test {
{
$userid = $this->createUser(4);
$ret = $this->CallEndpoint("POST", "user/apikeys", array(
- "username" => "testuser-api_v2-invalid",
+ "username" => "apiv2testuserinvalid",
"password" => "testpass4",
));
$this->expectError("invalid username", $ret);