diff --git a/formica/loader.py b/formica/loader.py index 0c2a1d5..fe93a58 100644 --- a/formica/loader.py +++ b/formica/loader.py @@ -54,9 +54,9 @@ def mandatory(a): def resource(name): if name is None: - return '' + return '' else: - return ''.join(e for e in name.title() if e.isalnum()) + return ''.join(e for e in name.title() if e.isalnum()) class Loader(object): diff --git a/tests/unit/test_loader.py b/tests/unit/test_loader.py index f885133..ef84d0e 100644 --- a/tests/unit/test_loader.py +++ b/tests/unit/test_loader.py @@ -243,7 +243,8 @@ def test_mandatory_filter_throws_exception_in_module(load, tmpdir): with open('test.template.json', 'w') as f: f.write('{"Modules": [{"path": "moduledir", "vars": {"test": {{ test }} }}]}') with pytest.raises(SystemExit): - load.load() + load.load() + def test_wrong_key_throws_exception(load, tmpdir): example = '{"SomeKey": "test"}'