def test_filemgr_find_file(self,
                               mock_file,
                               mock_api,
                               mock_creds,
                               mock_cfg):
        """Test find_file"""

        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_file("test", "date")
        mgr._client.query_files.assert_called_with({'FileName':'test',
                                                    'Timestamp':'date'})

        with self.assertRaises(RestCallException):
            res = mgr.find_file("test", "date", full_path="path")
        mgr._client.query_files.assert_called_with({'FileName':'test',
                                                    'Timestamp':'date',
                                                    'OriginalPath':'path'})
        resp.success = True
        resp.result = []
        res = mgr.find_file("test", "date")
        self.assertEqual(res, [])
        self.assertFalse(mock_file.called)

        resp.result = ["testFile", None]
        res = mgr.find_file("test", "date")
        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_file(self, mock_file, mock_api, mock_creds,
                               mock_cfg):
        """Test find_file"""

        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_file("test", "date")
        mgr._client.query_files.assert_called_with({
            'FileName': 'test',
            'Timestamp': 'date'
        })

        with self.assertRaises(RestCallException):
            res = mgr.find_file("test", "date", full_path="path")
        mgr._client.query_files.assert_called_with({
            'FileName': 'test',
            'Timestamp': 'date',
            'OriginalPath': 'path'
        })
        resp.success = True
        resp.result = []
        res = mgr.find_file("test", "date")
        self.assertEqual(res, [])
        self.assertFalse(mock_file.called)

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