From 7a3edf41477e043d8297e10e5cc46e8139ed97e2 Mon Sep 17 00:00:00 2001
From: Yuming Zhu <yzhu@redhat.com>
Date: Apr 11 2025 20:09:57 +0000
Subject: fix tests/test_cli/test_import_cg.py for py2


---

diff --git a/tests/test_cli/test_import_cg.py b/tests/test_cli/test_import_cg.py
index b229e10..728b1ed 100644
--- a/tests/test_cli/test_import_cg.py
+++ b/tests/test_cli/test_import_cg.py
@@ -81,12 +81,15 @@ class TestImportCG(utils.CliTestCase):
         # Case 1, running in fg, progress on
         handle_import_cg(self.options, self.session, arguments)
 
-        self.assertEqual(len(self.session.uploadWrapper.mock_calls), len(metadata['output']))
-        kwargs = self.session.uploadWrapper.call_args.kwargs
-        self.assertEqual(kwargs['callback'], _progress_callback)
-        self.session.CGImport.assert_called_once()
-        args = self.session.CGImport.call_args.args
-        self.assertEqual(args[0], metadata)
+        self.assertEqual(
+            self.session.uploadWrapper.mock_calls,
+            [mock.call(mock.ANY, mock.ANY, callback=_progress_callback)
+             for o in metadata['output']]
+        )
+
+        self.session.CGImport.assert_called_once_with(
+            metadata, self.unique_path_mock.return_value, None
+        )
         self.linked_upload.assert_not_called()
 
     def test_handle_import_cg_nodir(self):
@@ -171,9 +174,9 @@ class TestImportCG(utils.CliTestCase):
 
         self.session.uploadWrapper.assert_not_called()
         self.linked_upload.assert_not_called()
-        self.session.CGImport.assert_called_once()
-        args = self.session.CGImport.call_args.args
-        self.assertEqual(args[0], metadata)
+        self.session.CGImport.assert_called_once_with(
+            metadata, self.unique_path_mock.return_value, None
+        )
 
     def test_handle_import_cg_draft(self):
         """Test handle_import_cg function"""
@@ -188,9 +191,9 @@ class TestImportCG(utils.CliTestCase):
         handle_import_cg(self.options, self.session, arguments)
 
         self.assertEqual(len(self.session.uploadWrapper.mock_calls), len(metadata['output']))
-        self.session.CGImport.assert_called_once()
-        args = self.session.CGImport.call_args.args
-        self.assertEqual(args[0], metadata)
+        self.session.CGImport.assert_called_once_with(
+            metadata, self.unique_path_mock.return_value, None
+        )
 
     def test_handle_import_cg_reserve(self):
         """Test handle_import_cg function"""
@@ -205,9 +208,9 @@ class TestImportCG(utils.CliTestCase):
         handle_import_cg(self.options, self.session, arguments)
 
         self.assertEqual(len(self.session.uploadWrapper.mock_calls), len(metadata['output']))
-        self.session.CGImport.assert_called_once()
-        args = self.session.CGImport.call_args.args
-        self.assertEqual(args[0], expect)
+        self.session.CGImport.assert_called_once_with(
+            metadata, self.unique_path_mock.return_value, None
+        )
 
     def test_handle_import_cg_linked(self):
         """Test handle_import_cg function"""
@@ -219,9 +222,9 @@ class TestImportCG(utils.CliTestCase):
 
         self.session.uploadWrapper.assert_not_called()
         self.assertEqual(len(self.linked_upload.mock_calls), len(metadata['output']))
-        self.session.CGImport.assert_called_once()
-        args = self.session.CGImport.call_args.args
-        self.assertEqual(args[0], metadata)
+        self.session.CGImport.assert_called_once_with(
+            metadata, self.unique_path_mock.return_value, None
+        )
 
     def test_handle_import_cg_noprogress(self):
         """Test handle_import_cg function"""
@@ -231,12 +234,14 @@ class TestImportCG(utils.CliTestCase):
 
         handle_import_cg(self.options, self.session, arguments)
 
-        self.assertEqual(len(self.session.uploadWrapper.mock_calls), len(metadata['output']))
-        kwargs = self.session.uploadWrapper.call_args.kwargs
-        self.assertEqual(kwargs['callback'], None)
-        self.session.CGImport.assert_called_once()
-        args = self.session.CGImport.call_args.args
-        self.assertEqual(args[0], metadata)
+        self.assertEqual(
+            self.session.uploadWrapper.mock_calls,
+            [mock.call(mock.ANY, mock.ANY, callback=None)
+             for o in metadata['output']]
+        )
+        self.session.CGImport.assert_called_once_with(
+            metadata, self.unique_path_mock.return_value, None
+        )
         self.linked_upload.assert_not_called()
 
     def test_handle_import_cg_help(self):

