|
11 | 11 |
|
12 | 12 | class BrancherAppTest extends HypernodeClientTestCase
|
13 | 13 | {
|
| 14 | + public function testListBrancherApp() |
| 15 | + { |
| 16 | + $this->responses->append( |
| 17 | + new Response(200, [], json_encode([ |
| 18 | + 'name' => 'johndoe-eph123456', |
| 19 | + 'parent' => 'johndoe', |
| 20 | + 'type' => 'brancher', |
| 21 | + 'branchers' => [] |
| 22 | + ])), |
| 23 | + ); |
| 24 | + |
| 25 | + $branchers = $this->client->brancherApp->list('johndoe'); |
| 26 | + |
| 27 | + $request = $this->responses->getLastRequest(); |
| 28 | + $this->assertEquals('GET', $request->getMethod()); |
| 29 | + $this->assertEquals('/v2/brancher/app/johndoe/', $request->getUri()); |
| 30 | + $this->assertEquals([], $branchers); |
| 31 | + } |
| 32 | + |
| 33 | + public function testListBrancherAppRaisesClientExceptions() |
| 34 | + { |
| 35 | + $badRequestResponse = new Response(400, [], json_encode([ |
| 36 | + 'non_field_errors' => ['Your request was invalid.'] |
| 37 | + ])); |
| 38 | + $this->responses->append($badRequestResponse); |
| 39 | + |
| 40 | + $this->expectExceptionObject(new HypernodeApiClientException($badRequestResponse)); |
| 41 | + |
| 42 | + $this->client->brancherApp->list('johndoe'); |
| 43 | + } |
| 44 | + |
| 45 | + public function testListBrancherAppRaisesServerExceptions() |
| 46 | + { |
| 47 | + $badRequestResponse = new Response(500, [], json_encode([ |
| 48 | + 'non_field_errors' => ['Something went wrong processing your request.'] |
| 49 | + ])); |
| 50 | + $this->responses->append($badRequestResponse); |
| 51 | + |
| 52 | + $this->expectExceptionObject(new HypernodeApiServerException($badRequestResponse)); |
| 53 | + |
| 54 | + $this->client->brancherApp->list('johndoe'); |
| 55 | + } |
| 56 | + |
14 | 57 | public function testCreateBrancherApp()
|
15 | 58 | {
|
16 | 59 | $this->responses->append(
|
|
0 commit comments