def testGetFluidinfoClientWithVerboseFlag(self): """Debugging is enabled in C{httplib2} when the verbose flag is set.""" originalDebugLevel = httplib2.debuglevel try: options, args = parseOptions(['-u', 'user', '-p', 'secret', '-e', 'http://localhost:9000', '-v', 'path']) getFluidinfoClient(options) self.assertEqual(1, httplib2.debuglevel) finally: httplib2.debuglevel = originalDebugLevel
def testGetFluidinfoClientWithDefaultSettings(self): """The main instance is used by default.""" options, args = parseOptions(['-u', 'user', '-p', 'secret', 'path']) client = getFluidinfoClient(options) self.assertEqual('https://fluiddb.fluidinfo.com', client.instance) self.assertEqual('Basic dXNlcjpzZWNyZXQ=', client.global_headers['Authorization'])
def testGetFluidinfoClientWithCustomSettings(self): """ The API endpoint can be configured by passing a command-line argument. """ options, args = parseOptions(['-u', 'user', '-p', 'secret', '-e', 'http://localhost:9000', 'path']) client = getFluidinfoClient(options) self.assertEqual('http://localhost:9000', client.instance) self.assertEqual('Basic dXNlcjpzZWNyZXQ=', client.global_headers['Authorization'])