Tests ...

This commit is contained in:
Michael 2021-11-18 06:03:21 +00:00
parent 9841096ce4
commit 2723e28a18

View file

@ -311,6 +311,7 @@ class ApiTest extends FixtureTest
*/ */
public function testApiLoginWithoutLogin() public function testApiLoginWithoutLogin()
{ {
BasicAuth::setCurrentUserID();
$this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
BasicAuth::getCurrentUserID(true); BasicAuth::getCurrentUserID(true);
} }
@ -324,6 +325,7 @@ class ApiTest extends FixtureTest
*/ */
public function testApiLoginWithBadLogin() public function testApiLoginWithBadLogin()
{ {
BasicAuth::setCurrentUserID();
$this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
$_SERVER['PHP_AUTH_USER'] = 'user@server'; $_SERVER['PHP_AUTH_USER'] = 'user@server';
BasicAuth::getCurrentUserID(true); BasicAuth::getCurrentUserID(true);
@ -358,6 +360,7 @@ class ApiTest extends FixtureTest
*/ */
public function testApiLoginWithCorrectLogin() public function testApiLoginWithCorrectLogin()
{ {
BasicAuth::setCurrentUserID();
$_SERVER['PHP_AUTH_USER'] = 'Test user'; $_SERVER['PHP_AUTH_USER'] = 'Test user';
$_SERVER['PHP_AUTH_PW'] = 'password'; $_SERVER['PHP_AUTH_PW'] = 'password';
BasicAuth::getCurrentUserID(true); BasicAuth::getCurrentUserID(true);
@ -371,6 +374,7 @@ class ApiTest extends FixtureTest
*/ */
public function testApiLoginWithRemoteUser() public function testApiLoginWithRemoteUser()
{ {
BasicAuth::setCurrentUserID();
$this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
$_SERVER['REDIRECT_REMOTE_USER'] = '123456dXNlcjpwYXNzd29yZA=='; $_SERVER['REDIRECT_REMOTE_USER'] = '123456dXNlcjpwYXNzd29yZA==';
BasicAuth::getCurrentUserID(true); BasicAuth::getCurrentUserID(true);