Re-enable AccountVerifyCredentials test

This commit is contained in:
Philipp 2021-12-04 22:34:51 +01:00
parent 902bcc506f
commit cc7b2fae4e
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
4 changed files with 246 additions and 174 deletions

View file

@ -2,6 +2,9 @@
namespace Friendica\Test\src\Module\Api\Mastodon\Accounts;
use Friendica\App\Router;
use Friendica\DI;
use Friendica\Module\Api\Mastodon\Accounts\VerifyCredentials;
use Friendica\Test\src\Module\Api\ApiTest;
class VerifyCredentialsTest extends ApiTest
@ -13,7 +16,18 @@ class VerifyCredentialsTest extends ApiTest
*/
public function testApiAccountVerifyCredentials()
{
// self::assertArrayHasKey('user', api_account_verify_credentials('json'));
$verifyCredentials = new VerifyCredentials(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
$response = $verifyCredentials->run();
$body = (string)$response->getBody();
self::assertJson($body);
$json = json_decode($body);
self::assertEquals(42, $json->id);
self::assertIsArray($json->emojis);
self::assertIsArray($json->fields);
}
/**
@ -23,6 +37,8 @@ class VerifyCredentialsTest extends ApiTest
*/
public function testApiAccountVerifyCredentialsWithoutAuthenticatedUser()
{
self::markTestIncomplete('Needs dynamic BasicAuth first');
// $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
// BasicAuth::setCurrentUserID();
// $_SESSION['authenticated'] = false;