Re enable Blocks/Lists test

This commit is contained in:
Philipp 2021-12-04 23:24:56 +01:00
parent 6b03ee2922
commit 7ca47e8d21
No known key found for this signature in database
GPG Key ID: 24A7501396EB5432
3 changed files with 17 additions and 16 deletions

View File

@ -87,6 +87,6 @@ class Lists extends ContactEndpoint
self::setLinkHeader(); self::setLinkHeader();
System::jsonExit($return); $this->response->exit('lists', ['lists' => $return]);
} }
} }

View File

@ -2,6 +2,7 @@
namespace Friendica\Test\src\Module\Api\Twitter\Account; namespace Friendica\Test\src\Module\Api\Twitter\Account;
use Friendica\App\Router;
use Friendica\Capabilities\ICanCreateResponses; use Friendica\Capabilities\ICanCreateResponses;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Api\Twitter\Account\RateLimitStatus; use Friendica\Module\Api\Twitter\Account\RateLimitStatus;
@ -11,7 +12,7 @@ class RateLimitStatusTest extends ApiTest
{ {
public function testWithJson() public function testWithJson()
{ {
$rateLimitStatus = new RateLimitStatus(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']); $rateLimitStatus = new RateLimitStatus(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']);
$response = $rateLimitStatus->run(); $response = $rateLimitStatus->run();
$result = json_decode($response->getBody()); $result = json_decode($response->getBody());

View File

@ -2,30 +2,28 @@
namespace Friendica\Test\src\Module\Api\Twitter\Blocks; namespace Friendica\Test\src\Module\Api\Twitter\Blocks;
use Friendica\App\Router;
use Friendica\DI;
use Friendica\Module\Api\Twitter\Blocks\Lists;
use Friendica\Test\src\Module\Api\ApiTest; use Friendica\Test\src\Module\Api\ApiTest;
class ListsTest extends ApiTest class ListsTest extends ApiTest
{ {
/** /**
* Test the api_statuses_f() function. * Test the api_statuses_f() function.
*
* @return void
*/ */
public function testApiStatusesFWithBlocks() public function testApiStatusesFWithBlocks()
{ {
// $result = api_statuses_f('blocks'); $lists = new Lists(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
// self::assertArrayHasKey('user', $result); $response = $lists->run();
}
/** $body = (string)$response->getBody();
* Test the api_blocks_list() function.
* self::assertJson($body);
* @return void
*/ $json = json_decode($body);
public function testApiBlocksList()
{ self::assertIsArray($json->users);
// $result = api_blocks_list('json');
// self::assertArrayHasKey('user', $result);
} }
/** /**
@ -35,6 +33,8 @@ class ListsTest extends ApiTest
*/ */
public function testApiBlocksListWithUndefinedCursor() public function testApiBlocksListWithUndefinedCursor()
{ {
self::markTestIncomplete('Needs refactoring of Lists - replace filter_input() with $request parameter checks');
// $_GET['cursor'] = 'undefined'; // $_GET['cursor'] = 'undefined';
// self::assertFalse(api_blocks_list('json')); // self::assertFalse(api_blocks_list('json'));
} }