Use JSON with micripub endpoint responses

This commit is contained in:
Jonny Barnes 2016-07-04 13:53:33 +01:00
parent 88b30bb815
commit 128f649722
3 changed files with 71 additions and 29 deletions

View file

@ -32,12 +32,13 @@ class MicropubClientTest extends TestCase
public function testClientPageRecentAuth()
{
$syndication = ['https://twitter.com/jonnybarnes'];
$this->withSession([
'me' => $this->appurl,
'syndication' => 'mp-syndicate-to=twitter.com%2Fjbl5',
'syndication' => $syndication,
])->visit($this->appurl . '/notes/new')
->see($this->appurl)
->see('twitter.com/jbl5');
->see('https://twitter.com/jonnybarnes');
}
/**

View file

@ -25,20 +25,20 @@ class MicropubTest extends TestCase
{
$this->call('GET', $this->appurl . '/api/post');
$this->assertResponseStatus(400);
$this->see('No OAuth token sent with request.');
$this->seeJson(['error_description' => 'No token provided with request']);
}
public function testMicropubRequestWithoutValidToken()
{
$this->call('GET', $this->appurl . '/api/post', [], [], [], ['HTTP_Authorization' => 'Bearer abc123']);
$this->assertResponseStatus(400);
$this->see('Invalid token');
$this->seeJson(['error_description' => 'The provided token did not pass validation']);
}
public function testMicropubRequestWithValidToken()
{
$this->call('GET', $this->appurl . '/api/post', [], [], [], ['HTTP_Authorization' => 'Bearer ' . $this->getToken()]);
$this->see('me=https%3A%2F%2Fjonnybarnes.localhost');
$this->seeJson(['response' => 'token']);
}
public function testMicropubRequestForSyndication()