Example #1
0
def test_ZirkonSerializer_from_file(simple_config_content, serializer,
                                    tmp_text_file):
    tmp_text_file.write(SIMPLE_CONFIG_ZIRKON_SERIALIZATION)
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    obj = serializer.from_file(filename=tmp_text_file.name)
    assert obj == simple_config_content
Example #2
0
def test_Config_from_file_configobj(simple_config, tmp_text_file):
    tmp_text_file.write(SIMPLE_CONFIG_CONFIGOBJ_SERIALIZATION)
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    config = Config.from_file(filename=tmp_text_file.name,
                              protocol="configobj")
    assert config == simple_config
Example #3
0
def test_ZirkonSerializer_to_file(simple_config_content, serializer,
                                  tmp_text_file):
    serializer.to_file(obj=simple_config_content, filename=tmp_text_file.name)
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    serialization = tmp_text_file.read()
    assert serialization == SIMPLE_CONFIG_ZIRKON_SERIALIZATION
def test_ZirkonSerializer_from_file(simple_config_content, serializer, tmp_text_file):
    tmp_text_file.write(SIMPLE_CONFIG_ZIRKON_SERIALIZATION)
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    obj = serializer.from_file(filename=tmp_text_file.name)
    assert obj == simple_config_content
def test_ZirkonSerializer_to_from_file(simple_config_content, serializer, tmp_text_file):
    serializer.to_file(obj=simple_config_content, filename=tmp_text_file.name)
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    obj = serializer.from_file(filename=tmp_text_file.name)
    assert compare_dicts(obj, simple_config_content)
Example #6
0
def test_Config_to_file_configobj(simple_config, tmp_text_file):
    simple_config.to_file(filename=tmp_text_file.name, protocol="configobj")
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    serialization = tmp_text_file.read()
    assert serialization == SIMPLE_CONFIG_CONFIGOBJ_SERIALIZATION
Example #7
0
def test_Schema_to_file_configobj(simple_schema, tmp_text_file):
    simple_schema.to_file(filename=tmp_text_file.name, fmt="configobj")
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    serialization = tmp_text_file.read()
    assert serialization == SIMPLE_SCHEMA_CONFIGOBJ_SERIALIZATION
Example #8
0
def test_Schema_to_file_json(simple_schema, tmp_text_file):
    simple_schema.to_file(filename=tmp_text_file.name, fmt="json")
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    serialization = tmp_text_file.read()
    assert serialization == SIMPLE_SCHEMA_JSON_SERIALIZATION
Example #9
0
def test_Schema_to_file_zirkon(simple_schema, tmp_text_file):
    simple_schema.to_file(filename=tmp_text_file.name, protocol="zirkon")
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    serialization = tmp_text_file.read()
    assert serialization == SIMPLE_SCHEMA_ZIRKON_SERIALIZATION
Example #10
0
def test_Schema_from_file_configobj(simple_schema, tmp_text_file):
    tmp_text_file.write(SIMPLE_SCHEMA_CONFIGOBJ_SERIALIZATION)
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    schema = Schema.from_file(filename=tmp_text_file.name, protocol="configobj")
    assert schema == simple_schema
Example #11
0
def test_Schema_to_file_configobj(simple_schema, tmp_text_file):
    simple_schema.to_file(filename=tmp_text_file.name, protocol="configobj")
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    serialization = tmp_text_file.read()
    assert serialization == SIMPLE_SCHEMA_CONFIGOBJ_SERIALIZATION
Example #12
0
def test_Schema_from_file_json(simple_schema, tmp_text_file):
    tmp_text_file.write(SIMPLE_SCHEMA_JSON_SERIALIZATION)
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    schema = Schema.from_file(filename=tmp_text_file.name, protocol="json")
    assert schema == simple_schema
Example #13
0
def test_Config_from_file_json(simple_config, tmp_text_file):
    tmp_text_file.write(SIMPLE_CONFIG_JSON_SERIALIZATION)
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    config = Config.from_file(filename=tmp_text_file.name, fmt="json")
    assert config == simple_config
Example #14
0
def test_Config_to_file_json(simple_config, tmp_text_file):
    simple_config.to_file(filename=tmp_text_file.name, fmt="json")
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    serialization = tmp_text_file.read()
    assert serialization == SIMPLE_CONFIG_JSON_SERIALIZATION
Example #15
0
def test_Config_from_file_configobj(simple_config, tmp_text_file):
    tmp_text_file.write(SIMPLE_CONFIG_CONFIGOBJ_SERIALIZATION)
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    config = Config.from_file(filename=tmp_text_file.name, protocol="configobj")
    assert config == simple_config
def test_ConfigObjSerializer_to_file(simple_config_content, serializer, tmp_text_file):
    serializer.to_file(obj=simple_config_content, filename=tmp_text_file.name)
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    serialization = tmp_text_file.read()
    assert serialization == SIMPLE_CONFIG_CONFIGOBJ_SERIALIZATION
def test_ConfigObjSerializer_from_file(simple_config_content, serializer, tmp_text_file):
    tmp_text_file.write(SIMPLE_CONFIG_CONFIGOBJ_SERIALIZATION)
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    obj = serializer.from_file(filename=tmp_text_file.name)
    assert compare_dicts(obj, simple_config_content)
Example #18
0
def test_Config_from_file_zirkon(simple_config, tmp_text_file):
    tmp_text_file.write(SIMPLE_CONFIG_ZIRKON_SERIALIZATION)
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    config = Config.from_file(filename=tmp_text_file.name, protocol="zirkon")
    assert config == simple_config
Example #19
0
def test_Schema_from_file_json(simple_schema, tmp_text_file):
    tmp_text_file.write(SIMPLE_SCHEMA_JSON_SERIALIZATION)
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    schema = Schema.from_file(filename=tmp_text_file.name, fmt="json")
    assert schema == simple_schema
Example #20
0
def test_Config_to_file_json(simple_config, tmp_text_file):
    simple_config.to_file(filename=tmp_text_file.name, protocol="json")
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    serialization = tmp_text_file.read()
    assert serialization == SIMPLE_CONFIG_JSON_SERIALIZATION
Example #21
0
def test_Schema_from_file_configobj(simple_schema, tmp_text_file):
    tmp_text_file.write(SIMPLE_SCHEMA_CONFIGOBJ_SERIALIZATION)
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    schema = Schema.from_file(filename=tmp_text_file.name, fmt="configobj")
    assert schema == simple_schema
Example #22
0
def test_Config_from_file_zirkon(simple_config, tmp_text_file):
    tmp_text_file.write(SIMPLE_CONFIG_ZIRKON_SERIALIZATION)
    tmp_text_file.flush()
    tmp_text_file.seek(0)
    config = Config.from_file(filename=tmp_text_file.name, protocol="zirkon")
    assert config == simple_config