diff options
author | Florian Pritz <bluewind@xinu.at> | 2016-07-14 15:31:33 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2016-07-14 15:31:33 +0200 |
commit | 2df48cf4b780a5ff481cd8ec02bd40186eb537ee (patch) | |
tree | a5ecaa9b9a7c53f1ad817944006d9c90f81ce2fd /application/test/tests/test_api_v1.php | |
parent | 4a3e17f0c20356b0690bbb52285fe18d4c1a89ae (diff) |
Tests: Use muser->add_user to create test users
Change the username to fit within the username restrictions.
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/test/tests/test_api_v1.php')
-rw-r--r-- | application/test/tests/test_api_v1.php | 17 |
1 files changed, 6 insertions, 11 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); |