-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve tests for new lti signing request removes un-necissary changes to session and cache drivers in test
- Loading branch information
Showing
10 changed files
with
183 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,13 @@ protected function tearDown(): void | |
} | ||
} | ||
|
||
protected static function remove_all_roles_for_user($user_id) | ||
{ | ||
\DB::delete('perm_role_to_user') | ||
->where('user_id', $user_id) | ||
->execute(); | ||
} | ||
|
||
protected static function clear_fuel_input() | ||
{ | ||
// reset fuelphp's input class | ||
|
@@ -196,6 +203,10 @@ protected function _as_student() | |
\Fuel\Tasks\Admin::new_user($uname, 'test', 'd', 'student', '[email protected]', $pword); | ||
$user = \Model_User::find_by_username($uname); | ||
} | ||
else | ||
{ | ||
static::remove_all_roles_for_user($user->id); | ||
} | ||
|
||
$login = \Service_User::login($uname, $pword); | ||
$this->assertTrue($login); | ||
|
@@ -215,13 +226,16 @@ protected function _as_author() | |
{ | ||
require_once(APPPATH.'/tasks/admin.php'); | ||
\Fuel\Tasks\Admin::new_user($uname, 'Prof', 'd', 'Author', '[email protected]', $pword); | ||
\Fuel\Tasks\Admin::give_user_role($uname, 'basic_author'); | ||
$user = \Model_User::find_by_username($uname); | ||
} | ||
else | ||
{ | ||
static::remove_all_roles_for_user($user->id); | ||
} | ||
|
||
\Materia\Perm_Manager::add_users_to_roles_system_only([$user->id], [\Materia\Perm_Role::AUTHOR]); | ||
$login = \Service_User::login($uname, $pword); | ||
$this->assertTrue($login); | ||
|
||
$this->users_to_clean[] = $user; | ||
return $user; | ||
} | ||
|
@@ -238,10 +252,14 @@ protected function _as_author_2() | |
{ | ||
require_once(APPPATH.'/tasks/admin.php'); | ||
\Fuel\Tasks\Admin::new_user($uname, 'test', 'd', 'author', '[email protected]', $pword); | ||
\Fuel\Tasks\Admin::give_user_role($uname, 'basic_author'); | ||
$user = \Model_User::find_by_username($uname); | ||
} | ||
else | ||
{ | ||
static::remove_all_roles_for_user($user->id); | ||
} | ||
|
||
\Materia\Perm_Manager::add_users_to_roles_system_only([$user->id], [\Materia\Perm_Role::AUTHOR]); | ||
$login = \Service_User::login($uname, $pword); | ||
$this->assertTrue($login); | ||
$this->users_to_clean[] = $user; | ||
|
@@ -260,10 +278,14 @@ protected function _as_author_3() | |
{ | ||
require_once(APPPATH.'/tasks/admin.php'); | ||
\Fuel\Tasks\Admin::new_user($uname, 'test', 'd', 'author', '[email protected]', $pword); | ||
\Fuel\Tasks\Admin::give_user_role($uname, 'basic_author'); | ||
$user = \Model_User::find_by_username($uname); | ||
} | ||
else | ||
{ | ||
static::remove_all_roles_for_user($user->id); | ||
} | ||
|
||
\Materia\Perm_Manager::add_users_to_roles_system_only([$user->id], [\Materia\Perm_Role::AUTHOR]); | ||
$login = \Service_User::login($uname, $pword); | ||
$this->assertTrue($login); | ||
$this->users_to_clean[] = $user; | ||
|
@@ -282,12 +304,14 @@ protected function _as_super_user() | |
{ | ||
require_once(APPPATH.'/tasks/admin.php'); | ||
\Fuel\Tasks\Admin::new_user($uname, 'test', 'd', 'su', '[email protected]', $pword); | ||
// TODO: super_user should get all these rights inherently right??????!!!! | ||
\Fuel\Tasks\Admin::give_user_role($uname, 'super_user'); | ||
\Fuel\Tasks\Admin::give_user_role($uname, 'basic_author'); | ||
$user = \Model_User::find_by_username($uname); | ||
} | ||
else | ||
{ | ||
static::remove_all_roles_for_user($user->id); | ||
} | ||
|
||
\Materia\Perm_Manager::add_users_to_roles_system_only([$user->id], [\Materia\Perm_Role::AUTHOR, \Materia\Perm_Role::SU]); | ||
$login = \Service_User::login($uname, $pword); | ||
$this->assertTrue($login); | ||
$this->users_to_clean[] = $user; | ||
|
@@ -305,11 +329,14 @@ protected function _as_noauth() | |
{ | ||
require_once(APPPATH.'/tasks/admin.php'); | ||
\Fuel\Tasks\Admin::new_user($uname, 'test', 'd', 'noauth', '[email protected]', $pword); | ||
// TODO: super_user should get all these rights inherently right??????!!!! | ||
\Fuel\Tasks\Admin::give_user_role($uname, 'no_author'); | ||
$user = \Model_User::find_by_username($uname); | ||
} | ||
else | ||
{ | ||
static::remove_all_roles_for_user($user->id); | ||
} | ||
|
||
\Materia\Perm_Manager::add_users_to_roles_system_only([$user->id], [\Materia\Perm_Role::NOAUTH]); | ||
$login = \Service_User::login($uname, $pword); | ||
$this->assertTrue($login); | ||
$this->users_to_clean[] = $user; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.