def test_find_in_files_multiple(self): """fileops:FindInFiles with multiple paths parses correctly""" expected = ['grep --regexp "test" /tmp/file /tmp/dir/'] params = { 'hosts': ['testhost.example.com'], 'command': 'fileops', 'subcommand': 'ChangeOwnership', 'path': ['/tmp/file', '/tmp/dir/'], 'regexp': 'test' } (update, cmd) = fileops._parse_FindInFiles(params, self.app_logger) self.assertEqual(cmd, expected)
def test_find_in_files_with_case_insensitive(self): """fileops:FindInFiles with case insensitive parses correctly""" expected = ['grep --regexp -i "test" /tmp/file'] params = { 'hosts': ['testhost.example.com'], 'command': 'fileops', 'subcommand': 'ChangeOwnership', 'path': '/tmp/file', 'regexp': 'test', 'case_insensitive': True, } (update, cmd) = fileops._parse_FindInFiles(params, self.app_logger) self.assertEqual(cmd, expected)