blob: 31125d3acdf17a1d805dfba5f4ee8190a4339568 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
"""Tests for meta-incorrect rule."""
from ansiblelint.rules import RulesCollection
from ansiblelint.rules.meta_incorrect import MetaChangeFromDefaultRule
from ansiblelint.testing import RunFromText
DEFAULT_GALAXY_INFO = """
galaxy_info:
author: your name
description: your description
company: your company (optional)
license: license (GPLv2, CC-BY, etc)
"""
NO_GALAXY_INFO = """
galaxy_information:
author: your name
description: your description
company: your company (optional)
license: license (GPLv2, CC-BY, etc)
"""
def test_default_galaxy_info() -> None:
"""Test for meta-incorrect."""
collection = RulesCollection()
collection.register(MetaChangeFromDefaultRule())
runner = RunFromText(collection)
results = runner.run_role_meta_main(DEFAULT_GALAXY_INFO)
# Disabled check because default value is not passing schema validation
# assert "Should change default metadata: author" in str(results)
assert "Should change default metadata: description" in str(results)
assert "Should change default metadata: company" in str(results)
assert "Should change default metadata: license" in str(results)
def test_no_galaxy_info() -> None:
"""Test for no galaxy info passed to meta-incorrect."""
collection = RulesCollection()
collection.register(MetaChangeFromDefaultRule())
runner = RunFromText(collection)
results = runner.run_role_meta_main(NO_GALAXY_INFO)
assert results == []
|