mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-29 13:51:28 -07:00
* This commit includes a unit test to exercise the _is_role function and make sure it doesn't break in any Python version. * Import os.path and other minor fixups
This commit is contained in:
parent
0274835add
commit
8e4f112b39
2 changed files with 18 additions and 23 deletions
|
@ -41,6 +41,12 @@ class TestDataLoader(unittest.TestCase):
|
|||
def tearDown(self):
|
||||
pass
|
||||
|
||||
@patch('os.path.exists')
|
||||
def test__is_role(self, p_exists):
|
||||
p_exists.side_effect = lambda p: p == b'test_path/tasks/main.yml'
|
||||
self.assertTrue(self._loader._is_role('test_path/tasks'))
|
||||
self.assertTrue(self._loader._is_role('test_path/'))
|
||||
|
||||
@patch.object(DataLoader, '_get_file_contents')
|
||||
def test_parse_json_from_file(self, mock_def):
|
||||
mock_def.return_value = (b"""{"a": 1, "b": 2, "c": 3}""", True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue