Example #1
0
    def test_recursive_dicts(self):
        filepath = r'tests/configs/recursive_config.py'

        config = conf_from_file(filepath)
        assert config.config_dict.name == 'recursive'
        assert config.some_other_dict.answer == 42
        assert config.recursive_test.first.second.last == 3.14
Example #2
0
    def test_use_order_2(self):
        filepath = r'tests/configs/use_order_test_2.py'
        config = conf_from_file(filepath)

        assert config.config_dict['name'] == 'use module'
        assert config.config_type == 'file_supplement'
        assert config.some_other_dict.foo == 'bar'
Example #3
0
    def test_recursive_configdicts(self):
        filepath = r'tests/configs/recursive_w_configdict.py'

        config = conf_from_file(filepath)
        assert config.config_dict.name == 'recursive with configdict'
        assert config.some_other_dict.answer == 42
        assert config.recursive_test.first.second.last == 7.28
        assert config.onions.lots.oflayers == 'bam!'
Example #4
0
    def test_configuration_with_import(self):
        filepath = r'tests/configs/withimport.py'

        config = conf_from_file(filepath)
        assert config.config_dict['name'] == 'withimport'
        assert config.some_other_dict['foo'] == 'bar'
        assert config.an_extra_dict['so_long'] == 'Thanks for all the fish'
        assert config.an_extra_variable == 'another configuration'
Example #5
0
    def test_use_file_cascading(self):
        filepath = r'tests/configs/use_file_cascading.py'
        config = conf_from_file(filepath)

        assert config.config_dict['name'] == 'use level3'
        assert config.level1 == 'here'
        assert config.level2 == 'here'
        assert config.level3 == 'here'
Example #6
0
    def test_configdict_values(self):
        filepath = r'tests/configs/default.py'

        config = conf_from_file(filepath)
        assert config.config_dict['name'] == 'default'
        assert config['config_dict']['name'] == 'default'

        assert config['some_other_dict']['foo'] == 'bar'
        assert config.some_other_dict['answer'] == 42
Example #7
0
from configit import conf_from_file
config = conf_from_file('../development.py')

from BridgePython import Bridge
from lib import Wrap

bridge = Wrap(Bridge(api_key=config.public_api_key))
client = None

def service_response(resp):
    print(resp)

service = bridge.get_service('simple')
try:
    print 'trying 1'
    service.simple(simple='test 1', callback=service_response)
except TypeError as e:
    print(e)

try:
    print 'trying 2'
    service.simple('test 2', service_response)
except TypeError as e:
    print(e)

try:
    print 'trying 3'
    service.simple('test 3', callback=service_response)
except TypeError as e:
    print(e)
Example #8
0
    def test_file_path_added(self):
        filepath = r'tests/configs/default.py'

        config = conf_from_file(filepath)
        assert filepath in config.__config_file__,\
            'Configuration File path not added to config'
Example #9
0
    def test_no_file(self):
        filepath = r'tests/configs/does_not_exist.py'

        raises(IOError, lambda: conf_from_file(filepath))
Example #10
0
    def test_use_module(self):
        filepath = r'tests/configs/use_module.py'
        config = conf_from_file(filepath)

        assert config.config_dict['name'] == 'use module'
        assert config.config_type == 'module_supplement'
Example #11
0
    def test_use_module_as(self):
        filepath = r'tests/configs/use_module_as.py'

        config = conf_from_file(filepath)
        assert config.config_dict.name == 'use module with as'
        assert config.config_type == 'module_supplement'