Tests again

This commit is contained in:
Michael 2021-11-17 23:11:21 +00:00
parent a312940a21
commit 86c14f4d43

View file

@ -710,6 +710,7 @@ class ApiTest extends FixtureTest
$_SERVER['PHP_AUTH_USER'] = 'Test user'; $_SERVER['PHP_AUTH_USER'] = 'Test user';
$_SERVER['PHP_AUTH_PW'] = 'password'; $_SERVER['PHP_AUTH_PW'] = 'password';
$_SESSION['allow_api'] = false; $_SESSION['allow_api'] = false;
BasicAuth::setCurrentUserID();
self::assertFalse(api_get_user()); self::assertFalse(api_get_user());
} }
@ -1423,6 +1424,7 @@ class ApiTest extends FixtureTest
$this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
$_SESSION['allow_api'] = false; $_SESSION['allow_api'] = false;
$_GET['screen_name'] = $this->selfUser['nick']; $_GET['screen_name'] = $this->selfUser['nick'];
BasicAuth::setCurrentUserID();
api_search('json'); api_search('json');
} }
@ -1479,6 +1481,7 @@ class ApiTest extends FixtureTest
$this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
$_SESSION['allow_api'] = false; $_SESSION['allow_api'] = false;
$_GET['screen_name'] = $this->selfUser['nick']; $_GET['screen_name'] = $this->selfUser['nick'];
BasicAuth::setCurrentUserID();
api_statuses_home_timeline('json'); api_statuses_home_timeline('json');
} }
@ -1550,6 +1553,7 @@ class ApiTest extends FixtureTest
$this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
$_SESSION['allow_api'] = false; $_SESSION['allow_api'] = false;
$_GET['screen_name'] = $this->selfUser['nick']; $_GET['screen_name'] = $this->selfUser['nick'];
BasicAuth::setCurrentUserID();
api_statuses_public_timeline('json'); api_statuses_public_timeline('json');
} }
@ -1604,6 +1608,7 @@ class ApiTest extends FixtureTest
$this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
$_SESSION['allow_api'] = false; $_SESSION['allow_api'] = false;
$_GET['screen_name'] = $this->selfUser['nick']; $_GET['screen_name'] = $this->selfUser['nick'];
BasicAuth::setCurrentUserID();
api_statuses_networkpublic_timeline('json'); api_statuses_networkpublic_timeline('json');
} }
@ -1667,6 +1672,7 @@ class ApiTest extends FixtureTest
$this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
$_SESSION['allow_api'] = false; $_SESSION['allow_api'] = false;
$_GET['screen_name'] = $this->selfUser['nick']; $_GET['screen_name'] = $this->selfUser['nick'];
BasicAuth::setCurrentUserID();
api_statuses_show('json'); api_statuses_show('json');
} }
@ -1708,6 +1714,7 @@ class ApiTest extends FixtureTest
$this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
$_SESSION['allow_api'] = false; $_SESSION['allow_api'] = false;
$_GET['screen_name'] = $this->selfUser['nick']; $_GET['screen_name'] = $this->selfUser['nick'];
BasicAuth::setCurrentUserID();
api_conversation_show('json'); api_conversation_show('json');
} }
@ -1822,6 +1829,7 @@ class ApiTest extends FixtureTest
$this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
$_SESSION['allow_api'] = false; $_SESSION['allow_api'] = false;
$_GET['screen_name'] = $this->selfUser['nick']; $_GET['screen_name'] = $this->selfUser['nick'];
BasicAuth::setCurrentUserID();
api_statuses_mentions('json'); api_statuses_mentions('json');
} }
@ -1889,6 +1897,7 @@ class ApiTest extends FixtureTest
$this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
$_SESSION['allow_api'] = false; $_SESSION['allow_api'] = false;
$_GET['screen_name'] = $this->selfUser['nick']; $_GET['screen_name'] = $this->selfUser['nick'];
BasicAuth::setCurrentUserID();
api_statuses_user_timeline('json'); api_statuses_user_timeline('json');
} }
@ -2017,6 +2026,7 @@ class ApiTest extends FixtureTest
$this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
$_SESSION['allow_api'] = false; $_SESSION['allow_api'] = false;
$_GET['screen_name'] = $this->selfUser['nick']; $_GET['screen_name'] = $this->selfUser['nick'];
BasicAuth::setCurrentUserID();
api_favorites('json'); api_favorites('json');
} }
@ -2442,6 +2452,7 @@ class ApiTest extends FixtureTest
$this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
$_SESSION['allow_api'] = false; $_SESSION['allow_api'] = false;
$_GET['screen_name'] = $this->selfUser['nick']; $_GET['screen_name'] = $this->selfUser['nick'];
BasicAuth::setCurrentUserID();
api_lists_statuses('json'); api_lists_statuses('json');
} }
@ -2868,6 +2879,7 @@ class ApiTest extends FixtureTest
$this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
$_SESSION['allow_api'] = false; $_SESSION['allow_api'] = false;
$_GET['screen_name'] = $this->selfUser['nick']; $_GET['screen_name'] = $this->selfUser['nick'];
BasicAuth::setCurrentUserID();
api_direct_messages_box('json', 'sentbox', 'false'); api_direct_messages_box('json', 'sentbox', 'false');
} }