| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e8a3585 commit 29de40e
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,6 +24,10 @@ Create an environment for a project:: | |||
| 24 | 24 | ||
| 25 | 25 | environment = project.environments.create({'name': 'production'}) | |
| 26 | 26 | ||
| 27 | + Retrieve a specific environment for a project:: | ||
| 28 | + | ||
| 29 | + environment = project.environments.get(112) | ||
| 30 | + | ||
| 27 | 31 | Update an environment for a project:: | |
| 28 | 32 | ||
| 29 | 33 | environment.external_url = 'http://foo.bar.com' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -556,6 +556,36 @@ def resp_get_project(url, request): | |||
| 556 | 556 | self.assertEqual(data.name, "name") | |
| 557 | 557 | self.assertEqual(data.id, 1) | |
| 558 | 558 | ||
| 559 | + def test_project_environments(self): | ||
| 560 | + @urlmatch( | ||
| 561 | + scheme="http", netloc="localhost", path="/api/v4/projects/1$", method="get" | ||
| 562 | + ) | ||
| 563 | + def resp_get_project(url, request): | ||
| 564 | + headers = {"content-type": "application/json"} | ||
| 565 | + content = '{"name": "name", "id": 1}'.encode("utf-8") | ||
| 566 | + return response(200, content, headers, None, 5, request) | ||
| 567 | + | ||
| 568 | + @urlmatch( | ||
| 569 | + scheme="http", | ||
| 570 | + netloc="localhost", | ||
| 571 | + path="/api/v4/projects/1/environments/1", | ||
| 572 | + method="get", | ||
| 573 | + ) | ||
| 574 | + def resp_get_environment(url, request): | ||
| 575 | + headers = {"content-type": "application/json"} | ||
| 576 | + content = '{"name": "environment_name", "id": 1, "last_deployment": "sometime"}'.encode( | ||
| 577 | + "utf-8" | ||
| 578 | + ) | ||
| 579 | + return response(200, content, headers, None, 5, request) | ||
| 580 | + | ||
| 581 | + with HTTMock(resp_get_project, resp_get_environment): | ||
| 582 | + project = self.gl.projects.get(1) | ||
| 583 | + environment = project.environments.get(1) | ||
| 584 | + self.assertIsInstance(environment, ProjectEnvironment) | ||
| 585 | + self.assertEqual(environment.id, 1) | ||
| 586 | + self.assertEqual(environment.last_deployment, "sometime") | ||
| 587 | + self.assertEqual(environment.name, "environment_name") | ||
| 588 | + | ||
| 559 | 589 | def test_groups(self): | |
| 560 | 590 | @urlmatch( | |
| 561 | 591 | scheme="http", netloc="localhost", path="/api/v4/groups/1", method="get" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1944,7 +1944,7 @@ def stop(self, **kwargs): | |||
| 1944 | 1944 | ||
| 1945 | 1945 | ||
| 1946 | 1946 | class ProjectEnvironmentManager( | |
| 1947 | - ListMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTManager | ||
| 1947 | + RetrieveMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTManager | ||
| 1948 | 1948 | ): | |
| 1949 | 1949 | _path = "/projects/%(project_id)s/environments" | |
| 1950 | 1950 | _obj_cls = ProjectEnvironment | |
| Back | FazBrowse Home | New Git URL |
0 commit comments