Fix unit test relative imports, and permissions for included collection requirements (#29)

* Fix Hetzner firewall unit test imports.

* Make sure tests can actually access collections.

* Fix more relative imports.

* Fix more relative imports.

* Fix more includes.

* Fix more tests.

* One more.

* Fix syntax error in sanity import tests (invalid escape sequence "\$" caused by non-raw docs block)

* Fix permissions of ansible-test parts for sanity tests.

* Revert "Fix permissions of ansible-test parts for sanity tests."

This reverts commit c2713f0a12.
This commit is contained in:
Felix Fontein
2020-03-24 09:27:28 +01:00
committed by GitHub
parent 676bec5484
commit c012d0fba7
202 changed files with 239 additions and 233 deletions

View File

@@ -39,8 +39,8 @@ class OneViewBaseTest(object):
resource_module_path_name = re.findall('[A-Z][^A-Z]*', resource_module_path_name)
resource_module_path_name = 'oneview_' + str.join('_', resource_module_path_name).lower()
ansible = __import__('ansible')
oneview_module = ansible.modules.remote_management.oneview
ansible_collections = __import__('ansible_collections')
oneview_module = ansible_collections.community.general.plugins.modules.remote_management.oneview
resource_module = getattr(oneview_module, resource_module_path_name)
self.testing_class = getattr(resource_module, resource_name)
testing_module = self.testing_class.__module__.split('.')[-1]
@@ -143,9 +143,9 @@ class OneViewBaseTestCase(object):
def __set_module_examples(self):
# Load scenarios from module examples (Also checks if it is a valid yaml)
ansible = __import__('ansible')
ansible_collections = __import__('ansible_collections')
testing_module = self.testing_class.__module__.split('.')[-1]
self.testing_module = getattr(ansible.modules.remote_management.oneview, testing_module)
self.testing_module = getattr(ansible_collections.community.general.plugins.modules.remote_management.oneview, testing_module)
try:
# Load scenarios from module examples (Also checks if it is a valid yaml)