def test_load_from_json_file_not_set(): """ Return empty configuration if json file is not defined. """ metadata = Metadata("foo-bar") config = load_from_json_file(metadata) assert_that(config, is_(empty()))
def test_load_from_json_file(): """ Return configuration from a json file. """ metadata = Metadata("foo-bar") with configfile(dumps(dict(foo="bar"))) as configfile_: with envvar("FOO_BAR_SETTINGS", configfile_.name): config = load_from_json_file(metadata) assert_that(config.foo, is_(equal_to("bar")))