forked from napalm-automation/napalm-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is for the 2017 Hackathon napalm-automation/hackathon-2017#10 This commit validates that each Ansible module has a DOCUMENTATION and an EXAMPLES variable. It also asserts that those variables are properly formatted YAML strings.
- Loading branch information
Showing
6 changed files
with
48 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import pytest | ||
import yaml | ||
from glob import glob | ||
from importlib import import_module | ||
|
||
module_files = glob('napalm_ansible/napalm_*.py') | ||
modules = [module.split('.')[0].replace('/', '.') for module in module_files] | ||
|
||
|
||
@pytest.fixture(params=modules) | ||
def ansible_module(request): | ||
return request.param | ||
|
||
|
||
def test_module_documentation_exists(ansible_module): | ||
module = import_module(ansible_module) | ||
content = dir(module) | ||
assert 'DOCUMENTATION' in content | ||
assert 'EXAMPLES' in content | ||
|
||
|
||
def test_module_documentation_format(ansible_module): | ||
module = import_module(ansible_module) | ||
content = dir(module) | ||
documentation = yaml.load(module.DOCUMENTATION) | ||
#assert 'DOCUMENTATION' in content | ||
#assert 'EXAMPLES' in content | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[tox] | ||
envlist = py27 | ||
|
||
[testenv] | ||
deps = | ||
-rrequirements.txt | ||
pytest | ||
ansible | ||
commands = | ||
py.test |