diff --git a/composer.json b/composer.json index c3e3814..1b1be72 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,8 @@ "require-dev": { "graham-campbell/analyzer": "^2.4", "phpunit/phpunit": "^8.5|^9.0", - "php-http/guzzle6-adapter": "^2.0" + "php-http/guzzle6-adapter": "^2.0", + "php-http/mock-client": "^1.3" }, "autoload": { "psr-4": { diff --git a/src/Api/Repositories/Workspaces/Repositories.php b/src/Api/Repositories/Workspaces/Repositories.php new file mode 100644 index 0000000..3cf82f5 --- /dev/null +++ b/src/Api/Repositories/Workspaces/Repositories.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Bitbucket\Api\Repositories\Workspaces; + +/** + * The users api class. + * + * @author Graham Campbell + */ +class Repositories extends AbstractWorkspacesApi +{ + /** + * @param string $repo + * @param array $params + * + * @throws \Http\Client\Exception + * + * @return array + */ + public function show(string $repo, array $params = []) + { + $path = $this->buildRepositoryPath($repo); + + return $this->get($path, $params); + } + + /** + * Build the commit path from the given parts. + * + * @param string[] $parts + * + * @throws \Bitbucket\Exception\InvalidArgumentException + * + * @return string + */ + protected function buildRepositoryPath(string ...$parts) + { + return static::buildPath('repositories', $this->username, ...$parts); + } +} diff --git a/src/Api/Workspaces.php b/src/Api/Workspaces.php index 4af70bb..0fe6dcb 100644 --- a/src/Api/Workspaces.php +++ b/src/Api/Workspaces.php @@ -60,6 +60,20 @@ public function show(array $params = []) return $this->get($path, $params); } + /** + * @param array $params + * + * @throws \Http\Client\Exception + * + * @return array + */ + public function list(array $params = []) + { + $path = $this->buildWorkspacesPath(); + + return $this->get($path, $params); + } + /** * @param array $params * diff --git a/src/Api/Workspaces/Projects.php b/src/Api/Workspaces/Projects.php index 8e20710..a48b50d 100644 --- a/src/Api/Workspaces/Projects.php +++ b/src/Api/Workspaces/Projects.php @@ -71,7 +71,7 @@ public function show(string $project, array $params = []) * * @return array */ - public function update(string $project, array $params = []) + public function update(string $project, array $params) { $path = $this->buildProjectsPath($project); @@ -104,6 +104,6 @@ public function remove(string $project, array $params = []) */ protected function buildProjectsPath(string ...$parts) { - return static::buildPath('workspaces', $this->username, 'projects', ...$parts); + return static::buildPath('workspaces', $this->workspace, 'projects', ...$parts); } } diff --git a/tests/ProjectsTest.php b/tests/ProjectsTest.php new file mode 100644 index 0000000..121145f --- /dev/null +++ b/tests/ProjectsTest.php @@ -0,0 +1,91 @@ +getClient($response); + $projects = $client->workspaces('my-workspace')->projects()->list(); + + $this->assertCount(9, $projects['values']); + } + + public function test_project_show() + { + $response = new ProjectsShowResponse(); + $client = $this->getClient($response); + $project = $client->workspaces('my-workspace')->projects()->show('Atlassian1'); + + $this->assertCount(11, $project); + } + + public function test_project_create() + { + $response = new ProjectCreateResponse(); + $client = $this->getClient($response); + + $params = [ + 'name' => 'name', + 'key' => 'key', + 'description' => 'description', + 'links' => (object) [ + 'avatar' => (object) [ + 'href' => '', + ], + ], + 'is_private' => true, + ]; + + $project = $client->workspaces('my-workspace')->projects()->create( + $params + ); + + $this->assertCount(11, $project); + } + + public function test_project_update() + { + $response = new ProjectUpdateResponse(); + $client = $this->getClient($response); + + $params = [ + 'name' => 'name-updated', + 'key' => 'Atlassian1', + 'description' => 'description-updated', + 'links' => (object) [ + 'avatar' => (object) [ + 'href' => '', + ], + ], + 'is_private' => true, + ]; + + $project = $client->workspaces('my-workspace')->projects()->update( + 'Atlassian1', + $params + ); + + $this->assertCount(11, $project); + } + + public function test_project_remove() + { + $response = new ProjectRemoveResponse(); + $client = $this->getClient($response); + + $project = $client->workspaces('my-workspace')->projects()->remove( + 'Atlassian1' + ); + + $this->assertCount(0, $project); + } +} diff --git a/tests/TestCase.php b/tests/TestCase.php new file mode 100644 index 0000000..60afadd --- /dev/null +++ b/tests/TestCase.php @@ -0,0 +1,25 @@ +getClient($response); + $workspaces = $client->workspaces('my-workspace')->list(); + + $this->assertCount(4, $workspaces); + } + + public function test_workspace_show() + { + $response = new WorkspacesShowResponse(); + $client = $this->getClient($response); + $workspace = $client->workspaces('my-workspace')->show(); + + $this->assertCount(7, $workspace); + } +} diff --git a/tests/responses/BaseResponse.php b/tests/responses/BaseResponse.php new file mode 100644 index 0000000..cdbb504 --- /dev/null +++ b/tests/responses/BaseResponse.php @@ -0,0 +1,26 @@ +packagePath($path)); + } +} diff --git a/tests/responses/ProjectCreateResponse.php b/tests/responses/ProjectCreateResponse.php new file mode 100644 index 0000000..1007941 --- /dev/null +++ b/tests/responses/ProjectCreateResponse.php @@ -0,0 +1,26 @@ +getJsonContent('stubs/project-create-success.json'); + + return new Response(200, ['Content-Type' => 'application/json'], $json); + } +} diff --git a/tests/responses/ProjectRemoveResponse.php b/tests/responses/ProjectRemoveResponse.php new file mode 100644 index 0000000..c488fd4 --- /dev/null +++ b/tests/responses/ProjectRemoveResponse.php @@ -0,0 +1,26 @@ +getJsonContent('stubs/project-remove-success.json'); + + return new Response(200, ['Content-Type' => 'application/json'], $json); + } +} diff --git a/tests/responses/ProjectUpdateResponse.php b/tests/responses/ProjectUpdateResponse.php new file mode 100644 index 0000000..9981a8c --- /dev/null +++ b/tests/responses/ProjectUpdateResponse.php @@ -0,0 +1,26 @@ +getJsonContent('stubs/project-update-success.json'); + + return new Response(200, ['Content-Type' => 'application/json'], $json); + } +} diff --git a/tests/responses/ProjectsAllResponse.php b/tests/responses/ProjectsAllResponse.php new file mode 100644 index 0000000..2fc02f9 --- /dev/null +++ b/tests/responses/ProjectsAllResponse.php @@ -0,0 +1,26 @@ +getJsonContent('stubs/projects-all-success.json'); + + return new Response(200, ['Content-Type' => 'application/json'], $json); + } +} diff --git a/tests/responses/ProjectsListResponse.php b/tests/responses/ProjectsListResponse.php new file mode 100644 index 0000000..74b7324 --- /dev/null +++ b/tests/responses/ProjectsListResponse.php @@ -0,0 +1,26 @@ +getJsonContent('stubs/projects-list-success.json'); + + return new Response(200, ['Content-Type' => 'application/json'], $json); + } +} diff --git a/tests/responses/ProjectsShowResponse.php b/tests/responses/ProjectsShowResponse.php new file mode 100644 index 0000000..a5a117b --- /dev/null +++ b/tests/responses/ProjectsShowResponse.php @@ -0,0 +1,26 @@ +getJsonContent('stubs/projects-show-success.json'); + + return new Response($statusCode, ['Content-Type' => 'application/json'], $json); + } +} diff --git a/tests/responses/WorkspacesAllResponse.php b/tests/responses/WorkspacesAllResponse.php new file mode 100644 index 0000000..02ec362 --- /dev/null +++ b/tests/responses/WorkspacesAllResponse.php @@ -0,0 +1,26 @@ +getJsonContent('stubs/workspaces-all-success.json'); + + return new Response(200, ['Content-Type' => 'application/json'], $json); + } +} diff --git a/tests/responses/WorkspacesListResponse.php b/tests/responses/WorkspacesListResponse.php new file mode 100644 index 0000000..08d07fd --- /dev/null +++ b/tests/responses/WorkspacesListResponse.php @@ -0,0 +1,26 @@ +getJsonContent('stubs/workspaces-list-success.json'); + + return new Response(200, ['Content-Type' => 'application/json'], $json); + } +} diff --git a/tests/responses/WorkspacesShowResponse.php b/tests/responses/WorkspacesShowResponse.php new file mode 100644 index 0000000..d759ced --- /dev/null +++ b/tests/responses/WorkspacesShowResponse.php @@ -0,0 +1,26 @@ +getJsonContent('stubs/workspaces-show-success.json'); + + return new Response(200, ['Content-Type' => 'application/json'], $json); + } +} diff --git a/tests/stubs/project-create-success.json b/tests/stubs/project-create-success.json new file mode 100644 index 0000000..7214a39 --- /dev/null +++ b/tests/stubs/project-create-success.json @@ -0,0 +1,58 @@ +{ + "description":"description", + "links":{ + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/john_doe/projects/TEST" + }, + "html":{ + "href":"https://bitbucket.org/john_doe/workspace/projects/TEST" + }, + "repositories":[ + + ], + "avatar":{ + "href":"" + } + }, + "uuid":"{4762738f-3caa-44f7-8dd2-bd25237f7ade}", + "created_on":"2020-06-29T10:24:26.594408+00:00", + "workspace":{ + "slug":"john_doe", + "type":"workspace", + "name":"john-doe", + "links":{ + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html":{ + "href":"https://bitbucket.org/john_doe/" + }, + "avatar":{ + "href":"https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid":"{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key":"key", + "owner":{ + "username":"john_doe", + "display_name":"john-doe", + "type":"team", + "uuid":"{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links":{ + "self":{ + "href":"https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html":{ + "href":"https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar":{ + "href":"https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on":"2020-06-29T10:24:26.594431+00:00", + "type":"project", + "is_private":true, + "name":"name" +} \ No newline at end of file diff --git a/tests/stubs/project-remove-success.json b/tests/stubs/project-remove-success.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/tests/stubs/project-remove-success.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/tests/stubs/project-update-success.json b/tests/stubs/project-update-success.json new file mode 100644 index 0000000..e9241e0 --- /dev/null +++ b/tests/stubs/project-update-success.json @@ -0,0 +1,58 @@ +{ + "description":"description-updated", + "links":{ + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian1" + }, + "html":{ + "href":"https://bitbucket.org/john_doe/workspace/projects/Atlassian1" + }, + "repositories":[ + + ], + "avatar":{ + "href":"" + } + }, + "uuid":"{4762738f-3caa-44f7-8dd2-bd25237f7ade}", + "created_on":"2020-06-29T10:24:26.594408+00:00", + "workspace":{ + "slug":"john_doe", + "type":"workspace", + "name":"john-doe", + "links":{ + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html":{ + "href":"https://bitbucket.org/john_doe/" + }, + "avatar":{ + "href":"https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid":"{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key":"Atlassian1", + "owner":{ + "username":"john_doe", + "display_name":"john-doe", + "type":"team", + "uuid":"{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links":{ + "self":{ + "href":"https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html":{ + "href":"https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar":{ + "href":"https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on":"2020-06-29T10:35:50.718200+00:00", + "type":"project", + "is_private":true, + "name":"name-updated" +} \ No newline at end of file diff --git a/tests/stubs/projects-all-success.json b/tests/stubs/projects-all-success.json new file mode 100644 index 0000000..6e4ae62 --- /dev/null +++ b/tests/stubs/projects-all-success.json @@ -0,0 +1,645 @@ +{ + "pagelen": 100, + "values": [ + { + "description": "", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian1" + }, + "html": { + "href": "https://bitbucket.org/john_doe/workspace/projects/Atlassian1" + }, + "repositories": { + "href": "https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian1\"" + }, + "avatar": { + "href": "https://bitbucket.org/account/user/john_doe/projects/Atlassian1/avatar/32?ts=1592993838" + } + }, + "uuid": "{f38daeea-d64f-44f7-afc8-f972d09b1d08}", + "created_on": "2020-06-24T10:17:18.875720+00:00", + "workspace": { + "slug": "john_doe", + "type": "workspace", + "name": "john-doe", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html": { + "href": "https://bitbucket.org/john_doe/" + }, + "avatar": { + "href": "https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key": "Atlassian1", + "owner": { + "username": "john_doe", + "display_name": "john-doe", + "type": "team", + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html": { + "href": "https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar": { + "href": "https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on": "2020-06-24T10:17:18.875739+00:00", + "type": "project", + "is_private": true, + "name": "Atlassian1" + }, + { + "description": null, + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian2" + }, + "html": { + "href": "https://bitbucket.org/john_doe/workspace/projects/Atlassian2" + }, + "repositories": { + "href": "https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian2\"" + }, + "avatar": { + "href": "https://bitbucket.org/account/user/john_doe/projects/Atlassian2/avatar/32?ts=1589292488" + } + }, + "uuid": "{320ae6b5-04a2-495e-8ef2-642cd50817ba}", + "created_on": "2020-05-12T14:08:08.062102+00:00", + "workspace": { + "slug": "john_doe", + "type": "workspace", + "name": "john-doe", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html": { + "href": "https://bitbucket.org/john_doe/" + }, + "avatar": { + "href": "https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key": "Atlassian2", + "owner": { + "username": "john_doe", + "display_name": "john-doe", + "type": "team", + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html": { + "href": "https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar": { + "href": "https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on": "2020-05-12T14:08:08.062141+00:00", + "type": "project", + "is_private": false, + "name": "Atlassian2" + }, + { + "description": null, + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian3" + }, + "html": { + "href": "https://bitbucket.org/john_doe/workspace/projects/Atlassian3" + }, + "repositories": { + "href": "https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian3\"" + }, + "avatar": { + "href": "https://bitbucket.org/account/user/john_doe/projects/Atlassian3/avatar/32?ts=1588922476" + } + }, + "uuid": "{fa26f90b-26bb-4ce5-9253-1ba44c5307df}", + "created_on": "2020-05-08T07:21:16.638095+00:00", + "workspace": { + "slug": "john_doe", + "type": "workspace", + "name": "john-doe", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html": { + "href": "https://bitbucket.org/john_doe/" + }, + "avatar": { + "href": "https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key": "Atlassian3", + "owner": { + "username": "john_doe", + "display_name": "john-doe", + "type": "team", + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html": { + "href": "https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar": { + "href": "https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on": "2020-05-08T07:21:16.638109+00:00", + "type": "project", + "is_private": false, + "name": "Atlassian3" + }, + { + "description": "", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian4" + }, + "html": { + "href": "https://bitbucket.org/john_doe/workspace/projects/Atlassian4" + }, + "repositories": { + "href": "https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian4\"" + }, + "avatar": { + "href": "https://bitbucket.org/account/user/john_doe/projects/Atlassian4/avatar/32?ts=1582298430" + } + }, + "uuid": "{6a489fd0-08a4-4915-9e64-4add52c0b1e6}", + "created_on": "2020-02-21T15:19:50.594200+00:00", + "workspace": { + "slug": "john_doe", + "type": "workspace", + "name": "john-doe", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html": { + "href": "https://bitbucket.org/john_doe/" + }, + "avatar": { + "href": "https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key": "Atlassian4", + "owner": { + "username": "john_doe", + "display_name": "john-doe", + "type": "team", + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html": { + "href": "https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar": { + "href": "https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on": "2020-02-21T15:20:30.301162+00:00", + "type": "project", + "is_private": false, + "name": "Atlassian4" + }, + { + "description": "", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian5" + }, + "html": { + "href": "https://bitbucket.org/john_doe/workspace/projects/Atlassian5" + }, + "repositories": { + "href": "https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian5\"" + }, + "avatar": { + "href": "https://bitbucket.org/account/user/john_doe/projects/Atlassian5/avatar/32?ts=1580310154" + } + }, + "uuid": "{a04d2b8e-04b5-4dbb-abad-a10517d9f418}", + "created_on": "2020-01-29T15:02:34.818938+00:00", + "workspace": { + "slug": "john_doe", + "type": "workspace", + "name": "john-doe", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html": { + "href": "https://bitbucket.org/john_doe/" + }, + "avatar": { + "href": "https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key": "Atlassian5", + "owner": { + "username": "john_doe", + "display_name": "john-doe", + "type": "team", + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html": { + "href": "https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar": { + "href": "https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on": "2020-01-29T15:02:34.818955+00:00", + "type": "project", + "is_private": true, + "name": "Atlassian5" + }, + { + "description": "", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian6" + }, + "html": { + "href": "https://bitbucket.org/john_doe/workspace/projects/Atlassian6" + }, + "repositories": { + "href": "https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian6\"" + }, + "avatar": { + "href": "https://bitbucket.org/account/user/john_doe/projects/Atlassian6/avatar/32?ts=1574078583" + } + }, + "uuid": "{81f98281-973f-4cf2-a6a9-8a31e3872211}", + "created_on": "2019-11-18T11:59:29.084414+00:00", + "workspace": { + "slug": "john_doe", + "type": "workspace", + "name": "john-doe", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html": { + "href": "https://bitbucket.org/john_doe/" + }, + "avatar": { + "href": "https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key": "Atlassian6", + "owner": { + "username": "john_doe", + "display_name": "john-doe", + "type": "team", + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html": { + "href": "https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar": { + "href": "https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on": "2019-11-18T12:03:03.696455+00:00", + "type": "project", + "is_private": true, + "name": "Atlassian6" + }, + { + "description": "", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian7" + }, + "html": { + "href": "https://bitbucket.org/john_doe/workspace/projects/Atlassian7" + }, + "repositories": { + "href": "https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian7\"" + }, + "avatar": { + "href": "https://bitbucket.org/account/user/john_doe/projects/Atlassian7/avatar/32?ts=1593011466" + } + }, + "uuid": "{95d40011-a2ef-4e27-ba05-899e0fa9b3bd}", + "created_on": "2019-11-06T14:25:50.773844+00:00", + "workspace": { + "slug": "john_doe", + "type": "workspace", + "name": "john-doe", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html": { + "href": "https://bitbucket.org/john_doe/" + }, + "avatar": { + "href": "https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key": "Atlassian7", + "owner": { + "username": "john_doe", + "display_name": "john-doe", + "type": "team", + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html": { + "href": "https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar": { + "href": "https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on": "2020-06-24T15:11:06.066911+00:00", + "type": "project", + "is_private": false, + "name": "Atlassian7" + }, + { + "description": null, + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian8" + }, + "html": { + "href": "https://bitbucket.org/john_doe/workspace/projects/Atlassian8" + }, + "repositories": { + "href": "https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian8\"" + }, + "avatar": { + "href": "https://bitbucket.org/account/user/john_doe/projects/Atlassian8/avatar/32?ts=1572018611" + } + }, + "uuid": "{07be1185-daff-4879-b75e-9f9d1a10fcb1}", + "created_on": "2019-10-25T15:50:11.938768+00:00", + "workspace": { + "slug": "john_doe", + "type": "workspace", + "name": "john-doe", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html": { + "href": "https://bitbucket.org/john_doe/" + }, + "avatar": { + "href": "https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key": "Atlassian8", + "owner": { + "username": "john_doe", + "display_name": "john-doe", + "type": "team", + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html": { + "href": "https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar": { + "href": "https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on": "2019-10-25T15:50:11.938787+00:00", + "type": "project", + "is_private": false, + "name": "Atlassian8" + }, + { + "description": "", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian9" + }, + "html": { + "href": "https://bitbucket.org/john_doe/workspace/projects/Atlassian9" + }, + "repositories": { + "href": "https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian9\"" + }, + "avatar": { + "href": "https://bitbucket.org/account/user/john_doe/projects/Atlassian9/avatar/32?ts=1571998444" + } + }, + "uuid": "{9b15c9a7-6d6f-4639-ae23-c86307e19a89}", + "created_on": "2019-10-25T10:14:04.450212+00:00", + "workspace": { + "slug": "john_doe", + "type": "workspace", + "name": "john-doe", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html": { + "href": "https://bitbucket.org/john_doe/" + }, + "avatar": { + "href": "https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key": "Atlassian9", + "owner": { + "username": "john_doe", + "display_name": "john-doe", + "type": "team", + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html": { + "href": "https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar": { + "href": "https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on": "2019-10-25T10:14:04.450232+00:00", + "type": "project", + "is_private": true, + "name": "Atlassian9" + }, + { + "description": "", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian10" + }, + "html": { + "href": "https://bitbucket.org/john_doe/workspace/projects/Atlassian10" + }, + "repositories": { + "href": "https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian10\"" + }, + "avatar": { + "href": "https://bitbucket.org/account/user/john_doe/projects/Atlassian10/avatar/32?ts=1571998444" + } + }, + "uuid": "{9b15c9a7-6d6f-4639-ae23-c86307e19a89}", + "created_on": "2019-10-25T10:14:04.450212+00:00", + "workspace": { + "slug": "john_doe", + "type": "workspace", + "name": "john-doe", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html": { + "href": "https://bitbucket.org/john_doe/" + }, + "avatar": { + "href": "https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key": "Atlassian10", + "owner": { + "username": "john_doe", + "display_name": "john-doe", + "type": "team", + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html": { + "href": "https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar": { + "href": "https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on": "2019-10-25T10:14:04.450232+00:00", + "type": "project", + "is_private": true, + "name": "Atlassian10" + }, + { + "description": "", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian11" + }, + "html": { + "href": "https://bitbucket.org/john_doe/workspace/projects/Atlassian11" + }, + "repositories": { + "href": "https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian11\"" + }, + "avatar": { + "href": "https://bitbucket.org/account/user/john_doe/projects/Atlassian11/avatar/32?ts=1571998444" + } + }, + "uuid": "{9b15c9a7-6d6f-4639-ae23-c86307e19a89}", + "created_on": "2019-10-25T10:14:04.450212+00:00", + "workspace": { + "slug": "john_doe", + "type": "workspace", + "name": "john-doe", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html": { + "href": "https://bitbucket.org/john_doe/" + }, + "avatar": { + "href": "https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key": "Atlassian11", + "owner": { + "username": "john_doe", + "display_name": "john-doe", + "type": "team", + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html": { + "href": "https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar": { + "href": "https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on": "2019-10-25T10:14:04.450232+00:00", + "type": "project", + "is_private": true, + "name": "Atlassian11" + } + ], + "page": 1, + "size": 11 +} \ No newline at end of file diff --git a/tests/stubs/projects-list-success.json b/tests/stubs/projects-list-success.json new file mode 100644 index 0000000..5d1c7df --- /dev/null +++ b/tests/stubs/projects-list-success.json @@ -0,0 +1,529 @@ +{ + "pagelen":10, + "values":[ + { + "description": "", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian1" + }, + "html": { + "href": "https://bitbucket.org/john_doe/workspace/projects/Atlassian1" + }, + "repositories": { + "href": "https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian1\"" + }, + "avatar": { + "href": "https://bitbucket.org/account/user/john_doe/projects/Atlassian1/avatar/32?ts=1592993838" + } + }, + "uuid": "{f38daeea-d64f-44f7-afc8-f972d09b1d08}", + "created_on": "2020-06-24T10:17:18.875720+00:00", + "workspace": { + "slug": "john_doe", + "type": "workspace", + "name": "john-doe", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html": { + "href": "https://bitbucket.org/john_doe/" + }, + "avatar": { + "href": "https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key": "Atlassian1", + "owner": { + "username": "john_doe", + "display_name": "john-doe", + "type": "team", + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html": { + "href": "https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar": { + "href": "https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on": "2020-06-24T10:17:18.875739+00:00", + "type": "project", + "is_private": true, + "name": "Atlassian1" + }, + { + "description": null, + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian2" + }, + "html": { + "href": "https://bitbucket.org/john_doe/workspace/projects/Atlassian2" + }, + "repositories": { + "href": "https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian2\"" + }, + "avatar": { + "href": "https://bitbucket.org/account/user/john_doe/projects/Atlassian2/avatar/32?ts=1589292488" + } + }, + "uuid": "{320ae6b5-04a2-495e-8ef2-642cd50817ba}", + "created_on": "2020-05-12T14:08:08.062102+00:00", + "workspace": { + "slug": "john_doe", + "type": "workspace", + "name": "john-doe", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html": { + "href": "https://bitbucket.org/john_doe/" + }, + "avatar": { + "href": "https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key": "Atlassian2", + "owner": { + "username": "john_doe", + "display_name": "john-doe", + "type": "team", + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html": { + "href": "https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar": { + "href": "https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on": "2020-05-12T14:08:08.062141+00:00", + "type": "project", + "is_private": false, + "name": "Atlassian2" + }, + { + "description": null, + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian3" + }, + "html": { + "href": "https://bitbucket.org/john_doe/workspace/projects/Atlassian3" + }, + "repositories": { + "href": "https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian3\"" + }, + "avatar": { + "href": "https://bitbucket.org/account/user/john_doe/projects/Atlassian3/avatar/32?ts=1588922476" + } + }, + "uuid": "{fa26f90b-26bb-4ce5-9253-1ba44c5307df}", + "created_on": "2020-05-08T07:21:16.638095+00:00", + "workspace": { + "slug": "john_doe", + "type": "workspace", + "name": "john-doe", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html": { + "href": "https://bitbucket.org/john_doe/" + }, + "avatar": { + "href": "https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key": "Atlassian3", + "owner": { + "username": "john_doe", + "display_name": "john-doe", + "type": "team", + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html": { + "href": "https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar": { + "href": "https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on": "2020-05-08T07:21:16.638109+00:00", + "type": "project", + "is_private": false, + "name": "Atlassian3" + }, + { + "description": "", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian4" + }, + "html": { + "href": "https://bitbucket.org/john_doe/workspace/projects/Atlassian4" + }, + "repositories": { + "href": "https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian4\"" + }, + "avatar": { + "href": "https://bitbucket.org/account/user/john_doe/projects/Atlassian4/avatar/32?ts=1582298430" + } + }, + "uuid": "{6a489fd0-08a4-4915-9e64-4add52c0b1e6}", + "created_on": "2020-02-21T15:19:50.594200+00:00", + "workspace": { + "slug": "john_doe", + "type": "workspace", + "name": "john-doe", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html": { + "href": "https://bitbucket.org/john_doe/" + }, + "avatar": { + "href": "https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key": "Atlassian4", + "owner": { + "username": "john_doe", + "display_name": "john-doe", + "type": "team", + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html": { + "href": "https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar": { + "href": "https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on": "2020-02-21T15:20:30.301162+00:00", + "type": "project", + "is_private": false, + "name": "Atlassian4" + }, + { + "description": "", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian5" + }, + "html": { + "href": "https://bitbucket.org/john_doe/workspace/projects/Atlassian5" + }, + "repositories": { + "href": "https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian5\"" + }, + "avatar": { + "href": "https://bitbucket.org/account/user/john_doe/projects/Atlassian5/avatar/32?ts=1580310154" + } + }, + "uuid": "{a04d2b8e-04b5-4dbb-abad-a10517d9f418}", + "created_on": "2020-01-29T15:02:34.818938+00:00", + "workspace": { + "slug": "john_doe", + "type": "workspace", + "name": "john-doe", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html": { + "href": "https://bitbucket.org/john_doe/" + }, + "avatar": { + "href": "https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key": "Atlassian5", + "owner": { + "username": "john_doe", + "display_name": "john-doe", + "type": "team", + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html": { + "href": "https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar": { + "href": "https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on": "2020-01-29T15:02:34.818955+00:00", + "type": "project", + "is_private": true, + "name": "Atlassian5" + }, + { + "description": "", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian6" + }, + "html": { + "href": "https://bitbucket.org/john_doe/workspace/projects/Atlassian6" + }, + "repositories": { + "href": "https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian6\"" + }, + "avatar": { + "href": "https://bitbucket.org/account/user/john_doe/projects/Atlassian6/avatar/32?ts=1574078583" + } + }, + "uuid": "{81f98281-973f-4cf2-a6a9-8a31e3872211}", + "created_on": "2019-11-18T11:59:29.084414+00:00", + "workspace": { + "slug": "john_doe", + "type": "workspace", + "name": "john-doe", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html": { + "href": "https://bitbucket.org/john_doe/" + }, + "avatar": { + "href": "https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key": "Atlassian6", + "owner": { + "username": "john_doe", + "display_name": "john-doe", + "type": "team", + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html": { + "href": "https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar": { + "href": "https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on": "2019-11-18T12:03:03.696455+00:00", + "type": "project", + "is_private": true, + "name": "Atlassian6" + }, + { + "description": "", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian7" + }, + "html": { + "href": "https://bitbucket.org/john_doe/workspace/projects/Atlassian7" + }, + "repositories": { + "href": "https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian7\"" + }, + "avatar": { + "href": "https://bitbucket.org/account/user/john_doe/projects/Atlassian7/avatar/32?ts=1593011466" + } + }, + "uuid": "{95d40011-a2ef-4e27-ba05-899e0fa9b3bd}", + "created_on": "2019-11-06T14:25:50.773844+00:00", + "workspace": { + "slug": "john_doe", + "type": "workspace", + "name": "john-doe", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html": { + "href": "https://bitbucket.org/john_doe/" + }, + "avatar": { + "href": "https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key": "Atlassian7", + "owner": { + "username": "john_doe", + "display_name": "john-doe", + "type": "team", + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html": { + "href": "https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar": { + "href": "https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on": "2020-06-24T15:11:06.066911+00:00", + "type": "project", + "is_private": false, + "name": "Atlassian7" + }, + { + "description": null, + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian8" + }, + "html": { + "href": "https://bitbucket.org/john_doe/workspace/projects/Atlassian8" + }, + "repositories": { + "href": "https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian8\"" + }, + "avatar": { + "href": "https://bitbucket.org/account/user/john_doe/projects/Atlassian8/avatar/32?ts=1572018611" + } + }, + "uuid": "{07be1185-daff-4879-b75e-9f9d1a10fcb1}", + "created_on": "2019-10-25T15:50:11.938768+00:00", + "workspace": { + "slug": "john_doe", + "type": "workspace", + "name": "john-doe", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html": { + "href": "https://bitbucket.org/john_doe/" + }, + "avatar": { + "href": "https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key": "Atlassian8", + "owner": { + "username": "john_doe", + "display_name": "john-doe", + "type": "team", + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html": { + "href": "https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar": { + "href": "https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on": "2019-10-25T15:50:11.938787+00:00", + "type": "project", + "is_private": false, + "name": "Atlassian8" + }, + { + "description": "", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian9" + }, + "html": { + "href": "https://bitbucket.org/john_doe/workspace/projects/Atlassian9" + }, + "repositories": { + "href": "https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian9\"" + }, + "avatar": { + "href": "https://bitbucket.org/account/user/john_doe/projects/Atlassian9/avatar/32?ts=1571998444" + } + }, + "uuid": "{9b15c9a7-6d6f-4639-ae23-c86307e19a89}", + "created_on": "2019-10-25T10:14:04.450212+00:00", + "workspace": { + "slug": "john_doe", + "type": "workspace", + "name": "john-doe", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html": { + "href": "https://bitbucket.org/john_doe/" + }, + "avatar": { + "href": "https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key": "Atlassian9", + "owner": { + "username": "john_doe", + "display_name": "john-doe", + "type": "team", + "uuid": "{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links": { + "self": { + "href": "https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html": { + "href": "https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar": { + "href": "https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on": "2019-10-25T10:14:04.450232+00:00", + "type": "project", + "is_private": true, + "name": "Atlassian9" + } + ], + "page":1, + "size":9 +} \ No newline at end of file diff --git a/tests/stubs/projects-show-success.json b/tests/stubs/projects-show-success.json new file mode 100644 index 0000000..a8a1342 --- /dev/null +++ b/tests/stubs/projects-show-success.json @@ -0,0 +1,58 @@ +{ + "description":"", + "links":{ + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/john_doe/projects/Atlassian1" + }, + "html":{ + "href":"https://bitbucket.org/john_doe/workspace/projects/Atlassian1" + }, + "repositories":{ + "href":"https://api.bitbucket.org/2.0/repositories/john_doe?q=project.key=\"Atlassian1\"" + }, + "avatar":{ + "href":"https://bitbucket.org/account/user/john_doe/projects/Atlassian1/avatar/32?ts=1571998444" + } + }, + "uuid":"{9b15c9a7-6d6f-4639-ae23-c86307e19a89}", + "created_on":"2019-10-25T10:14:04.450212+00:00", + "workspace":{ + "slug":"john_doe", + "type":"workspace", + "name":"offline-agency", + "links":{ + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "html":{ + "href":"https://bitbucket.org/john_doe/" + }, + "avatar":{ + "href":"https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + } + }, + "uuid":"{eaf34f99-08d3-4888-ac79-b806e8927edd}" + }, + "key":"Atlassian1", + "owner":{ + "username":"john_doe", + "display_name":"john-doe", + "type":"team", + "uuid":"{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links":{ + "self":{ + "href":"https://api.bitbucket.org/2.0/teams/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D" + }, + "html":{ + "href":"https://bitbucket.org/%7Beaf34f99-08d3-4888-ac79-b806e8927edd%7D/" + }, + "avatar":{ + "href":"https://bitbucket.org/account/john_doe/avatar/" + } + } + }, + "updated_on":"2019-10-25T10:14:04.450232+00:00", + "type":"project", + "is_private":true, + "name":"Atlassian1" +} \ No newline at end of file diff --git a/tests/stubs/workspaces-all-success.json b/tests/stubs/workspaces-all-success.json new file mode 100644 index 0000000..094dd77 --- /dev/null +++ b/tests/stubs/workspaces-all-success.json @@ -0,0 +1,381 @@ +{ + "pagelen":50, + "values":[ + { + "uuid":"{0584df52-5266-40ae-b72e-b72658b09f50}", + "links":{ + "owners":{ + "href":"https://api.bitbucket.org/2.0/workspaces/john_doe/members?q=permission%3D%22owner%22" + }, + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "repositories":{ + "href":"https://api.bitbucket.org/2.0/repositories/john_doe" + }, + "snippets":{ + "href":"https://api.bitbucket.org/2.0/snippets/john_doe" + }, + "html":{ + "href":"https://bitbucket.org/john_doe/" + }, + "avatar":{ + "href":"https://bitbucket.org/workspaces/john_doe/avatar/?ts=1543645840" + }, + "members":{ + "href":"https://api.bitbucket.org/2.0/workspaces/john_doe/members" + }, + "projects":{ + "href":"https://api.bitbucket.org/2.0/workspaces/john_doe/projects" + } + }, + "created_on":"2018-12-01T06:30:40.906876+00:00", + "type":"workspace", + "slug":"john_doe", + "is_private":true, + "name":"John Doe" + }, + { + "uuid":"{36c4305a-34ad-4853-967f-bca30aeeba81}", + "links":{ + "owners":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_1/members?q=permission%3D%22owner%22" + }, + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_1" + }, + "repositories":{ + "href":"https://api.bitbucket.org/2.0/repositories/atlassian_1" + }, + "snippets":{ + "href":"https://api.bitbucket.org/2.0/snippets/atlassian_1" + }, + "html":{ + "href":"https://bitbucket.org/atlassian_1/" + }, + "avatar":{ + "href":"https://bitbucket.org/workspaces/atlassian_1/avatar/?ts=1543645840" + }, + "members":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_1/members" + }, + "projects":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_1/projects" + } + }, + "created_on":"2018-12-01T06:30:40.921862+00:00", + "type":"workspace", + "slug":"atlassian_1", + "is_private":false, + "name":"atlassian_1" + }, + { + "uuid":"{b5d5d71e-49d3-4917-9390-b88e25ecb2a6}", + "links":{ + "owners":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian/members?q=permission%3D%22owner%22" + }, + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian" + }, + "repositories":{ + "href":"https://api.bitbucket.org/2.0/repositories/atlassian" + }, + "snippets":{ + "href":"https://api.bitbucket.org/2.0/snippets/atlassian" + }, + "html":{ + "href":"https://bitbucket.org/atlassian/" + }, + "avatar":{ + "href":"https://bitbucket.org/workspaces/atlassian/avatar/?ts=1543668122" + }, + "members":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian/members" + }, + "projects":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian/projects" + } + }, + "created_on":"2018-12-01T12:42:02.071886+00:00", + "type":"workspace", + "slug":"atlassian", + "is_private":false, + "name":"Atlassian" + }, + { + "uuid":"{5b98396b-d55e-44ae-8559-46b55559ebe2}", + "links":{ + "owners":{ + "href":"https://api.bitbucket.org/2.0/workspaces/bill_doe/members?q=permission%3D%22owner%22" + }, + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/bill_doe" + }, + "repositories":{ + "href":"https://api.bitbucket.org/2.0/repositories/bill_doe" + }, + "snippets":{ + "href":"https://api.bitbucket.org/2.0/snippets/bill_doe" + }, + "html":{ + "href":"https://bitbucket.org/bill_doe/" + }, + "avatar":{ + "href":"https://bitbucket.org/workspaces/bill_doe/avatar/?ts=1543675270" + }, + "members":{ + "href":"https://api.bitbucket.org/2.0/workspaces/bill_doe/members" + }, + "projects":{ + "href":"https://api.bitbucket.org/2.0/workspaces/bill_doe/projects" + } + }, + "created_on":"2018-12-01T14:41:10.784154+00:00", + "type":"workspace", + "slug":"bill_doe", + "is_private":false, + "name":"Bill Doe" + }, + { + "uuid":"{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links":{ + "owners":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_2/members?q=permission%3D%22owner%22" + }, + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_2" + }, + "repositories":{ + "href":"https://api.bitbucket.org/2.0/repositories/atlassian_2" + }, + "snippets":{ + "href":"https://api.bitbucket.org/2.0/snippets/atlassian_2" + }, + "html":{ + "href":"https://bitbucket.org/atlassian_2/" + }, + "avatar":{ + "href":"https://bitbucket.org/workspaces/atlassian_2/avatar/?ts=1571998380" + }, + "members":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_2/members" + }, + "projects":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_2/projects" + } + }, + "created_on":"2019-10-25T10:13:00.687887+00:00", + "type":"workspace", + "slug":"atlassian_2", + "is_private":false, + "name":"Atlassian 2" + }, + { + "uuid":"{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links":{ + "owners":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_3/members?q=permission%3D%22owner%22" + }, + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_3" + }, + "repositories":{ + "href":"https://api.bitbucket.org/2.0/repositories/atlassian_3" + }, + "snippets":{ + "href":"https://api.bitbucket.org/2.0/snippets/atlassian_3" + }, + "html":{ + "href":"https://bitbucket.org/atlassian_3/" + }, + "avatar":{ + "href":"https://bitbucket.org/workspaces/atlassian_3/avatar/?ts=1571998380" + }, + "members":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_3/members" + }, + "projects":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_3/projects" + } + }, + "created_on":"2019-10-25T10:13:00.687887+00:00", + "type":"workspace", + "slug":"atlassian_3", + "is_private":false, + "name":"Atlassian 3" + }, + { + "uuid":"{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links":{ + "owners":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_4/members?q=permission%3D%22owner%22" + }, + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_4" + }, + "repositories":{ + "href":"https://api.bitbucket.org/2.0/repositories/atlassian_4" + }, + "snippets":{ + "href":"https://api.bitbucket.org/2.0/snippets/atlassian_4" + }, + "html":{ + "href":"https://bitbucket.org/atlassian_4/" + }, + "avatar":{ + "href":"https://bitbucket.org/workspaces/atlassian_4/avatar/?ts=1571998380" + }, + "members":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_4/members" + }, + "projects":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_4/projects" + } + }, + "created_on":"2019-10-25T10:13:00.687887+00:00", + "type":"workspace", + "slug":"atlassian_4", + "is_private":false, + "name":"Atlassian 4" + }, + { + "uuid":"{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links":{ + "owners":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_5/members?q=permission%3D%22owner%22" + }, + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_5" + }, + "repositories":{ + "href":"https://api.bitbucket.org/2.0/repositories/atlassian_5" + }, + "snippets":{ + "href":"https://api.bitbucket.org/2.0/snippets/atlassian_5" + }, + "html":{ + "href":"https://bitbucket.org/atlassian_5/" + }, + "avatar":{ + "href":"https://bitbucket.org/workspaces/atlassian_5/avatar/?ts=1571998380" + }, + "members":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_5/members" + }, + "projects":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_5/projects" + } + }, + "created_on":"2019-10-25T10:13:00.687887+00:00", + "type":"workspace", + "slug":"atlassian_5", + "is_private":false, + "name":"Atlassian 5" + }, + { + "uuid":"{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links":{ + "owners":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_6/members?q=permission%3D%22owner%22" + }, + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_6" + }, + "repositories":{ + "href":"https://api.bitbucket.org/2.0/repositories/atlassian_6" + }, + "snippets":{ + "href":"https://api.bitbucket.org/2.0/snippets/atlassian_6" + }, + "html":{ + "href":"https://bitbucket.org/atlassian_6/" + }, + "avatar":{ + "href":"https://bitbucket.org/workspaces/atlassian_6/avatar/?ts=1571998380" + }, + "members":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_6/members" + }, + "projects":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_6/projects" + } + }, + "created_on":"2019-10-25T10:13:00.687887+00:00", + "type":"workspace", + "slug":"atlassian_6", + "is_private":false, + "name":"Atlassian 6" + }, + { + "uuid":"{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links":{ + "owners":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_7/members?q=permission%3D%22owner%22" + }, + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_7" + }, + "repositories":{ + "href":"https://api.bitbucket.org/2.0/repositories/atlassian_7" + }, + "snippets":{ + "href":"https://api.bitbucket.org/2.0/snippets/atlassian_7" + }, + "html":{ + "href":"https://bitbucket.org/atlassian_7/" + }, + "avatar":{ + "href":"https://bitbucket.org/workspaces/atlassian_7/avatar/?ts=1571998380" + }, + "members":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_7/members" + }, + "projects":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_7/projects" + } + }, + "created_on":"2019-10-25T10:13:00.687887+00:00", + "type":"workspace", + "slug":"atlassian_7", + "is_private":false, + "name":"Atlassian 7" + }, + { + "uuid":"{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links":{ + "owners":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_8/members?q=permission%3D%22owner%22" + }, + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_8" + }, + "repositories":{ + "href":"https://api.bitbucket.org/2.0/repositories/atlassian_8" + }, + "snippets":{ + "href":"https://api.bitbucket.org/2.0/snippets/atlassian_8" + }, + "html":{ + "href":"https://bitbucket.org/atlassian_8/" + }, + "avatar":{ + "href":"https://bitbucket.org/workspaces/atlassian_8/avatar/?ts=1571998380" + }, + "members":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_8/members" + }, + "projects":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_8/projects" + } + }, + "created_on":"2019-10-25T10:13:00.687887+00:00", + "type":"workspace", + "slug":"atlassian_8", + "is_private":false, + "name":"Atlassian 8" + } + ], + "page":1, + "size":11 +} diff --git a/tests/stubs/workspaces-list-success.json b/tests/stubs/workspaces-list-success.json new file mode 100644 index 0000000..f12274d --- /dev/null +++ b/tests/stubs/workspaces-list-success.json @@ -0,0 +1,143 @@ +{ + "pagelen":10, + "values":[ + { + "uuid":"{0584df52-5266-40ae-b72e-b72658b09f50}", + "links":{ + "owners":{ + "href":"https://api.bitbucket.org/2.0/workspaces/john_doe/members?q=permission%3D%22owner%22" + }, + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "repositories":{ + "href":"https://api.bitbucket.org/2.0/repositories/john_doe" + }, + "snippets":{ + "href":"https://api.bitbucket.org/2.0/snippets/john_doe" + }, + "html":{ + "href":"https://bitbucket.org/john_doe/" + }, + "avatar":{ + "href":"https://bitbucket.org/workspaces/john_doe/avatar/?ts=1543645840" + }, + "members":{ + "href":"https://api.bitbucket.org/2.0/workspaces/john_doe/members" + }, + "projects":{ + "href":"https://api.bitbucket.org/2.0/workspaces/john_doe/projects" + } + }, + "created_on":"2018-12-01T06:30:40.906876+00:00", + "type":"workspace", + "slug":"john_doe", + "is_private":true, + "name":"John Doe" + }, + { + "uuid":"{36c4305a-34ad-4853-967f-bca30aeeba81}", + "links":{ + "owners":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_1/members?q=permission%3D%22owner%22" + }, + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_1" + }, + "repositories":{ + "href":"https://api.bitbucket.org/2.0/repositories/atlassian_1" + }, + "snippets":{ + "href":"https://api.bitbucket.org/2.0/snippets/atlassian_1" + }, + "html":{ + "href":"https://bitbucket.org/atlassian_1/" + }, + "avatar":{ + "href":"https://bitbucket.org/workspaces/atlassian_1/avatar/?ts=1543645840" + }, + "members":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_1/members" + }, + "projects":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian_1/projects" + } + }, + "created_on":"2018-12-01T06:30:40.921862+00:00", + "type":"workspace", + "slug":"atlassian_1", + "is_private":false, + "name":"atlassian_1" + }, + { + "uuid":"{b5d5d71e-49d3-4917-9390-b88e25ecb2a6}", + "links":{ + "owners":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian/members?q=permission%3D%22owner%22" + }, + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian" + }, + "repositories":{ + "href":"https://api.bitbucket.org/2.0/repositories/atlassian" + }, + "snippets":{ + "href":"https://api.bitbucket.org/2.0/snippets/atlassian" + }, + "html":{ + "href":"https://bitbucket.org/atlassian/" + }, + "avatar":{ + "href":"https://bitbucket.org/workspaces/atlassian/avatar/?ts=1543668122" + }, + "members":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian/members" + }, + "projects":{ + "href":"https://api.bitbucket.org/2.0/workspaces/atlassian/projects" + } + }, + "created_on":"2018-12-01T12:42:02.071886+00:00", + "type":"workspace", + "slug":"atlassian", + "is_private":false, + "name":"atlassian" + }, + { + "uuid":"{5b98396b-d55e-44ae-8559-46b55559ebe2}", + "links":{ + "owners":{ + "href":"https://api.bitbucket.org/2.0/workspaces/bill_doe/members?q=permission%3D%22owner%22" + }, + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/bill_doe" + }, + "repositories":{ + "href":"https://api.bitbucket.org/2.0/repositories/bill_doe" + }, + "snippets":{ + "href":"https://api.bitbucket.org/2.0/snippets/bill_doe" + }, + "html":{ + "href":"https://bitbucket.org/bill_doe/" + }, + "avatar":{ + "href":"https://bitbucket.org/workspaces/bill_doe/avatar/?ts=1543675270" + }, + "members":{ + "href":"https://api.bitbucket.org/2.0/workspaces/bill_doe/members" + }, + "projects":{ + "href":"https://api.bitbucket.org/2.0/workspaces/bill_doe/projects" + } + }, + "created_on":"2018-12-01T14:41:10.784154+00:00", + "type":"workspace", + "slug":"bill_doe", + "is_private":false, + "name":"bill_doe" + } + ], + "page":1, + "size":4 +} \ No newline at end of file diff --git a/tests/stubs/workspaces-show-success.json b/tests/stubs/workspaces-show-success.json new file mode 100644 index 0000000..3723d19 --- /dev/null +++ b/tests/stubs/workspaces-show-success.json @@ -0,0 +1,34 @@ +{ + "uuid":"{eaf34f99-08d3-4888-ac79-b806e8927edd}", + "links":{ + "owners":{ + "href":"https://api.bitbucket.org/2.0/workspaces/john_doe/members?q=permission%3D%22owner%22" + }, + "self":{ + "href":"https://api.bitbucket.org/2.0/workspaces/john_doe" + }, + "repositories":{ + "href":"https://api.bitbucket.org/2.0/repositories/john_doe" + }, + "snippets":{ + "href":"https://api.bitbucket.org/2.0/snippets/john_doe" + }, + "html":{ + "href":"https://bitbucket.org/john_doe/" + }, + "avatar":{ + "href":"https://bitbucket.org/workspaces/john_doe/avatar/?ts=1571998380" + }, + "members":{ + "href":"https://api.bitbucket.org/2.0/workspaces/john_doe/members" + }, + "projects":{ + "href":"https://api.bitbucket.org/2.0/workspaces/john_doe/projects" + } + }, + "created_on":"2019-10-25T10:13:00.687887+00:00", + "type":"workspace", + "slug":"john_doe", + "is_private":false, + "name":"John Doe" +} \ No newline at end of file