Fixes unit tests for vcmp guest module (#47792)
Tests were not working for ansible 2.8
This commit is contained in:
parent
6ebd20bf22
commit
1ddfac5ad5
2 changed files with 15 additions and 11 deletions
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright (c) 2017 F5 Networks Inc.
|
# Copyright: (c) 2017, F5 Networks Inc.
|
||||||
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
|
@ -462,7 +462,7 @@ class ModuleManager(object):
|
||||||
if changed:
|
if changed:
|
||||||
self.changes = UsableChanges(params=changed)
|
self.changes = UsableChanges(params=changed)
|
||||||
|
|
||||||
def _update_changed_options(self):
|
def _update_changed_options(self): # lgtm [py/similar-function]
|
||||||
diff = Difference(self.want, self.have)
|
diff = Difference(self.want, self.have)
|
||||||
updatables = Parameters.updatables
|
updatables = Parameters.updatables
|
||||||
changed = dict()
|
changed = dict()
|
||||||
|
|
|
@ -8,32 +8,36 @@ __metaclass__ = type
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import pytest
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from nose.plugins.skip import SkipTest
|
from nose.plugins.skip import SkipTest
|
||||||
if sys.version_info < (2, 7):
|
if sys.version_info < (2, 7):
|
||||||
raise SkipTest("F5 Ansible modules require Python >= 2.7")
|
raise SkipTest("F5 Ansible modules require Python >= 2.7")
|
||||||
|
|
||||||
from units.compat import unittest
|
|
||||||
from units.compat.mock import Mock
|
|
||||||
from units.compat.mock import patch
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from library.modules.bigip_vcmp_guest import Parameters
|
from library.modules.bigip_vcmp_guest import Parameters
|
||||||
from library.modules.bigip_vcmp_guest import ModuleManager
|
from library.modules.bigip_vcmp_guest import ModuleManager
|
||||||
from library.modules.bigip_vcmp_guest import ArgumentSpec
|
from library.modules.bigip_vcmp_guest import ArgumentSpec
|
||||||
from library.module_utils.network.f5.common import F5ModuleError
|
|
||||||
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
# In Ansible 2.8, Ansible changed import paths.
|
||||||
from test.unit.modules.utils import set_module_args
|
from test.units.compat import unittest
|
||||||
|
from test.units.compat.mock import Mock
|
||||||
|
from test.units.compat.mock import patch
|
||||||
|
|
||||||
|
from test.units.modules.utils import set_module_args
|
||||||
except ImportError:
|
except ImportError:
|
||||||
try:
|
try:
|
||||||
from ansible.modules.network.f5.bigip_vcmp_guest import Parameters
|
from ansible.modules.network.f5.bigip_vcmp_guest import Parameters
|
||||||
from ansible.modules.network.f5.bigip_vcmp_guest import ModuleManager
|
from ansible.modules.network.f5.bigip_vcmp_guest import ModuleManager
|
||||||
from ansible.modules.network.f5.bigip_vcmp_guest import ArgumentSpec
|
from ansible.modules.network.f5.bigip_vcmp_guest import ArgumentSpec
|
||||||
from ansible.module_utils.network.f5.common import F5ModuleError
|
|
||||||
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
# Ansible 2.8 imports
|
||||||
|
from units.compat import unittest
|
||||||
|
from units.compat.mock import Mock
|
||||||
|
from units.compat.mock import patch
|
||||||
|
|
||||||
from units.modules.utils import set_module_args
|
from units.modules.utils import set_module_args
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
|
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
|
||||||
|
|
Loading…
Reference in a new issue