Added application and project roles validation for API procedure calls

This commit is contained in:
Frederic Guillot
2016-06-26 10:25:13 -04:00
parent 922e0fb6de
commit 4a230d331e
79 changed files with 1772 additions and 761 deletions

View File

@@ -0,0 +1,54 @@
<?php
require_once __DIR__.'/BaseProcedureTest.php';
class AppProcedureTest extends BaseProcedureTest
{
public function testGetTimezone()
{
$this->assertEquals('UTC', $this->app->getTimezone());
}
public function testGetVersion()
{
$this->assertEquals('master', $this->app->getVersion());
}
public function testGetApplicationRoles()
{
$roles = $this->app->getApplicationRoles();
$this->assertCount(3, $roles);
$this->assertEquals('Administrator', $roles['app-admin']);
$this->assertEquals('Manager', $roles['app-manager']);
$this->assertEquals('User', $roles['app-user']);
}
public function testGetProjectRoles()
{
$roles = $this->app->getProjectRoles();
$this->assertCount(3, $roles);
$this->assertEquals('Project Manager', $roles['project-manager']);
$this->assertEquals('Project Member', $roles['project-member']);
$this->assertEquals('Project Viewer', $roles['project-viewer']);
}
public function testGetDefaultColor()
{
$this->assertEquals('yellow', $this->user->getDefaultTaskColor());
}
public function testGetDefaultColors()
{
$colors = $this->user->getDefaultTaskColors();
$this->assertNotEmpty($colors);
$this->assertArrayHasKey('red', $colors);
}
public function testGetColorList()
{
$colors = $this->user->getColorList();
$this->assertNotEmpty($colors);
$this->assertArrayHasKey('red', $colors);
$this->assertEquals('Red', $colors['red']);
}
}