Respond to a q=config request

This commit is contained in:
Jonny Barnes 2016-07-04 15:35:17 +01:00
parent 128f649722
commit a9d30c3a57
2 changed files with 25 additions and 0 deletions

View file

@ -168,6 +168,25 @@ EOD;
'places' => $places
]);
}
//nope, ho about a config query?
if ($request->input('q') == 'config') {
return response()->json([
'syndicate-to' => [[
'uid' => 'https://twitter.com/jonnybarnes',
'name' => 'jonnybarnes on Twitter',
'service' => [
'name' => 'Twitter',
'url' => 'https://twitter.com',
'photo' => 'https://upload.wikimedia.org/wikipedia/en/9/9f/Twitter_bird_logo_2012.svg',
],
'user' => [
'name' => 'jonnybarnes',
'url' => 'https://twitter.com/jonnybarnes',
'photo' => 'https://pbs.twimg.com/profile_images/1853565405/jmb-bw.jpg',
],
]],
]);
}
//nope, just return the token
return response()->json([

View file

@ -59,6 +59,12 @@ class MicropubTest extends TestCase
$this->see('[]');
}
public function testMicropubRequestForConfig()
{
$this->call('GET', $this->appurl . '/api/post', ['q' => 'config'], [], [], ['HTTP_Authorization' => 'Bearer ' . $this->getToken()]);
$this->seeJson(['uid' => 'https://twitter.com/jonnybarnes']);
}
public function testMicropubRequestCreateNewNote()
{
$faker = \Faker\Factory::create();