def test_should_parse_valid_config(self): # given config = {"hooks": {"post_switch": "/usr/bin/echo 42"}} self.write_config(config) # expect assert list(configs([self.tmpdir])) == [(self.tmpdir, config)]
def test_should_pick_parse_multiple_locations(self): # given dir1 = os.path.join(self.tmpdir, "dir1") config1 = {"hooks": {"post_switch": "/usr/bin/echo 41"}} self.write_config(config1, dir1) dir2 = os.path.join(self.tmpdir, "dir2") config2 = {"hooks": {"post_switch": "/usr/bin/echo 42"}} self.write_config(config2, dir2) # expect assert list(configs([dir1, dir2])) == [(dir1, config1), (dir2, config2)]
def test_should_skip_invalid_config(self): self.write_config_str("%") assert list(configs([self.tmpdir])) == []
def test_should_skip_empty_config_dir(self): assert list(configs([self.tmpdir])) == []
def test_should_skip_non_existing_config_dir(self): assert list(configs(["/doesnotexist"])) == []