test: new field convention TDD
This commit is contained in:
parent
fea7838ead
commit
082ab463c1
2 changed files with 23 additions and 9 deletions
|
|
@ -1,3 +1,4 @@
|
|||
value: %{sample}
|
||||
nested: %{some.nested.value}
|
||||
custom: ${custom.field}
|
||||
value: ${sample}
|
||||
nested: ${some.nested.value}
|
||||
custom: ${custom/field}
|
||||
uname: ${sample/username}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ def target_path():
|
|||
p.unlink()
|
||||
|
||||
|
||||
def test_process(target_path: Path):
|
||||
@pytest.fixture
|
||||
def test1_content(target_path: Path):
|
||||
mo = Mo(Passwords())
|
||||
mo.process(Path('tests/files/test1/test.mo.yaml').absolute())
|
||||
|
||||
|
|
@ -27,9 +28,21 @@ def test_process(target_path: Path):
|
|||
|
||||
content = target_path.read_text()
|
||||
assert '${' not in content
|
||||
assert '%{' not in content
|
||||
|
||||
parsed = yaml.load(content, Loader=yaml.FullLoader)
|
||||
assert parsed['value'] == 'some_pass'
|
||||
assert parsed['nested'] == 'nested_pass'
|
||||
assert parsed['custom'] == 'custom_content'
|
||||
return yaml.load(content, Loader=yaml.FullLoader)
|
||||
|
||||
|
||||
def test_simple(test1_content: dict):
|
||||
assert test1_content['value'] == 'some_pass'
|
||||
|
||||
|
||||
def test_nested(test1_content: dict):
|
||||
assert test1_content['nested'] == 'nested_pass'
|
||||
|
||||
|
||||
def test_custom_field(test1_content: dict):
|
||||
assert test1_content['custom'] == 'custom_content'
|
||||
|
||||
|
||||
def test_username_field(test1_content: dict):
|
||||
assert test1_content['uname'] == 'sample_username'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue