def test_parse_invalid_file(spec): """ Test schema get invalid schema """ with pytest.raises(hallmarkfe.SpecInvalidSpecification) as exc: handler = hallmarkfe.parse_generic(spec)
def load(self, path): """ Load a directory """ import hallmarkfe files = glob.glob(os.path.join(path, 'spec_*.json')) files += glob.glob(os.path.join(path, 'spec_*.yaml')) for f in files: try: obj = hallmarkfe.parse_generic(f) self.specs.append(obj) except: pass
def test_dump(): """ Test dump """ class TestSubclass(hallmarkfe.SpecBase): schema = "hello" hallmarkfe.register(TestSubclass) testdata = { 'schema': 'hello', 'name': 'kilo', 'description': "Test kilo", 'owner': '*****@*****.**' } handler = hallmarkfe.parse_generic(testdata) assert len(handler.dump()) > 0 assert len(handler.prettyprint()) > 0
handler = hallmarkfe.spec.schema_get('global:default:v1') assert handler == hallmarkfe.SpecBase @pytest.mark.parametrize('spec', [ None, "", {}, [], [{}], object , { 'ehllo' : 11}, [{ 'ehllo' : 11}], ]) def test_parse_invalid(spec): """ Test schema get invalid schema """ with pytest.raises(hallmarkfe.SpecInvalidSpecification) as exc: handler = hallmarkfe.parse_generic(spec) @pytest.mark.parametrize('spec', [os.path.join(thisdir,'fixtures/hello.html')]) def test_parse_invalid_file(spec): """ Test schema get invalid schema """ with pytest.raises(hallmarkfe.SpecInvalidSpecification) as exc: handler = hallmarkfe.parse_generic(spec) @pytest.mark.parametrize('testdata', [ os.path.join(thisdir,'fixtures/user.json'),