Commit 3cdedf36255ace5d96280b35e70a56a26b0c9911
1 parent
4ca0e690
Added unit tests for user webservice functions
Committed By: Kevin Cyster Reviewed By: Megan Watson
Showing
1 changed file
with
30 additions
and
0 deletions
tests/api/testAcl.php
| ... | ... | @@ -54,6 +54,36 @@ class APIAclTestCase extends KTUnitTestCase { |
| 54 | 54 | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | + /** | |
| 58 | + * Method to test the user webservice fucntions | |
| 59 | + * | |
| 60 | + */ | |
| 61 | + public function testUsers_KTAPI() | |
| 62 | + { | |
| 63 | + $response = $this->ktapi->get_user_list(); | |
| 64 | + $this->assertIsA($response, 'array'); | |
| 65 | + $this->assertEqual($response['status_code'], 0); | |
| 66 | + $this->assertNoErrors(); | |
| 67 | + | |
| 68 | + $response = $this->ktapi->get_user_by_id(1); | |
| 69 | + $this->assertIsA($response, 'array'); | |
| 70 | + $this->assertEqual($response['status_code'], 0); | |
| 71 | + $this->assertEqual($response['results']['name'], 'Administrator'); | |
| 72 | + $this->assertNoErrors(); | |
| 73 | + | |
| 74 | + $response = $this->ktapi->get_user_by_username('admin'); | |
| 75 | + $this->assertIsA($response, 'array'); | |
| 76 | + $this->assertEqual($response['status_code'], 0); | |
| 77 | + $this->assertEqual($response['results']['name'], 'Administrator'); | |
| 78 | + $this->assertNoErrors(); | |
| 79 | + | |
| 80 | + $response = $this->ktapi->get_user_by_name('Administrator'); | |
| 81 | + $this->assertIsA($response, 'array'); | |
| 82 | + $this->assertEqual($response['status_code'], 0); | |
| 83 | + $this->assertEqual($response['results']['name'], 'Administrator'); | |
| 84 | + $this->assertNoErrors(); | |
| 85 | + } | |
| 86 | + | |
| 57 | 87 | /** |
| 58 | 88 | * Test KTAPI_Group getList(), getById(), getByName |
| 59 | 89 | * | ... | ... |