Skip to content

Commit

Permalink
tests: test_dump_default_config()
Browse files Browse the repository at this point in the history
  • Loading branch information
stuarteberg committed Jan 2, 2019
1 parent a6ce10a commit 901cbdf
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion confiddler/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest
from ruamel.yaml import YAML

from confiddler import load_config, emit_defaults, validate, flow_style, ValidationError
from confiddler import load_config, emit_defaults, validate, dump_default_config, flow_style, ValidationError

yaml = YAML()
yaml.default_flow_style = False
Expand Down Expand Up @@ -131,6 +131,23 @@ def test_emit_defaults():
validate(defaults, schema)


def test_dump_default_config():
schema = copy.deepcopy(TEST_SCHEMA)
defaults = emit_defaults(schema)

# To file object
f = StringIO()
dump_default_config(schema, f)
f.seek(0)

assert yaml.load(f) == defaults

# To string
s = dump_default_config(schema)
assert s == f.getvalue()



def test_emit_incomplete_defaults():
schema = copy.deepcopy(TEST_SCHEMA)

Expand Down

0 comments on commit 901cbdf

Please sign in to comment.