mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 05:02:40 +00:00
Finish last Guzzle-related tests
This commit is contained in:
parent
136d3782e3
commit
866800dcc5
3 changed files with 14 additions and 4 deletions
|
@ -34,7 +34,7 @@ return [
|
|||
'API.Miniflux.Error.InvalidTitle' => 'Invalid feed title',
|
||||
'API.Miniflux.Error.InvalidImportCategory' => 'Payload contains an invalid category name',
|
||||
'API.Miniflux.Error.DuplicateImportCategory' => 'Payload contains the same category name twice',
|
||||
'API.Miniflux.Error.FailedImportFeed' => 'Unable to import feed at URL "{url}" (code {code}',
|
||||
'API.Miniflux.Error.FailedImportFeed' => 'Unable to import feed at URL "{url}" (code {code})',
|
||||
'API.Miniflux.Error.InvalidImportLabel' => 'Payload contains an invalid label name',
|
||||
|
||||
'API.TTRSS.Category.Uncategorized' => 'Uncategorized',
|
||||
|
|
|
@ -43,9 +43,13 @@ class TestHTTP extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
|
||||
public function provideTypedMessages(): iterable {
|
||||
return [
|
||||
["respEmpty", [422, ['Content-Length' => "0"]], new Response(422, ['Content-Length' => "0"])],
|
||||
["respText", ["OOK"], new Response(200, ['Content-Type' => "text/plain; charset=UTF-8"], "OOK")],
|
||||
["respText", ["OOK", 201, ['Content-Type' => "application/octet-stream"]], new Response(201, ['Content-Type' => "application/octet-stream"], "OOK")],
|
||||
["respEmpty", [422, ['Content-Length' => "0"]], new Response(422, ['Content-Length' => "0"])],
|
||||
["respText", ["OOK"], new Response(200, ['Content-Type' => "text/plain; charset=UTF-8"], "OOK")],
|
||||
["respText", ["OOK", 201, ['Content-Type' => "application/octet-stream"]], new Response(201, ['Content-Type' => "application/octet-stream"], "OOK")],
|
||||
["respJson", [['ook' => "eek"]], new Response(200, ['Content-Type' => "application/json"], '{"ook":"eek"}')],
|
||||
["respJson", [['ook' => "eek"], 400, ['Content-Type' => "application/feed+json"]], new Response(400, ['Content-Type' => "application/feed+json"], '{"ook":"eek"}')],
|
||||
["respXml", ["<html/>"], new Response(200, ['Content-Type' => "application/xml; charset=UTF-8"], "<html/>")],
|
||||
["respXml", ["<html/>", 451, ['Content-Type' => "text/plain", 'Vary' => "ETag"]], new Response(451, ['Content-Type' => "text/plain", 'Vary' => "ETag"], "<html/>")],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,6 +98,12 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
return $value;
|
||||
}
|
||||
|
||||
public function testGenerateErrorResponse() {
|
||||
$act = V1::respError(["DuplicateUser", 'user' => "john.doe"], 409, ['Cache-Control' => "no-store"]);
|
||||
$exp = HTTP::respJson(['error_message' => 'The user name "john.doe" already exists'], 409, ['Cache-Control' => "no-store"]);
|
||||
$this->assertMessage($exp, $act);
|
||||
}
|
||||
|
||||
/** @dataProvider provideAuthResponses */
|
||||
public function testAuthenticateAUser($token, bool $auth, bool $success): void {
|
||||
$exp = $success ? HTTP::respEmpty(404) : V1::respError("401", 401);
|
||||
|
|
Loading…
Reference in a new issue