Example #1
0
File: test_util.py Project: xii/xii
def test_yaml_read(monkeypatch, data):
    yaml = load_raw_fixture("util.yaml")
    monkeypatch.setattr("__builtin__.open", fake_open(yaml, "/tmp/yaml", "r"))

    result = util.yaml_read("/tmp/yaml")
    
    assert(result["multiple"]["network"] == "default")
Example #2
0
File: test_util.py Project: xii/xii
def test_yaml_read_invalid(monkeypatch):
    yaml = load_raw_fixture("util_invalid.yaml")

    monkeypatch.setattr("__builtin__.open", fake_open(yaml, "/tmp/yaml", "r"))
    
    with raises(error.ValidatorError):
        util.yaml_read("/tmp/yaml")
Example #3
0
File: test_util.py Project: xii/xii
def test_file_read(monkeypatch):
    monkeypatch.setattr("__builtin__.open", fake_open(u"test stream", "/tmp/test", "r"))
    assert(util.file_read("/tmp/test") == "test stream")