def test_0010_list_service(self): """Test the method APIExtension.list_extensions(). This test passes if the a list of dictionary of size >= 2 is returned by the method. And the dictionary contains information about the service registered during setup. """ api_extension = APIExtension(TestApiExtension._client) service_list = api_extension.list_extensions() self.assertTrue(len(service_list) >= 2) count_expected_services = 2 count_found_services = 0 for service in service_list: if service['name'] == TestApiExtension._service_name: if service['namespace'] == \ TestApiExtension._service1_namespace: self._check_service_details( service, TestApiExtension._service1_namespace) count_found_services += 1 if service['namespace'] == \ TestApiExtension._service2_namespace: self._check_service_details( service, TestApiExtension._service2_namespace) count_found_services += 1 self.assertEqual(count_found_services, count_expected_services)
def test_0010_list_service(self): """Test the method APIExtension.list_extensions(). This test passes if the a list of dictionary of size >= 2 is returned by the method. And the dictionary contains information about the service registered during setup. """ api_extension = APIExtension(TestApiExtension._client) service_list = api_extension.list_extensions() self.assertTrue(len(service_list) >= 2) count_expected_services = 2 count_found_services = 0 for service in service_list: if service['name'] == TestApiExtension._service_name: if service['namespace'] == \ TestApiExtension._service1_namespace: self._check_service_details( service, TestApiExtension._service1_namespace) count_found_services += 1 if service['namespace'] == \ TestApiExtension._service2_namespace: self._check_service_details( service, TestApiExtension._service2_namespace) count_found_services += 1 self.assertEqual(count_found_services, count_expected_services)
def list(ctx): try: restore_session(ctx) ext = APIExtension(ctx.obj['client']) stdout(ext.list_extensions(), ctx) except Exception as e: stderr(e, ctx)