mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
Refactors main() function and module manager in multiple modules (#53948)
Improves docs
This commit is contained in:
committed by
Tim Rupp
parent
dcc4e0f220
commit
fbc8ee0288
@@ -70,9 +70,11 @@ class TestParameters(unittest.TestCase):
|
||||
dest='/tmp/',
|
||||
force='yes',
|
||||
file='foo_export',
|
||||
password='password',
|
||||
server='localhost',
|
||||
user='admin'
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
)
|
||||
)
|
||||
p = ModuleParameters(params=args)
|
||||
assert p.file == 'foo_export'
|
||||
@@ -102,9 +104,11 @@ class TestManager(unittest.TestCase):
|
||||
name='fake_policy',
|
||||
file='foo_export',
|
||||
dest='/tmp/',
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin',
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
)
|
||||
))
|
||||
|
||||
module = AnsibleModule(
|
||||
|
||||
@@ -103,9 +103,11 @@ class TestManager(unittest.TestCase):
|
||||
name='fake_policy',
|
||||
source=self.policy,
|
||||
type='access_policy',
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin',
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
),
|
||||
))
|
||||
|
||||
module = AnsibleModule(
|
||||
|
||||
@@ -85,14 +85,17 @@ class TestManager(unittest.TestCase):
|
||||
def test_create(self, *args):
|
||||
set_module_args(dict(
|
||||
content='{ "foo": "bar" }',
|
||||
server='localhost',
|
||||
user='admin',
|
||||
password='password'
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
)
|
||||
))
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=self.spec.argument_spec,
|
||||
supports_check_mode=self.spec.supports_check_mode
|
||||
supports_check_mode=self.spec.supports_check_mode,
|
||||
required_if=self.spec.required_if
|
||||
)
|
||||
mm = ModuleManager(module=module)
|
||||
|
||||
|
||||
@@ -72,10 +72,7 @@ class TestParameters(unittest.TestCase):
|
||||
base64='yes',
|
||||
dest='/tmp/foo.xml',
|
||||
force='yes',
|
||||
file='foo.xml',
|
||||
password='password',
|
||||
server='localhost',
|
||||
user='admin'
|
||||
file='foo.xml'
|
||||
)
|
||||
p = ModuleParameters(params=args)
|
||||
assert p.inline is True
|
||||
@@ -108,9 +105,11 @@ class TestManager(unittest.TestCase):
|
||||
name='fake_policy',
|
||||
file='foobar.xml',
|
||||
dest='/tmp/foobar.xml',
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin',
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
)
|
||||
))
|
||||
|
||||
module = AnsibleModule(
|
||||
|
||||
@@ -101,14 +101,17 @@ class TestManager(unittest.TestCase):
|
||||
set_module_args(dict(
|
||||
name='fake_policy',
|
||||
source=self.policy,
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin',
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
)
|
||||
))
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=self.spec.argument_spec,
|
||||
supports_check_mode=self.spec.supports_check_mode
|
||||
supports_check_mode=self.spec.supports_check_mode,
|
||||
mutually_exclusive=self.spec.mutually_exclusive,
|
||||
)
|
||||
|
||||
# Override methods to force specific logic in the module to happen
|
||||
|
||||
@@ -112,9 +112,11 @@ class TestManager(unittest.TestCase):
|
||||
template='OWA Exchange 2007 (https)',
|
||||
state='present',
|
||||
active='yes',
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin',
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
)
|
||||
))
|
||||
|
||||
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
||||
@@ -149,9 +151,11 @@ class TestManager(unittest.TestCase):
|
||||
name='fake_policy',
|
||||
state='present',
|
||||
active='yes',
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin',
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
)
|
||||
))
|
||||
|
||||
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
||||
@@ -186,9 +190,11 @@ class TestManager(unittest.TestCase):
|
||||
name='fake_policy',
|
||||
state='present',
|
||||
active='yes',
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin',
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
)
|
||||
))
|
||||
|
||||
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
||||
@@ -219,9 +225,11 @@ class TestManager(unittest.TestCase):
|
||||
name='fake_policy',
|
||||
state='present',
|
||||
active='yes',
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin',
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
)
|
||||
))
|
||||
|
||||
current = V1Parameters(params=load_fixture('load_asm_policy_active.json'))
|
||||
@@ -248,10 +256,12 @@ class TestManager(unittest.TestCase):
|
||||
set_module_args(dict(
|
||||
name='fake_policy',
|
||||
state='present',
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin',
|
||||
active='no'
|
||||
active='no',
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
)
|
||||
))
|
||||
|
||||
current = V1Parameters(params=load_fixture('load_asm_policy_active.json'))
|
||||
@@ -280,10 +290,12 @@ class TestManager(unittest.TestCase):
|
||||
set_module_args(dict(
|
||||
name='fake_policy',
|
||||
state='present',
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin',
|
||||
active='no'
|
||||
active='no',
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
)
|
||||
))
|
||||
|
||||
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
||||
@@ -311,9 +323,11 @@ class TestManager(unittest.TestCase):
|
||||
name='fake_policy',
|
||||
template='LotusDomino 6.5 (http)',
|
||||
state='present',
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin',
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
)
|
||||
))
|
||||
|
||||
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
||||
@@ -346,9 +360,11 @@ class TestManager(unittest.TestCase):
|
||||
set_module_args(dict(
|
||||
name='fake_policy',
|
||||
state='present',
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin',
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
)
|
||||
))
|
||||
|
||||
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
||||
@@ -382,9 +398,11 @@ class TestManager(unittest.TestCase):
|
||||
set_module_args(dict(
|
||||
name='fake_policy',
|
||||
state='absent',
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin',
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
)
|
||||
))
|
||||
|
||||
module = AnsibleModule(
|
||||
@@ -411,9 +429,11 @@ class TestManager(unittest.TestCase):
|
||||
name='fake_policy',
|
||||
state='present',
|
||||
active='yes',
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin',
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
)
|
||||
))
|
||||
|
||||
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
||||
@@ -444,9 +464,11 @@ class TestManager(unittest.TestCase):
|
||||
set_module_args(dict(
|
||||
name='fake_policy',
|
||||
state='present',
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin',
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
)
|
||||
))
|
||||
|
||||
module = AnsibleModule(
|
||||
@@ -474,9 +496,11 @@ class TestManager(unittest.TestCase):
|
||||
set_module_args(dict(
|
||||
name='fake_policy',
|
||||
state='absent',
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin',
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
)
|
||||
))
|
||||
|
||||
module = AnsibleModule(
|
||||
|
||||
@@ -99,9 +99,11 @@ class TestManager(unittest.TestCase):
|
||||
policy_name='fake_policy',
|
||||
state='present',
|
||||
name='IIS',
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin',
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
),
|
||||
))
|
||||
|
||||
module = AnsibleModule(
|
||||
|
||||
@@ -126,9 +126,11 @@ class TestManager(unittest.TestCase):
|
||||
alarm='yes',
|
||||
block='no',
|
||||
learn='yes',
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin',
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
)
|
||||
))
|
||||
|
||||
module = AnsibleModule(
|
||||
|
||||
Reference in New Issue
Block a user