mirror of
https://github.com/friendica/friendica
synced 2025-04-26 21:10:16 +00:00
Move all (inactive) API endpoint specific tests to new structure
This commit is contained in:
parent
5aad46c7fb
commit
6fc2eeaeaf
23 changed files with 1122 additions and 951 deletions
44
tests/src/Module/Api/Twitter/Statuses/DestroyTest.php
Normal file
44
tests/src/Module/Api/Twitter/Statuses/DestroyTest.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
|
||||
|
||||
use Friendica\Test\src\Module\Api\ApiTest;
|
||||
|
||||
class DestroyTest extends ApiTest
|
||||
{
|
||||
/**
|
||||
* Test the api_statuses_destroy() function.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiStatusesDestroy()
|
||||
{
|
||||
// $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
|
||||
// api_statuses_destroy('json');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the api_statuses_destroy() function without an authenticated user.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiStatusesDestroyWithoutAuthenticatedUser()
|
||||
{
|
||||
// $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
|
||||
// BasicAuth::setCurrentUserID();
|
||||
// $_SESSION['authenticated'] = false;
|
||||
// api_statuses_destroy('json');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the api_statuses_destroy() function with an ID.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiStatusesDestroyWithId()
|
||||
{
|
||||
// DI::args()->setArgv(['', '', '', 1]);
|
||||
// $result = api_statuses_destroy('json');
|
||||
// self::assertStatus($result['status']);
|
||||
}
|
||||
}
|
59
tests/src/Module/Api/Twitter/Statuses/MentionsTest.php
Normal file
59
tests/src/Module/Api/Twitter/Statuses/MentionsTest.php
Normal file
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
|
||||
|
||||
use Friendica\Test\src\Module\Api\ApiTest;
|
||||
|
||||
class MentionsTest extends ApiTest
|
||||
{
|
||||
/**
|
||||
* Test the api_statuses_mentions() function.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiStatusesMentions()
|
||||
{
|
||||
/*
|
||||
$this->app->setLoggedInUserNickname($this->selfUser['nick']);
|
||||
$_REQUEST['max_id'] = 10;
|
||||
$result = api_statuses_mentions('json');
|
||||
self::assertEmpty($result['status']);
|
||||
// We should test with mentions in the database.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the api_statuses_mentions() function with a negative page parameter.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiStatusesMentionsWithNegativePage()
|
||||
{
|
||||
// $_REQUEST['page'] = -2;
|
||||
// $result = api_statuses_mentions('json');
|
||||
// self::assertEmpty($result['status']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the api_statuses_mentions() function with an unallowed user.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiStatusesMentionsWithUnallowedUser()
|
||||
{
|
||||
// $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
|
||||
// BasicAuth::setCurrentUserID();
|
||||
// api_statuses_mentions('json');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the api_statuses_mentions() function with an RSS result.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiStatusesMentionsWithRss()
|
||||
{
|
||||
// $result = api_statuses_mentions('rss');
|
||||
// self::assertXml($result, 'statuses');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
|
||||
|
||||
use Friendica\Test\src\Module\Api\ApiTest;
|
||||
|
||||
class NetworkPublicTimelineTest extends ApiTest
|
||||
{
|
||||
/**
|
||||
* Test the api_statuses_networkpublic_timeline() function.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiStatusesNetworkpublicTimeline()
|
||||
{
|
||||
/*
|
||||
$_REQUEST['max_id'] = 10;
|
||||
$result = api_statuses_networkpublic_timeline('json');
|
||||
self::assertNotEmpty($result['status']);
|
||||
foreach ($result['status'] as $status) {
|
||||
self::assertStatus($status);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the api_statuses_networkpublic_timeline() function with a negative page parameter.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiStatusesNetworkpublicTimelineWithNegativePage()
|
||||
{
|
||||
/*
|
||||
$_REQUEST['page'] = -2;
|
||||
$result = api_statuses_networkpublic_timeline('json');
|
||||
self::assertNotEmpty($result['status']);
|
||||
foreach ($result['status'] as $status) {
|
||||
self::assertStatus($status);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the api_statuses_networkpublic_timeline() function with an unallowed user.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiStatusesNetworkpublicTimelineWithUnallowedUser()
|
||||
{
|
||||
// $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
|
||||
// BasicAuth::setCurrentUserID();
|
||||
// api_statuses_networkpublic_timeline('json');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the api_statuses_networkpublic_timeline() function with an RSS result.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiStatusesNetworkpublicTimelineWithRss()
|
||||
{
|
||||
// $result = api_statuses_networkpublic_timeline('rss');
|
||||
// self::assertXml($result, 'statuses');
|
||||
}
|
||||
}
|
61
tests/src/Module/Api/Twitter/Statuses/ShowTest.php
Normal file
61
tests/src/Module/Api/Twitter/Statuses/ShowTest.php
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
|
||||
|
||||
use Friendica\Test\src\Module\Api\ApiTest;
|
||||
|
||||
class ShowTest extends ApiTest
|
||||
{
|
||||
/**
|
||||
* Test the api_statuses_show() function.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiStatusesShow()
|
||||
{
|
||||
// $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
|
||||
// api_statuses_show('json');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the api_statuses_show() function with an ID.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiStatusesShowWithId()
|
||||
{
|
||||
// DI::args()->setArgv(['', '', '', 1]);
|
||||
// $result = api_statuses_show('json');
|
||||
// self::assertStatus($result['status']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the api_statuses_show() function with the conversation parameter.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiStatusesShowWithConversation()
|
||||
{
|
||||
/*
|
||||
DI::args()->setArgv(['', '', '', 1]);
|
||||
$_REQUEST['conversation'] = 1;
|
||||
$result = api_statuses_show('json');
|
||||
self::assertNotEmpty($result['status']);
|
||||
foreach ($result['status'] as $status) {
|
||||
self::assertStatus($status);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the api_statuses_show() function with an unallowed user.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiStatusesShowWithUnallowedUser()
|
||||
{
|
||||
// $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
|
||||
// BasicAuth::setCurrentUserID();
|
||||
// api_statuses_show('json');
|
||||
}
|
||||
}
|
71
tests/src/Module/Api/Twitter/Statuses/UserTimelineTest.php
Normal file
71
tests/src/Module/Api/Twitter/Statuses/UserTimelineTest.php
Normal file
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
|
||||
|
||||
use Friendica\Test\src\Module\Api\ApiTest;
|
||||
|
||||
class UserTimelineTest extends ApiTest
|
||||
{
|
||||
/**
|
||||
* Test the api_statuses_user_timeline() function.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiStatusesUserTimeline()
|
||||
{
|
||||
/*
|
||||
$_REQUEST['user_id'] = 42;
|
||||
$_REQUEST['max_id'] = 10;
|
||||
$_REQUEST['exclude_replies'] = true;
|
||||
$_REQUEST['conversation_id'] = 7;
|
||||
|
||||
$result = api_statuses_user_timeline('json');
|
||||
self::assertNotEmpty($result['status']);
|
||||
foreach ($result['status'] as $status) {
|
||||
self::assertStatus($status);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the api_statuses_user_timeline() function with a negative page parameter.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiStatusesUserTimelineWithNegativePage()
|
||||
{
|
||||
/*
|
||||
$_REQUEST['user_id'] = 42;
|
||||
$_REQUEST['page'] = -2;
|
||||
|
||||
$result = api_statuses_user_timeline('json');
|
||||
self::assertNotEmpty($result['status']);
|
||||
foreach ($result['status'] as $status) {
|
||||
self::assertStatus($status);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the api_statuses_user_timeline() function with an RSS result.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiStatusesUserTimelineWithRss()
|
||||
{
|
||||
// $result = api_statuses_user_timeline('rss');
|
||||
// self::assertXml($result, 'statuses');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the api_statuses_user_timeline() function with an unallowed user.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiStatusesUserTimelineWithUnallowedUser()
|
||||
{
|
||||
// $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
|
||||
// BasicAuth::setCurrentUserID();
|
||||
// api_statuses_user_timeline('json');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue