def test_invalid_collections_arg(): f = io.StringIO(dedent(u''' [general] status_path = /tmp/status/ [pair foobar] a = foo b = bar collections = [null] [storage foo] type = filesystem path = /tmp/foo/ fileext = .txt [storage bar] type = filesystem path = /tmp/bar/ fileext = .txt ''')) with pytest.raises(cli.utils.CliError) as excinfo: _read_config(f) assert ( 'Section `pair foobar`: `collections` parameter must be a list of ' 'collection names (strings!) or `null`.' ) in str(excinfo.value)
def test_invalid_collections_arg(): f = io.StringIO( dedent(u''' [general] status_path = /tmp/status/ [pair foobar] a = foo b = bar collections = [null] [storage foo] type = filesystem path = /tmp/foo/ fileext = .txt [storage bar] type = filesystem path = /tmp/bar/ fileext = .txt ''')) with pytest.raises(exceptions.UserError) as excinfo: _read_config(f) assert 'Expected string' in str(excinfo.value)
def test_invalid_storage_name(): f = io.StringIO(dedent(u''' [general] status_path = {base}/status/ [storage foo.bar] ''')) with pytest.raises(cli.CliError) as excinfo: _read_config(f) assert 'invalid characters' in str(excinfo.value).lower()
def test_invalid_storage_name(): f = io.StringIO( dedent(u''' [general] status_path = {base}/status/ [storage foo.bar] ''')) with pytest.raises(exceptions.UserError) as excinfo: _read_config(f) assert 'invalid characters' in str(excinfo.value).lower()
def inner(cfg): f = io.StringIO(dedent(cfg.format(base=str(tmpdir)))) return _read_config(f)