diff --git a/satella/__init__.py b/satella/__init__.py index f1cd48c3ee63148d40fe7613f239b05dbd541bf2..4135d85552d6dd01c410aabe44ab4938c4d660f4 100644 --- a/satella/__init__.py +++ b/satella/__init__.py @@ -1 +1 @@ -__version__ = '2.15.1a1' +__version__ = '2.15.1' diff --git a/satella/configuration/schema/from_json.py b/satella/configuration/schema/from_json.py index 954bf7a5a64371da2efbe198e7f7f25cf079839b..fd61daeba79f319c46f2b7132f1f4e07cfc001f2 100644 --- a/satella/configuration/schema/from_json.py +++ b/satella/configuration/schema/from_json.py @@ -9,7 +9,7 @@ from .structs import create_key, Dict def _get_descriptor_for_str(key: str, value: str) -> Descriptor: try: - if value in ('int', 'float', 'str', 'ipv4', 'any', 'bool'): + if value in ('int', 'float', 'str', 'ipv4', 'any', 'bool', 'file'): return create_key(BASE_LOOKUP_TABLE[value](), key, False, None) except KeyError: diff --git a/tests/test_configuration/test_schema.py b/tests/test_configuration/test_schema.py index e1c17be0526ca76f5516891cce5c91559fa53f27..699da0551907e68d95c51a261aed3fc7e8ebbf75 100644 --- a/tests/test_configuration/test_schema.py +++ b/tests/test_configuration/test_schema.py @@ -14,6 +14,17 @@ class Environment(enum.IntEnum): class TestSchema(unittest.TestCase): + def test_file(self): + schema = { + "key": "file" + } + with open('test', 'wb') as f_out: + f_out.write(b'test') + + s = descriptor_from_dict(schema) + + self.assertEqual(s({'key': "test"}), {'key': 'test'}) + def test_caster(self): ps = Caster(Environment) self.assertEqual(ps(0), Environment.PRODUCTION)