Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding testing for LinodeBaseModule #422

Merged
merged 9 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tests/unit/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from ansible_collections.linode.cloud.plugins.module_utils.linode_common import LinodeModuleBase

class TestModuleBase(LinodeModuleBase):
"""
Test module that represents an instance of LinodeModuleBase.
"""
def __init__(self):
self._client = None
pass
21 changes: 21 additions & 0 deletions tests/unit/module_utils/test_linode_common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from types import SimpleNamespace

from unittest import TestCase
import os

from ansible_collections.linode.cloud.tests.unit.base import TestModuleBase

class TestLinodeModuleBase(TestCase):

def setUp(self, **kwargs):
mock_module = TestModuleBase()
mock_module.module = SimpleNamespace(params=kwargs)

return mock_module

def test_module_ca_path_override(self):
os.environ['LINODE_CA'] = "env_ca"
mock_module = self.setUp(api_token="testing", api_version=None, api_url="/", ua_prefix=None, ca_path="foobar")

client = mock_module.client
assert client.ca_path == "foobar"
zliang-akamai marked this conversation as resolved.
Show resolved Hide resolved