コード例 #1
0
    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)
コード例 #2
0
    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', 'realm', 'consumer_secret', 'consumer_key']

        loaded_values = [
            ox.domain, ox.realm, ox.consumer_key, ox.consumer_secret
        ]

        test_values.sort()
        loaded_values.sort()
        self.assertEqual(loaded_values, test_values)
コード例 #3
0
    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)
コード例 #4
0
    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',
            'realm',
            'consumer_secret',
            'consumer_key']

        loaded_values = [
            ox.domain,
            ox.realm,
            ox.consumer_key,
            ox.consumer_secret]

        test_values.sort()
        loaded_values.sort()
        self.assertEqual(loaded_values, test_values)
コード例 #5
0
    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'
        ]

        loaded_values = [
            ox.domain, ox.consumer_key, ox.consumer_secret, ox.callback_url,
            ox.scheme, ox.request_token_url, ox.access_token_url,
            ox.authorization_url, ox.api_path, ox._email, ox._password
        ]

        test_values.sort()
        loaded_values.sort()

        self.assertEqual(loaded_values, test_values)
コード例 #6
0
    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',
            'realm',
            'consumer_secret',
            'consumer_key',
            'callback_url',
            'scheme',
            'request_token_url',
            'access_token_url',
            'authorization_url',
            'api_path',
            'email',
            'password']

        loaded_values = [
            ox.domain,
            ox.realm,
            ox.consumer_key,
            ox.consumer_secret,
            ox.callback_url,
            ox.scheme,
            ox.request_token_url,
            ox.access_token_url,
            ox.authorization_url,
            ox.api_path,
            ox._email,
            ox._password]

        test_values.sort()
        loaded_values.sort()

        self.assertEqual(loaded_values, test_values)
コード例 #7
0
import ox3apiclient
import logging
import requests
import json

ox = ox3apiclient.client_from_file().logon()

ox.logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
ox.logger.addHandler(ch)

report = ox.get('/report/fields')
コード例 #8
0
 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))
コード例 #9
0
 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))