|
5 | 5 |
|
6 | 6 | import cloudfoundry_client.main.main as main |
7 | 7 | from abstract_test_case import AbstractTestCase |
| 8 | + |
| 9 | +from cloudfoundry_client.common_objects import Pagination |
8 | 10 | from cloudfoundry_client.v3.entities import Entity, ToOneRelationship |
9 | 11 |
|
10 | 12 |
|
@@ -144,6 +146,25 @@ def test_get_usage_summary(self): |
144 | 146 | self.client.v3.organizations.get_usage_summary("organization_id") |
145 | 147 | self.client.get.assert_called_with(self.client.get.return_value.url) |
146 | 148 |
|
| 149 | + def test_get_domains(self): |
| 150 | + self.client.get.return_value = self.mock_response( |
| 151 | + "/v3/organizations/organization_id/domains", |
| 152 | + HTTPStatus.OK, |
| 153 | + {"Content-Type": "application/json"}, |
| 154 | + "v3", |
| 155 | + "organizations", |
| 156 | + "GET_{id}_domains_response.json", |
| 157 | + ) |
| 158 | + organization_domains_response: Pagination[Entity] = self.client.v3.organizations.list_domains("organization_id") |
| 159 | + domains: list[dict] = [domain for domain in organization_domains_response] |
| 160 | + print(domains) |
| 161 | + self.assertIsInstance(domains, list) |
| 162 | + self.assertEqual(len(domains), 1) |
| 163 | + domain: dict = domains[0] |
| 164 | + self.assertIsInstance(domain, dict) |
| 165 | + self.assertEqual(domain.get("guid"), "3a5d3d89-3f89-4f05-8188-8a2b298c79d5") |
| 166 | + self.assertEqual(domain.get("name"), "test-domain.com") |
| 167 | + |
147 | 168 | @patch.object(sys, "argv", ["main", "list_organizations"]) |
148 | 169 | def test_main_list_organizations(self): |
149 | 170 | with patch("cloudfoundry_client.main.main.build_client_from_configuration", new=lambda: self.client): |
|
0 commit comments