def test_get_client(self): client = tvdbapi_client.get_client() self.assertIsInstance(client, api.TVDBClient) # validate client not configured self.assertRaises(exceptions.TVDBRequestException, client.authenticate)
def test_get_configured_client(self): client = tvdbapi_client.get_client( apikey='abc123xyz456', username='******', userpass='******', service_url='https://api-dev.thetvdb.com', verify_ssl_certs=True, select_first=False) self.assertIsInstance(client, api.TVDBClient) # validate auth is successful client.authenticate() self.assertIsNotNone(client._token_timer) cfgfile = self.create_tempfiles( [('tvdbapi_client', ''.join(self.cfg_data))])[0] self.addCleanup(shutil.rmtree, os.path.dirname(cfgfile), True) client = tvdbapi_client.get_client(config_file=cfgfile) self.assertIsInstance(client, api.TVDBClient)
def test_get_configured_client(self): client = tvdbapi_client.get_client( apikey='abc123xyz456', username='******', userpass='******', service_url='https://api-dev.thetvdb.com', verify_ssl_certs=True, select_first=False) self.assertIsInstance(client, api.TVDBClient) # validate auth is successful client.authenticate() self.assertIsNotNone(client._token_timer) cfgfile = self.create_tempfiles([('tvdbapi_client', ''.join(self.cfg_data))])[0] self.addCleanup(shutil.rmtree, os.path.dirname(cfgfile), True) client = tvdbapi_client.get_client(config_file=cfgfile) self.assertIsInstance(client, api.TVDBClient)
def test_get_configured_client(self): client = tvdbapi_client.get_client( apikey=os.environ.get('TEST_API_KEY'), username=os.environ.get('TEST_API_USER'), userpass=os.environ.get('TEST_API_PASSWORD'), service_url='https://api-dev.thetvdb.com', verify_ssl_certs=True, select_first=False) self.assertIsInstance(client, api.TVDBClient) # validate auth is successful client.authenticate() self.assertIsNotNone(client._token_timer)