Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_returns_client(self):
file_path = os.path.join(os.path.dirname(__file__), 'ox3rctest')
ox = ox3apiclient.client_from_file(file_path=file_path)
self.assertTrue(isinstance(ox, ox3apiclient.Client))
def test_loads_alternate_env(self):
file_path = os.path.join(os.path.dirname(__file__), 'ox3rctest')
ox = ox3apiclient.client_from_file(file_path=file_path, env='dev')
test_values = [
'domain_dev',
'consumer_secret_dev',
'consumer_key_dev']
loaded_values = [
ox.domain,
ox.consumer_key,
ox.consumer_secret]
test_values.sort()
loaded_values.sort()
self.assertEqual(loaded_values, test_values)
def test_missing_required_option_raises_error(self):
file_path = os.path.join(os.path.dirname(__file__), 'ox3rctest')
self.assertRaises(
Exception,
ox3apiclient.client_from_file,
file_path,
'missing-required-option')
def test_loads_default_env(self):
file_path = os.path.join(os.path.dirname(__file__), 'ox3rctest')
ox = ox3apiclient.client_from_file(file_path=file_path)
test_values = [
'domain',
'consumer_secret',
'consumer_key']
loaded_values = [
ox.domain,
ox.consumer_key,
ox.consumer_secret]
test_values.sort()
loaded_values.sort()
self.assertEqual(loaded_values, test_values)
def test_loads_optional_options(self):
file_path = os.path.join(os.path.dirname(__file__), 'ox3rctest')
ox = ox3apiclient.client_from_file(
file_path=file_path,
env='optional-options')
test_values = [
'domain',
'consumer_secret',
'consumer_key',
'callback_url',
'scheme',
'request_token_url',
'access_token_url',
'authorization_url',
'api_path',
'email',
'password']