예제 #1
0
def test_sx_adaptor_nothing():
    c = ConfigSettings('servicex', 'servicex')
    c.clear()
    x = ServiceXConfigAdaptor(c)

    with pytest.raises(ServiceXException):
        x.get_servicex_adaptor_config()
예제 #2
0
def test_returned_datatype_no_type_endpoint():
    c = ConfigSettings('servicex', 'servicex')
    c.clear()
    c['backend_types'] = [{'type': 'forkit', 'return_data': 'spoon'}]
    c['api_endpoints'] = [{'endpoint': 'http://localhost:5000'}]
    x = ServiceXConfigAdaptor(c)
    assert x.get_default_returned_datatype('forkit') == 'spoon'
예제 #3
0
def test_defalt_config_has_backend_types():
    c = ConfigSettings('servicex', 'servicex')
    assert c['backend_types'].exists()
    count = 0
    for info in c['backend_types']:
        count += 1
        assert info['type'].exists()
        assert info['return_data'].exists()
    assert count > 0
    def __init__(self, config: Optional[ConfigView] = None):
        '''The config needed for the app.

        Note: The config is held onto and only queired when the information is required.

        Args:
            config (ConfigView): The config information for the app. If null, then we just use the
                                 standard servicex name.
        '''
        self._settings = config if config is not None else ConfigSettings(
            'servicex', 'servicex')
예제 #5
0
def test_default_config_endpoint():
    c = ConfigSettings('servicex', 'servicex')
    c.clear()
    c._add_default_source()
    x = ServiceXConfigAdaptor(c)

    end_point, token = x.get_servicex_adaptor_config()
    assert end_point == 'http://localhost:5000'
    assert token is None
예제 #6
0
def test_defalt_config_has_default_return_datatype():
    'Test default settings - default_returned_datatype'
    c = ConfigSettings('servicex', 'servicex')
    assert c['default_return_data'].exists()
예제 #7
0
def test_returned_datatype_from_default_dict():
    c = ConfigSettings('servicex', 'servicex')
    c.clear()
    c['backend_types'] = [{'type': 'forkit', 'return_data': 'spoon'}]
    x = ServiceXConfigAdaptor(c)
    assert x.get_default_returned_datatype('forkit') == 'spoon'
예제 #8
0
def test_returned_datatype_default():
    c = ConfigSettings('servicex', 'servicex')
    c.clear()
    c['default_return_data'] = 'root'
    x = ServiceXConfigAdaptor(c)
    assert x.get_default_returned_datatype(None) == 'root'
예제 #9
0
def test_returned_datatype_nothing():
    c = ConfigSettings('servicex', 'servicex')
    c.clear()
    x = ServiceXConfigAdaptor(c)
    with pytest.raises(ServiceXException):
        x.get_default_returned_datatype(None)
예제 #10
0
def test_passed_in_settings():
    c = ConfigSettings('servicex', 'servicex')
    x = ServiceXConfigAdaptor(c)
    assert x.settings is c
def confuse_config():
    config = ConfigSettings('servicex_test_settings', "servicex")
    config.clear()
    config.read(user=False)
    return config