Ejemplo n.º 1
0
 def test_PYCBC_488(self):
     cluster = Cluster(
         'couchbases://10.142.175.101?certpath=/Users/daschl/tmp/ks/chain.pem&keypath=/Users/daschl/tmp/ks/pkey.key'
     )
     with self.assertRaises(MixedAuthError) as maerr:
         cluster.open_bucket("pixels",
                             password=self.cluster_info.bucket_password)
     exception = maerr.exception
     self.assertIsInstance(exception, MixedAuthError)
     self.assertRegex(exception.message, r'.*CertAuthenticator.*password.*')
Ejemplo n.º 2
0
 def _create_cluster_clean(self, authenticator):
     connargs = self.make_connargs()
     connstr = ConnectionString.parse(str(
         connargs.pop('connection_string')))
     connstr.clear_option('username')
     bucket = connstr.bucket
     connstr.bucket = None
     password = connargs.get('password', None)
     keys_to_skip = authenticator.get_credentials(bucket)['options'].keys()
     for entry in keys_to_skip:
         connstr.clear_option(entry)
     cluster = Cluster(connstr, bucket_class=self.factory)
     cluster.authenticate(ClassicAuthenticator(buckets={bucket: password}))
     return cluster, bucket
Ejemplo n.º 3
0
 def test_PYCBC_489(self):
     from couchbase_v2.cluster import Cluster
     with self.assertRaises(MixedAuthError) as maerr:
         cluster = Cluster(
             'couchbases://10.142.175.101?certpath=/Users/daschl/tmp/ks/chain.pem&keypath=/Users/daschl/tmp/ks/pkey.key'
         )
         cb = cluster.open_bucket('pixels', password='******')
         cb.upsert(
             'u:king_arthur', {
                 'name': 'Arthur',
                 'email': '*****@*****.**',
                 'interests': ['Holy Grail', 'African Swallows']
             })
     exception = maerr.exception
     self.assertIsInstance(exception, MixedAuthError)
     self.assertRegex(exception.message,
                      r'.*CertAuthenticator-style.*password.*')
Ejemplo n.º 4
0
    def _create_cluster(self):
        connargs = self.make_connargs()
        connstr = ConnectionString.parse(str(
            connargs.pop('connection_string')))
        connstr.clear_option('username')
        bucket = connstr.bucket
        connstr.bucket = None
        password = connargs.get('password', '')

        # Can I open a new bucket via open_bucket?
        cluster = Cluster(connstr, bucket_class=self.factory)
        cluster.authenticate(
            ClassicAuthenticator(
                buckets={bucket: password},
                cluster_password=self.cluster_info.admin_password,
                cluster_username=self.cluster_info.admin_username))
        return cluster, bucket