mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2025-01-03 14:32:40 +00:00
Tweak authorization exception tests
This commit is contained in:
parent
2c9f6bd5a7
commit
8841da9cbb
1 changed files with 6 additions and 13 deletions
|
@ -251,7 +251,7 @@ class TestAuthorization extends \PHPUnit\Framework\TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
function testInternalExceptionLogic() {
|
function testInternalExceptionLogic() {
|
||||||
$failTest = [
|
$test = [
|
||||||
'userExists',
|
'userExists',
|
||||||
'userRemove',
|
'userRemove',
|
||||||
'userAdd',
|
'userAdd',
|
||||||
|
@ -262,16 +262,10 @@ class TestAuthorization extends \PHPUnit\Framework\TestCase {
|
||||||
'userRightsSet',
|
'userRightsSet',
|
||||||
'userList',
|
'userList',
|
||||||
];
|
];
|
||||||
$passTest = [
|
$this->data->user->auth("gadm@example.com", "");
|
||||||
'userRightsSet',
|
$this->assertCount(0, $this->checkExceptions("user@example.org"));
|
||||||
'userList'
|
$this->data->user->auth("user@example.com", "");
|
||||||
];
|
$this->assertCount(sizeof($test), $this->checkExceptions("user@example.org"));
|
||||||
sort($failTest);
|
|
||||||
sort($passTest);
|
|
||||||
$actor = "user@example.com";
|
|
||||||
$this->data->user->auth($actor, "");
|
|
||||||
$this->assertEquals($passTest, $this->checkExceptions($actor));
|
|
||||||
$this->assertEquals($failTest, $this->checkExceptions("user@example.org"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function testExternalExceptionLogic() {
|
function testExternalExceptionLogic() {
|
||||||
|
@ -319,7 +313,7 @@ class TestAuthorization extends \PHPUnit\Framework\TestCase {
|
||||||
$err[] = "userRightsGet";
|
$err[] = "userRightsGet";
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$this->data->user->rightsSet($user, 10000);
|
$this->data->user->rightsSet($user, User\Driver::RIGHTS_GLOBAL_ADMIN);
|
||||||
} catch(User\ExceptionAuthz $e) {
|
} catch(User\ExceptionAuthz $e) {
|
||||||
$err[] = "userRightsSet";
|
$err[] = "userRightsSet";
|
||||||
}
|
}
|
||||||
|
@ -328,7 +322,6 @@ class TestAuthorization extends \PHPUnit\Framework\TestCase {
|
||||||
} catch(User\ExceptionAuthz $e) {
|
} catch(User\ExceptionAuthz $e) {
|
||||||
$err[] = "userList";
|
$err[] = "userList";
|
||||||
}
|
}
|
||||||
sort($err);
|
|
||||||
return $err;
|
return $err;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue