Skip to content

Commit

Permalink
implements upload image
Browse files Browse the repository at this point in the history
  • Loading branch information
David Albrecht committed May 12, 2016
1 parent da4dcdf commit 13879d0
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
22 changes: 22 additions & 0 deletions resources/service.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,28 @@
'required' => false
],
]
],
'uploadImage' => [
'httpMethod' => 'POST',
'uri' => 'api/v1/upload_image',
'responseModel' => 'GetResponse',
'parameters' => [
'image' => [
'type' => 'string',
'location' => 'postField',
'required' => false
],
'avatar' => [
'type' => 'string',
'location' => 'postField',
'required' => false
],
'header' => [
'type' => 'string',
'location' => 'postField',
'required' => false
]
]
]
],
'models' => [
Expand Down
14 changes: 14 additions & 0 deletions tests/OpenBazaar/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,20 @@ public function testCreateContract()
$client = $this->createClient('post_contracts', $history);
$response = $client->createContract();
}
public function testUploadImage()
{
$history = new History();
$this->setExpectedException('GuzzleHttp\Command\Exception\CommandException', 'Validation errors: [image] must be of type string
[avatar] must be of type string
[header] must be of type string');
$client = $this->createClient('upload_image', $history);
$parameters = [
'image' => false,
'avatar' => false,
'header' => false,
];
$response = $client->uploadImage($parameters);
}

protected function createClient($mock, History $history)
{
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/upload_image
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"success" : "true", "image_hashes" : ["667aef5304372c69ffcd9cf374b837e4f1ab1af3"] }

0 comments on commit 13879d0

Please sign in to comment.