1# This Source Code Form is subject to the terms of the Mozilla Public
2# License, v. 2.0. If a copy of the MPL was not distributed with this
3# file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
5from __future__ import absolute_import, print_function
6
7import mozunit
8import pytest
9
10
11@pytest.fixture
12def parse(normalize):
13    reftest = pytest.importorskip("reftest")
14
15    def inner(path):
16        mp = reftest.ReftestManifest()
17        mp.load(normalize(path))
18        return mp
19
20    return inner
21
22
23def test_parse_defaults(parse):
24    mp = parse("defaults.list")
25    assert len(mp.tests) == 4
26
27    for test in mp.tests:
28        if test["name"].startswith("foo"):
29            assert test["pref"] == "foo.bar,true"
30        else:
31            assert "pref" not in test
32
33    # invalid defaults
34    with pytest.raises(ValueError):
35        parse("invalid-defaults.list")
36
37
38if __name__ == "__main__":
39    mozunit.main()
40