Skip to content

use-new-brancher-app-endpoint #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Service/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class App extends AbstractService
public const V2_APP_LIST_URL = "/v2/app/";
public const V2_APP_DETAIL_URL = "/v2/app/%s/";
public const V2_APP_CANCEL_URL = "/v2/app/%s/cancel/";
public const V2_APP_BRANCHER_URL = "/v2/app/%s/brancher/";
public const V2_BRANCHER_APP_URL = "/v2/brancher/app/%s/";
public const V1_APP_FLOWS_URL = "/logbook/v1/logbooks/%s/flows/";

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Service/BrancherApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class BrancherApp extends AbstractService
*/
public function create(string $app, ?array $data = null): string
{
$url = sprintf(App::V2_APP_BRANCHER_URL, $app);
$url = sprintf(App::V2_BRANCHER_APP_URL, $app);

$response = $this->client->api->post($url, [], $data ? json_encode($data) : null);

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/Service/BrancherAppTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function testCreateBrancherApp()

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a mocked response as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The content of the endpoint should still be the same, it's just the url that changed

$request = $this->responses->getLastRequest();
$this->assertEquals('POST', $request->getMethod());
$this->assertEquals('/v2/app/johndoe/brancher/', $request->getUri());
$this->assertEquals('/v2/brancher/app/johndoe/', $request->getUri());
$this->assertEquals('johndoe-eph123456', $brancherAppName);
}

Expand All @@ -46,7 +46,7 @@ public function testCreateBrancherAppWithData()

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the mocked responses are correct anymore, or did it stay the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The content of the endpoint should still be the same, it's just the url that changed

$request = $this->responses->getLastRequest();
$this->assertEquals('POST', $request->getMethod());
$this->assertEquals('/v2/app/johndoe/brancher/', $request->getUri());
$this->assertEquals('/v2/brancher/app/johndoe/', $request->getUri());
$this->assertEquals('johndoe-eph123456', $brancherAppName);
$this->assertJson((string)$request->getBody());
$this->assertEquals(
Expand Down