def test_filemgr_find_files(self,
                                mock_file,
                                mock_api,
                                mock_creds,
                                mock_cfg):
        """Test find_files"""

        mgr = FileManager(mock_creds, cfg=mock_cfg)

        resp = mock.create_autospec(Response)
        resp.success = False
        resp.result = RestCallException(None, "test", None)
        mgr._client.query_files.return_value = resp

        with self.assertRaises(RestCallException):
            res = mgr.find_files("test")
        mgr._client.query_files.assert_called_with("test")

        with self.assertRaises(RestCallException):
            res = mgr.find_files([None])
        mgr._client.query_files.assert_called_with([None])

        resp.success = True
        resp.result = []
        res = mgr.find_files("test")
        self.assertEqual(res, [])
        self.assertFalse(mock_file.called)

        resp.result = ["testFile", None]
        res = mgr.find_files("test")
        self.assertEqual(len(res), 2)
        mock_file.assert_any_call(mgr._client, "testFile")
        mock_file.assert_any_call(mgr._client, None)
    def test_filemgr_find_files(self, mock_file, mock_api, mock_creds,
                                mock_cfg):
        """Test find_files"""

        mgr = FileManager(mock_creds, cfg=mock_cfg)

        resp = mock.create_autospec(Response)
        resp.success = False
        resp.result = RestCallException(None, "test", None)
        mgr._client.query_files.return_value = resp

        with self.assertRaises(RestCallException):
            res = mgr.find_files("test")
        mgr._client.query_files.assert_called_with("test")

        with self.assertRaises(RestCallException):
            res = mgr.find_files([None])
        mgr._client.query_files.assert_called_with([None])

        resp.success = True
        resp.result = []
        res = mgr.find_files("test")
        self.assertEqual(res, [])
        self.assertFalse(mock_file.called)

        resp.result = ["testFile", None]
        res = mgr.find_files("test")
        self.assertEqual(len(res), 2)
        mock_file.assert_any_call(mgr._client, "testFile")
        mock_file.assert_any_call(mgr._client, None)