def test_list(self):
     cpt = 0
     client = build_client_from_configuration()
     for plan in client.v2.service_plans.list():
         _logger.debug(plan.json())
         cpt += 1
     _logger.debug('test plan list - %d found', cpt)
 def test_recent(self):
     client = build_client_from_configuration()
     cpt = 0
     for log_message in client.loggregator.get_recent(client.log_app_guid):
         cpt += 1
         _logger.debug('read %s', str(log_message))
     _logger.debug('read %d', cpt)
 def test_list(self):
     cpt = 0
     client = build_client_from_configuration()
     for plan in client.service_plans.list():
         _logger.debug(plan.json())
         cpt += 1
     _logger.debug('test plan list - %d found', cpt)
 def test_list_instance_for_plan(self):
     client = build_client_from_configuration()
     for instance in client.v2.service_plans.list_instances(
             client.plan_guid, space_guid=client.space_guid):
         _logger.debug('test_list_instance_for_plan - %s -%s',
                       instance['metadata']['guid'],
                       instance['entity']['name'])
    def test_list(self):
        cpt = 0
        client = build_client_from_configuration()
        for application in client.v2.apps.list(space_guid=client.space_guid):
            _logger.debug('- %s' % application['entity']['name'])
            if cpt == 0:
                _logger.debug('- %s' % application['metadata']['guid'])
                self.assertIsNotNone(
                    client.v2.apps.get_first(
                        space_guid=client.space_guid,
                        name=application['entity']['name']))
                self.assertIsNotNone(
                    client.v2.apps.get(application['metadata']['guid']))
                try:
                    client.v2.apps.get('%s-0' %
                                       application['metadata']['guid'])
                    self.fail('Should not have been found')
                except InvalidStatusCode as e:
                    self.assertEquals(e.status_code, HTTPStatus.NOT_FOUND)
                try:
                    instances = client.v2.apps.get_instances(
                        application['metadata']['guid'])
                    self.assertIsNotNone(instances)
                    self.assertEquals(len(instances),
                                      application['entity']['instances'])
                    _logger.debug('instances = %s', json.dumps(instances))
                except InvalidStatusCode as e:
                    #instance is stopped
                    self.assertEquals(e.status_code, HTTPStatus.BAD_REQUEST)
                    self.assertIsInstance(e.body, dict)
                    self.assertEqual(e.body.get('error_code'),
                                     'CF-InstancesError')
                try:
                    stats = client.v2.apps.get_stats(
                        application['metadata']['guid'])
                    self.assertIsNotNone(stats)
                    self.assertEquals(len(stats),
                                      application['entity']['instances'])
                    self.assertEquals(len(stats),
                                      application['entity']['instances'])
                    _logger.debug('stats = %s', json.dumps(stats))
                except InvalidStatusCode as e:
                    # instance is stopped
                    self.assertEquals(e.status_code, HTTPStatus.BAD_REQUEST)
                    self.assertIsInstance(e.body, dict)
                    self.assertEqual(e.body.get('error_code'),
                                     'CF-AppStoppedStatsError')
                env = client.v2.apps.get_env(application['metadata']['guid'])
                self.assertIsNotNone(env)
                self.assertIsNotNone(env.get('application_env_json', None))
                self.assertIsNotNone(env['application_env_json'].get(
                    'VCAP_APPLICATION', None))
                self.assertGreater(
                    len(env['application_env_json']['VCAP_APPLICATION'].get(
                        'application_uris', [])), 0)
                _logger.debug('env = %s', json.dumps(env))
            cpt += 1

        _logger.debug('test applications list - %d found', cpt)
Example #6
0
    def test_list(self):
        cpt = 0
        client = build_client_from_configuration()
        for application in client.v2.apps.list(space_guid=client.space_guid):
            _logger.debug("- %s" % application["entity"]["name"])
            if cpt == 0:
                _logger.debug("- %s" % application["metadata"]["guid"])
                self.assertIsNotNone(
                    client.v2.apps.get_first(
                        space_guid=client.space_guid,
                        name=application["entity"]["name"]))
                self.assertIsNotNone(
                    client.v2.apps.get(application["metadata"]["guid"]))
                try:
                    client.v2.apps.get("%s-0" %
                                       application["metadata"]["guid"])
                    self.fail("Should not have been found")
                except InvalidStatusCode as e:
                    self.assertEquals(e.status_code, HTTPStatus.NOT_FOUND)
                try:
                    instances = client.v2.apps.get_instances(
                        application["metadata"]["guid"])
                    self.assertIsNotNone(instances)
                    self.assertEquals(len(instances),
                                      application["entity"]["instances"])
                    _logger.debug("instances = %s", json.dumps(instances))
                except InvalidStatusCode as e:
                    # instance is stopped
                    self.assertEquals(e.status_code, HTTPStatus.BAD_REQUEST)
                    self.assertIsInstance(e.body, dict)
                    self.assertEqual(e.body.get("error_code"),
                                     "CF-InstancesError")
                try:
                    stats = client.v2.apps.get_stats(
                        application["metadata"]["guid"])
                    self.assertIsNotNone(stats)
                    self.assertEquals(len(stats),
                                      application["entity"]["instances"])
                    self.assertEquals(len(stats),
                                      application["entity"]["instances"])
                    _logger.debug("stats = %s", json.dumps(stats))
                except InvalidStatusCode as e:
                    # instance is stopped
                    self.assertEquals(e.status_code, HTTPStatus.BAD_REQUEST)
                    self.assertIsInstance(e.body, dict)
                    self.assertEqual(e.body.get("error_code"),
                                     "CF-AppStoppedStatsError")
                env = client.v2.apps.get_env(application["metadata"]["guid"])
                self.assertIsNotNone(env)
                self.assertIsNotNone(env.get("application_env_json"))
                self.assertIsNotNone(
                    env["application_env_json"].get("VCAP_APPLICATION"))
                self.assertGreater(
                    len(env["application_env_json"]["VCAP_APPLICATION"].get(
                        "application_uris", [])), 0)
                _logger.debug("env = %s", json.dumps(env))
            cpt += 1

        _logger.debug("test applications list - %d found", cpt)
Example #7
0
 def test_list_by_broker(self):
     cpt = 0
     client = build_client_from_configuration()
     for plan in client.v2.service_plans.list(service_broker_guid=client.service_guid):
         if cpt == 0:
             _logger.debug(plan.json())
         cpt += 1
     _logger.debug("test plan list - %d found", cpt)
 def test_list_by_broker(self):
     cpt = 0
     client = build_client_from_configuration()
     for plan in client.service_plans.list(service_broker_guid=client.service_guid):
         if cpt == 0:
             _logger.debug(plan.json())
         cpt += 1
     _logger.debug('test plan list - %d found', cpt)
Example #9
0
 def test_list_instance_for_plan(self):
     client = build_client_from_configuration()
     for instance in client.v3.service_plans.list(
             service_offering_guids=client.plan_guid,
             space_guids=client.space_guid):
         _logger.debug("test_list_instance_for_plan - %s -%s",
                       instance["metadata"]["guid"],
                       instance["entity"]["name"])
Example #10
0
 def test_create_update_delete(self):
     client = build_client_from_configuration()
     result = client.v2.service_instances.create(client.space_guid, 'test_name', client.plan_guid,
                                              client.creation_parameters)
     if len(client.update_parameters) > 0:
         client.v2.service_instances.update(result['metadata']['guid'], client.update_parameters)
     else:
         _logger.warning('update test skipped')
     client.v2.service_instances.remove(result['metadata']['guid'])
 def test_create_update_delete(self):
     client = build_client_from_configuration()
     result = client.service_instances.create(client.space_guid, 'test_name', client.plan_guid,
                                              client.creation_parameters)
     if len(client.update_parameters) > 0:
         client.service_instances.update(result['metadata']['guid'], client.update_parameters)
     else:
         _logger.warning('update test skipped')
     client.service_instances.remove(result['metadata']['guid'])
 def test_list(self):
     cpt = 0
     client = build_client_from_configuration()
     for broker in client.v3.service_brokers.list():
         if cpt == 0:
             self.assertIsNotNone(
                 client.v3.service_brokers.get(broker["guid"]))
         cpt += 1
         _logger.debug(broker)
     _logger.debug("test broker list - %d found", cpt)
Example #13
0
    def test_list_services(self):
        cpt = 0
        client = build_client_from_configuration()
        for service in client.v2.services.list():
            _logger.debug('- %s' % service['entity']['label'])
            if cpt == 0:
                service = client.v2.services.get_first(label=service['entity']['label'])
                self.assertIsNotNone(service)
            cpt += 1

        _logger.debug('test service list - %d found', cpt)
    def test_list_services(self):
        cpt = 0
        client = build_client_from_configuration()
        for service in client.services.list():
            _logger.debug('- %s' % service['entity']['label'])
            if cpt == 0:
                service = client.services.get_first(label=service['entity']['label'])
                self.assertIsNotNone(service)
            cpt += 1

        _logger.debug('test service list - %d found', cpt)
 def test_get(self):
     client = build_client_from_configuration()
     cpt = 0
     for service_key in client.service_keys.list():
         if cpt == 0:
             self.assertIsNotNone(
                 client.service_keys.get_first(service_instance_guid=service_key['entity']['service_instance_guid']))
             self.assertIsNotNone(
                 client.service_keys.get(service_key['metadata']['guid']))
         cpt += 1
     _logger.debug('test_get - %d found', cpt)
Example #16
0
 def test_get(self):
     client = build_client_from_configuration()
     cpt = 0
     for service_key in client.v2.service_keys.list():
         if cpt == 0:
             self.assertIsNotNone(
                 client.v2.service_keys.get_first(service_instance_guid=service_key["entity"]["service_instance_guid"])
             )
             self.assertIsNotNone(client.v2.service_keys.get(service_key["metadata"]["guid"]))
         cpt += 1
     _logger.debug("test_get - %d found", cpt)
Example #17
0
 def test_create_delete(self):
     client = build_client_from_configuration()
     result = client.v3.service_instances.create(
         space_guid=client.space_guid,
         name="test_name",
         service_plan_guid=client.plan_guid,
         parameters=client.creation_parameters,
     )
     client.v3.jobs.wait_for_job_completion(result.job()["guid"])
     service_instance_guid = client.v3.service_instances.get_first(
         names="test_name")["guid"]
     client.v3.service_instances.remove(service_instance_guid)
Example #18
0
    def test_list_services(self):
        cpt = 0
        client = build_client_from_configuration()
        for service in client.v2.services.list():
            _logger.debug("- %s" % service["entity"]["label"])
            if cpt == 0:
                service = client.v2.services.get_first(
                    label=service["entity"]["label"])
                self.assertIsNotNone(service)
            cpt += 1

        _logger.debug("test service list - %d found", cpt)
Example #19
0
 def test_list(self):
     cpt = 0
     client = build_client_from_configuration()
     for broker in client.v2.service_brokers.list():
         if cpt == 0:
             self.assertIsNotNone(
                 client.v2.service_brokers.get_first(space_guid=broker['entity']['space_guid']))
             self.assertIsNotNone(
                 client.v2.service_brokers.get(broker['metadata']['guid']))
         cpt += 1
         _logger.debug(broker)
     _logger.debug('test broker list - %d found', cpt)
 def test_list(self):
     cpt = 0
     client = build_client_from_configuration()
     for broker in client.service_brokers.list():
         if cpt == 0:
             self.assertIsNotNone(
                 client.service_brokers.get_first(space_guid=broker['entity']['space_guid']))
             self.assertIsNotNone(
                 client.service_brokers.get(broker['metadata']['guid']))
         cpt += 1
         _logger.debug(broker)
     _logger.debug('test broker list - %d found', cpt)
 def test_list(self):
     cpt = 0
     client = build_client_from_configuration()
     for space in client.spaces.list(organization_guid=client.org_guid):
         _logger.debug(" - %s" % space["entity"]["name"])
         if cpt == 0:
             space = client.spaces.get(space["metadata"]["guid"])
             self.assertIsNotNone(space)
             space = client.spaces.get_first(organization_guid=client.org_guid, name=space["entity"]["name"])
             self.assertIsNotNone(space)
         cpt += 1
     _logger.debug("test spaces list - %d found", cpt)
 def test_list(self):
     cpt = 0
     client = build_client_from_configuration()
     for organization in client.organizations.list():
         if cpt == 0:
             organization = client.organizations.get(organization['metadata']['guid'])
             self.assertIsNotNone(organization)
             organization = client.organizations.get_first(name=organization['entity']['name'])
             self.assertIsNotNone(organization)
             _logger.debug(organization.json())
         cpt += 1
     _logger.debug('test organization list - %d found', cpt)
 def test_create_update_delete(self):
     client = build_client_from_configuration()
     result = client.v2.service_instances.create(client.space_guid,
                                                 "test_name",
                                                 client.plan_guid,
                                                 client.creation_parameters)
     if len(client.update_parameters) > 0:
         client.v2.service_instances.update(result["metadata"]["guid"],
                                            client.update_parameters)
     else:
         _logger.warning("update test skipped")
     client.v2.service_instances.remove(result["metadata"]["guid"])
Example #24
0
 def test_get(self):
     client = build_client_from_configuration()
     cpt = 0
     for instance in client.v3.service_instances.list():
         if cpt == 0:
             self.assertIsNotNone(
                 client.v3.service_instances.get_first(
                     space_guids=instance["relationships"]["space"]["data"]
                     ["guid"]))
             self.assertIsNotNone(
                 client.v3.service_instances.get(instance["guid"]))
         cpt += 1
     _logger.debug("test_get - %d found", cpt)
Example #25
0
 def test_get(self):
     client = build_client_from_configuration()
     cpt = 0
     for instance in client.v2.service_instances.list():
         if cpt == 0:
             self.assertIsNotNone(
                 client.v2.service_instances.get_first(space_guid=instance['entity']['space_guid']))
             self.assertIsNotNone(
                 client.v2.service_instances.get(instance['metadata']['guid']))
             self.assertIsNotNone(
                 client.v2.service_instances.list_permissions(instance['metadata']['guid']))
         cpt += 1
     _logger.debug('test_get - %d found', cpt)
Example #26
0
 def test_list(self):
     cpt = 0
     client = build_client_from_configuration()
     for space in client.v2.spaces.list(organization_guid=client.org_guid):
         _logger.debug(" - %s" % space["entity"]["name"])
         if cpt == 0:
             space = client.v2.spaces.get(space["metadata"]["guid"])
             self.assertIsNotNone(space)
             space = client.v2.spaces.get_first(
                 organization_guid=client.org_guid,
                 name=space["entity"]["name"])
             self.assertIsNotNone(space)
         cpt += 1
     _logger.debug("test spaces list - %d found", cpt)
Example #27
0
 def test_list(self):
     cpt = 0
     client = build_client_from_configuration()
     for organization in client.v2.organizations.list():
         if cpt == 0:
             organization = client.v2.organizations.get(
                 organization["metadata"]["guid"])
             self.assertIsNotNone(organization)
             organization = client.v2.organizations.get_first(
                 name=organization["entity"]["name"])
             self.assertIsNotNone(organization)
             _logger.debug(organization.json())
         cpt += 1
     _logger.debug("test organization list - %d found", cpt)
Example #28
0
 def test_list(self):
     cpt = 0
     client = build_client_from_configuration()
     for space in client.v2.spaces.list(organization_guid=client.org_guid):
         _logger.debug(' - %s' % space['entity']['name'])
         if cpt == 0:
             space = client.v2.spaces.get(space['metadata']['guid'])
             self.assertIsNotNone(space)
             space = client.v2.spaces.get_first(
                 organization_guid=client.org_guid,
                 name=space['entity']['name'])
             self.assertIsNotNone(space)
         cpt += 1
     _logger.debug('test spaces list - %d found', cpt)
 def test_all(self):
     client = build_client_from_configuration()
     for organization in client.organizations:
         if organization['metadata']['guid'] == client.org_guid:
             for space in organization.spaces():
                 if space['metadata']['guid'] == client.space_guid:
                     organization_reloaded = space.organization()
                     self.assertEqual(organization['metadata']['guid'], organization_reloaded['metadata']['guid'])
                     for application in space.apps():
                         if application['metadata']['guid'] == client.app_guid:
                             space_reloaded = application.space()
                             self.assertEqual(space['metadata']['guid'], space_reloaded['metadata']['guid'])
                             application.start()
                             application.stats()
                             application.instances()
                             application.summary()
                             for _ in application.routes():
                                 break
                             for _ in application.service_bindings():
                                 break
                             for _ in application.events():
                                 break
                             application.stop()
                     for service_instance in space.service_instances():
                         space_reloaded = service_instance.space()
                         self.assertEqual(space['metadata']['guid'], space_reloaded['metadata']['guid'])
                         for service_binding in service_instance.service_bindings():
                             service_instance_reloaded = service_binding.service_instance()
                             self.assertEqual(service_instance['metadata']['guid'],
                                              service_instance_reloaded['metadata']['guid'])
                             service_binding.app()
                             break
                         for route in service_instance.routes():
                             service_instance_reloaded = route.service_instance()
                             self.assertEqual(service_instance['metadata']['guid'],
                                              service_instance_reloaded['metadata']['guid'])
                             for _ in route.apps():
                                 break
                             space_reloaded = route.space()
                             self.assertEqual(space['metadata']['guid'], space_reloaded['metadata']['guid'])
                             break
                         service_plan = service_instance.service_plan()
                         for _ in service_plan.service_instances():
                             break
                         service = service_plan.service()
                         for _ in service.service_plans():
                             break
                         break
 def test_all(self):
     client = build_client_from_configuration()
     for organization in client.v2.organizations:
         if organization['metadata']['guid'] == client.org_guid:
             for space in organization.spaces():
                 if space['metadata']['guid'] == client.space_guid:
                     organization_reloaded = space.organization()
                     self.assertEqual(organization['metadata']['guid'], organization_reloaded['metadata']['guid'])
                     for application in space.apps():
                         if application['metadata']['guid'] == client.app_guid:
                             space_reloaded = application.space()
                             self.assertEqual(space['metadata']['guid'], space_reloaded['metadata']['guid'])
                             application.start()
                             application.stats()
                             application.instances()
                             application.summary()
                             for _ in application.routes():
                                 break
                             for _ in application.service_bindings():
                                 break
                             for _ in application.events():
                                 break
                             application.stop()
                     for service_instance in space.service_instances():
                         space_reloaded = service_instance.space()
                         self.assertEqual(space['metadata']['guid'], space_reloaded['metadata']['guid'])
                         for service_binding in service_instance.service_bindings():
                             service_instance_reloaded = service_binding.service_instance()
                             self.assertEqual(service_instance['metadata']['guid'],
                                              service_instance_reloaded['metadata']['guid'])
                             service_binding.app()
                             break
                         for route in service_instance.routes():
                             service_instance_reloaded = route.service_instance()
                             self.assertEqual(service_instance['metadata']['guid'],
                                              service_instance_reloaded['metadata']['guid'])
                             for _ in route.apps():
                                 break
                             space_reloaded = route.space()
                             self.assertEqual(space['metadata']['guid'], space_reloaded['metadata']['guid'])
                             break
                         service_plan = service_instance.service_plan()
                         for _ in service_plan.service_instances():
                             break
                         service = service_plan.service()
                         for _ in service.service_plans():
                             break
                         break
 def test_create_bind_unbind_delete(self):
     client = build_client_from_configuration()
     try:
         instance = client.service_instances.create(client.space_guid, 'test_name', client.plan_guid,
                                                   client.creation_parameters)
     except:
         return
     try:
         binding = client.service_bindings.create(client.app_guid, instance['metadata']['guid'])
         _logger.debug(binding.json())
         client.service_bindings.remove(binding['metadata']['guid'])
         _logger.debug("binding deleted")
     finally:
         try:
             client.service_instances.remove(instance['metadata']['guid'])
         except:
             pass
 def test_create_delete(self):
     client = build_client_from_configuration()
     try:
         instance = client.service_instances.create(client.space_guid, 'test_name', client.plan_guid,
                                                    client.creation_parameters)
     except:
         return
     try:
         service_key = client.service_keys.create(instance['metadata']['guid'], 'test_key_name')
         _logger.debug(service_key.json())
         client.service_keys.remove(service_key['metadata']['guid'])
         _logger.debug("service key deleted")
     finally:
         try:
             client.service_instances.remove(instance['metadata']['guid'])
         except:
             pass
    def test_list(self):
        cpt = 0
        client = build_client_from_configuration()
        for application in client.apps.list(space_guid=client.space_guid):
            _logger.debug('- %s' % application['entity']['name'])
            if cpt == 0:
                _logger.debug('- %s' % application['metadata']['guid'])
                self.assertIsNotNone(client.apps.get_first(space_guid=client.space_guid,
                                                                  name=application['entity']['name']))
                self.assertIsNotNone(client.apps.get(application['metadata']['guid']))
                try:
                    client.apps.get('%s-0' % application['metadata']['guid'])
                    self.fail('Should not have been found')
                except InvalidStatusCode as e:
                    self.assertEquals(e.status_code, NOT_FOUND)
                try:
                    instances = client.apps.get_instances(application['metadata']['guid'])
                    self.assertIsNotNone(instances)
                    self.assertEquals(len(instances), application['entity']['instances'])
                    _logger.debug('instances = %s', json.dumps(instances))
                except InvalidStatusCode as e:
                    #instance is stopped
                    self.assertEquals(e.status_code, BAD_REQUEST)
                    self.assertIsInstance(e.body, dict)
                    self.assertEqual(e.body.get('error_code'), 'CF-InstancesError')
                try:
                    stats = client.apps.get_stats(application['metadata']['guid'])
                    self.assertIsNotNone(stats)
                    self.assertEquals(len(stats), application['entity']['instances'])
                    self.assertEquals(len(stats), application['entity']['instances'])
                    _logger.debug('stats = %s', json.dumps(stats))
                except InvalidStatusCode as e:
                    # instance is stopped
                    self.assertEquals(e.status_code, BAD_REQUEST)
                    self.assertIsInstance(e.body, dict)
                    self.assertEqual(e.body.get('error_code'), 'CF-AppStoppedStatsError')
                env = client.apps.get_env(application['metadata']['guid'])
                self.assertIsNotNone(env)
                self.assertIsNotNone(env.get('application_env_json', None))
                self.assertIsNotNone(env['application_env_json'].get('VCAP_APPLICATION', None))
                self.assertGreater(len(env['application_env_json']['VCAP_APPLICATION'].get('application_uris', [])), 0)
                _logger.debug('env = %s', json.dumps(env))
            cpt += 1

        _logger.debug('test applications list - %d found', cpt)
 def test_create_bind_unbind_delete(self):
     client = build_client_from_configuration()
     try:
         instance = client.v2.service_instances.create(
             client.space_guid, "test_name", client.plan_guid, client.creation_parameters
         )
     except:  # noqa: E722
         return
     try:
         binding = client.v2.service_bindings.create(client.app_guid, instance["metadata"]["guid"])
         _logger.debug(binding.json())
         client.v2.service_bindings.remove(binding["metadata"]["guid"])
         _logger.debug("binding deleted")
     finally:
         try:
             client.v2.service_instances.remove(instance["metadata"]["guid"])
         except:  # noqa: E722
             pass
Example #35
0
 def test_create_delete(self):
     client = build_client_from_configuration()
     try:
         instance = client.v2.service_instances.create(
             client.space_guid, "test_name", client.plan_guid, client.creation_parameters
         )
     except:  # noqa: E722
         return
     try:
         service_key = client.v2.service_keys.create(instance["metadata"]["guid"], "test_key_name")
         _logger.debug(service_key.json())
         client.v2.service_keys.remove(service_key["metadata"]["guid"])
         _logger.debug("service key deleted")
     finally:
         try:
             client.v2.service_instances.remove(instance["metadata"]["guid"])
         except:  # noqa: E722
             pass
Example #36
0
 def test_get(self):
     client = build_client_from_configuration()
     cpt = 0
     for binding in client.v2.service_bindings.list():
         if cpt == 0:
             _logger.debug(binding)
             self.assertIsNotNone(
                 client.v2.service_bindings.get_first(
                     service_instance_guid=binding['entity']
                     ['service_instance_guid']))
             self.assertIsNotNone(
                 client.v2.service_bindings.get_first(
                     app_guid=binding['entity']['app_guid']))
             self.assertIsNotNone(
                 client.v2.service_bindings.get(
                     binding['metadata']['guid']))
         cpt += 1
     _logger.debug('test_get - %d found', cpt)
 def test_list(self):
     cpt = 0
     client = build_client_from_configuration()
     for application in client.apps.list(space_guid=client.space_guid):
         _logger.debug('- %s' % application['entity']['name'])
         if cpt == 0:
             _logger.debug('- %s' % application['metadata']['guid'])
             self.assertIsNotNone(client.apps.get_first(space_guid=client.space_guid,
                                                               name=application['entity']['name']))
             self.assertIsNotNone(client.apps.get(application['metadata']['guid']))
             try:
                 client.apps.get('%s-0' % application['metadata']['guid'])
                 self.fail('Should not have been found')
             except InvalidStatusCode, e:
                 self.assertEquals(e.status_code, httplib.NOT_FOUND)
             try:
                 instances = client.apps.get_instances(application['metadata']['guid'])
                 self.assertIsNotNone(instances)
                 self.assertEquals(len(instances), application['entity']['instances'])
                 _logger.debug('instances = %s', json.dumps(instances))
             except InvalidStatusCode, e:
                 #instance is stopped
                 self.assertEquals(e.status_code, httplib.BAD_REQUEST)
                 self.assertIsInstance(e.body, dict)
                 self.assertEqual(e.body.get('error_code'), 'CF-InstancesError')
             try:
                 stats = client.apps.get_stats(application['metadata']['guid'])
                 self.assertIsNotNone(stats)
                 self.assertEquals(len(stats), application['entity']['instances'])
                 self.assertEquals(len(stats), application['entity']['instances'])
                 _logger.debug('stats = %s', json.dumps(stats))
             except InvalidStatusCode, e:
                 # instance is stopped
                 self.assertEquals(e.status_code, httplib.BAD_REQUEST)
                 self.assertIsInstance(e.body, dict)
                 self.assertEqual(e.body.get('error_code'), 'CF-AppStoppedStatsError')
 def test_list(self):
     client = build_client_from_configuration()
     for buildpack in client.buildpacks.list():
         _logger.debug(' %s' % buildpack.json())
 def test_list_instance_for_plan(self):
     client = build_client_from_configuration()
     for instance in client.service_plans.list_instances(client.plan_guid, space_guid=client.space_guid):
         _logger.debug('test_list_instance_for_plan - %s -%s', instance['metadata']['guid'],
                       instance['entity']['name'])
 def test_list(self):
     client = build_client_from_configuration()
     for route in client.routes.list():
         _logger.debug(' %s' % route.json())
Example #41
0
 def test_stop(self):
     client = build_client_from_configuration()
     _logger.debug("stop - %s",
                   client.v2.apps.stop(client.app_guid, asynchronous=False))
Example #42
0
 def test_list(self):
     client = build_client_from_configuration()
     for route in client.v2.routes.list():
         _logger.debug(" %s" % route.json())
 def test_stop(self):
     client = build_client_from_configuration()
     _logger.debug('stop - %s', client.apps.stop(client.app_guid, async=False))