How to use the cloudant._common_util.CloudFoundryService function in cloudant

To help you get started, we’ve selected a few cloudant examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cloudant / python-cloudant / tests / unit / cloud_foundry_tests.py View on Github external
def test_raise_error_for_missing_iam_api_key_and_credentials(self):
        with self.assertRaises(CloudantException) as cm:
            CloudFoundryService(
                self._test_legacy_vcap_services_multiple,
                instance_name='Cloudant NoSQL DB 7',
                service_name='cloudantNoSQLDB'
            )
        self.assertEqual(
            'Invalid service: IAM API key or username/password credentials are required.',
            str(cm.exception)
        )
github cloudant / python-cloudant / tests / unit / cloud_foundry_tests.py View on Github external
def test_get_vcap_service_default_success_as_dict(self):
        service = CloudFoundryService(
            json.loads(self._test_vcap_services_single_legacy_credentials_enabled),
            service_name='cloudantNoSQLDB'
        )
        self.assertEqual('Cloudant NoSQL DB 1', service.name)
github cloudant / python-cloudant / tests / unit / cloud_foundry_tests.py View on Github external
def test_raise_error_for_missing_username(self):
        with self.assertRaises(CloudantException) as cm:
            CloudFoundryService(
                self._test_legacy_vcap_services_multiple,
                instance_name='Cloudant NoSQL DB 5',
                service_name='cloudantNoSQLDB'
            )
        self.assertEqual(
            "Invalid service: 'username' missing",
            str(cm.exception)
        )
github cloudant / python-cloudant / tests / unit / cloud_foundry_tests.py View on Github external
def test_get_vcap_service_instance_username(self):
        service = CloudFoundryService(
            self._test_legacy_vcap_services_multiple,
            instance_name='Cloudant NoSQL DB 1',
            service_name='cloudantNoSQLDB'
        )
        self.assertEqual('example', service.username)
github cloudant / python-cloudant / tests / unit / cloud_foundry_tests.py View on Github external
def test_get_vcap_service_instance_password(self):
        service = CloudFoundryService(
            self._test_legacy_vcap_services_multiple,
            instance_name='Cloudant NoSQL DB 1',
            service_name='cloudantNoSQLDB'
        )
        self.assertEqual('pa$$w0rd01', service.password)
github cloudant / python-cloudant / tests / unit / cloud_foundry_tests.py View on Github external
def test_get_vcap_service_instance_host(self):
        service = CloudFoundryService(
            self._test_legacy_vcap_services_multiple,
            instance_name='Cloudant NoSQL DB 1',
            service_name='cloudantNoSQLDB'
        )
        self.assertEqual('example.cloudant.com', service.host)
github cloudant / python-cloudant / tests / unit / cloud_foundry_tests.py View on Github external
def test_raise_error_for_invalid_vcap(self):
        with self.assertRaises(CloudantException) as cm:
            CloudFoundryService('{', 'Cloudant NoSQL DB 1')  # invalid JSON
        self.assertEqual('Failed to decode VCAP_SERVICES JSON', str(cm.exception))
github cloudant / python-cloudant / tests / unit / cloud_foundry_tests.py View on Github external
def test_get_vcap_service_instance_iam_api_key(self):
        service = CloudFoundryService(
            self._test_legacy_vcap_services_multiple,
            instance_name='Cloudant NoSQL DB 8',
            service_name='cloudantNoSQLDB'
        )
        self.assertEqual('1234api', service.iam_api_key)
github cloudant / python-cloudant / tests / unit / cloud_foundry_tests.py View on Github external
def test_raise_error_for_missing_service(self):
        with self.assertRaises(CloudantException) as cm:
            CloudFoundryService(
                self._test_legacy_vcap_services_multiple,
                instance_name='Cloudant NoSQL DB 9',
                service_name='cloudantNoSQLDB'
            )
        self.assertEqual('Missing service in VCAP_SERVICES', str(cm.exception))
github cloudant / python-cloudant / tests / unit / cloud_foundry_tests.py View on Github external
def test_raise_error_for_invalid_credentials_type(self):
        with self.assertRaises(CloudantException) as cm:
            CloudFoundryService(
                self._test_legacy_vcap_services_multiple,
                instance_name='Cloudant NoSQL DB 6',
                service_name='cloudantNoSQLDB'
            )
        self.assertEqual(
            'Failed to decode VCAP_SERVICES service credentials',
            str(cm.exception)
        )