示例#1
0
def test_get_schema_path_negative(mock_resource_filename, mock_exists):
    mock_resource_filename.side_effect = lambda *_: 'shrubbery'
    mock_exists.side_effect = lambda *_: False

    with pytest.raises(errors.SchemaNotFound):
        utils.get_schema_path(
            'Go and boil your bottoms, sons of a silly person!'
        )
示例#2
0
def test_get_schema_path_positive(mock_resource_filename, mock_abspath,
                                  mock_exists):
    mock_resource_filename.side_effect = lambda *_: 'shrubbery'
    mock_exists.side_effect = lambda *_: True
    mock_abspath.side_effect = lambda x: x

    schema_path = utils.get_schema_path('ni!')

    assert schema_path == 'shrubbery'
示例#3
0
def test_get_resolved_schema_path(mock_exists):
    schema_path = utils.get_schema_path(schema='hep.json', resolved=True)
    mock_exists.side_effect = \
        lambda x: x == os.path.join(utils._schema_root_path, 'hep.json')
    assert schema_path == os.path.join(utils._schema_root_path, 'hep.json')
示例#4
0
def test_get_schema_path_negative(schema):
    with pytest.raises(errors.SchemaNotFound):
        utils.get_schema_path(schema)
示例#5
0
def test_get_schema_path_positive(schema, expected):
    schema_path = utils.get_schema_path(schema)

    assert schema_path == os.path.join(utils._schema_root_path, expected)