Reenable Twitter/Lookup tests & add standard assertions

This commit is contained in:
Philipp 2021-12-09 21:32:17 +01:00
parent f9c490b29a
commit 616cf012f9
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
4 changed files with 90 additions and 56 deletions

View file

@ -2,6 +2,10 @@
namespace Friendica\Test\src\Module\Api\Twitter\Users;
use Friendica\App\Router;
use Friendica\DI;
use Friendica\Module\Api\Twitter\Users\Lookup;
use Friendica\Network\HTTPException\NotFoundException;
use Friendica\Test\src\Module\Api\ApiTest;
class LookupTest extends ApiTest
@ -13,8 +17,10 @@ class LookupTest extends ApiTest
*/
public function testApiUsersLookup()
{
// $this->expectException(\Friendica\Network\HTTPException\NotFoundException::class);
// api_users_lookup('json');
$this->expectException(NotFoundException::class);
$lookup = new Lookup(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
$lookup->run();
}
/**
@ -24,8 +30,11 @@ class LookupTest extends ApiTest
*/
public function testApiUsersLookupWithUserId()
{
// $_REQUEST['user_id'] = $this->otherUser['id'];
// $result = api_users_lookup('json');
// self::assertOtherUser($result['users'][0]);
$lookup = new Lookup(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
$respone = $lookup->run(['user_id' => static::OTHER_USER['id']]);
$json = $this->toJson($respone);
self::assertOtherUser($json[0]);
}
}