Merge pull request #175 from Qalthos/fix_tests

Move check_mode setting to the proper location

SUMMARY


ISSUE TYPE


Test Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Nilashish Chakraborty <nilashishchakraborty8@gmail.com>
pull/131/head^2
softwarefactory-project-zuul[bot] 2022-04-25 15:53:50 +00:00 committed by GitHub
commit 49a2a39da8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 0 deletions

View File

@ -0,0 +1,3 @@
---
trivial:
- check_mode has been removed from play_context, set on task instead for unit tests

View File

@ -44,6 +44,7 @@ Parameters
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small"> <div style="font-size: small">
<span style="color: purple">list</span> <span style="color: purple">list</span>
/ <span style="color: purple">elements=raw</span>
/ <span style="color: red">required</span> / <span style="color: red">required</span>
</div> </div>
</td> </td>

View File

@ -25,7 +25,10 @@ except ImportError:
class TestUpdate_Fact(unittest.TestCase): class TestUpdate_Fact(unittest.TestCase):
def setUp(self): def setUp(self):
task = MagicMock(Task) task = MagicMock(Task)
# Ansible > 2.13 looks for check_mode in task
task.check_mode = False
play_context = MagicMock() play_context = MagicMock()
# Ansible <= 2.13 looks for check_mode in play_context
play_context.check_mode = False play_context.check_mode = False
connection = MagicMock() connection = MagicMock()
fake_loader = {} fake_loader = {}

View File

@ -81,7 +81,10 @@ INVALID_JINJA = [
class TestUpdate_Fact(unittest.TestCase): class TestUpdate_Fact(unittest.TestCase):
def setUp(self): def setUp(self):
task = MagicMock(Task) task = MagicMock(Task)
# Ansible > 2.13 looks for check_mode in task
task.check_mode = False
play_context = MagicMock() play_context = MagicMock()
# Ansible <= 2.13 looks for check_mode in play_context
play_context.check_mode = False play_context.check_mode = False
connection = MagicMock() connection = MagicMock()
fake_loader = {} fake_loader = {}