4188a1e
commit d9176570166e0b0cac14af7f0789476fca30a493
0065390
Author: Aurélien Bompard <aurelien@bompard.org>
0065390
Date:   Thu Jul 25 17:34:25 2019 +0200
0065390
0065390
    Fix a couple tests on F31+
0065390
    
0065390
    Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
0065390
0065390
diff --git a/bodhi/tests/client/test___init__.py b/bodhi/tests/client/test___init__.py
4188a1e
index a06780a3..3b824a17 100644
0065390
--- a/bodhi/tests/client/test___init__.py
0065390
+++ b/bodhi/tests/client/test___init__.py
4188a1e
@@ -993,7 +993,14 @@ class TestQuery(unittest.TestCase):
0065390
             )
0065390
         ]
0065390
         self.assertEqual(send_request.mock_calls, calls)
0065390
-        mock_open.assert_called_with(fedora.client.openidbaseclient.b_SESSION_FILE, 'rb')
0065390
+        # Before F31 the file was opened in binary mode, and then it changed.
0065390
+        # Only check the path.
4188a1e
+        self.assertNotEqual(mock_open.call_count, 0)
4188a1e
+        first_args = [args[0][0] for args in mock_open.call_args_list]
4188a1e
+        self.assertIn(
4188a1e
+            fedora.client.openidbaseclient.b_SESSION_FILE,
4188a1e
+            first_args
0065390
+        )
0065390
 
0065390
     @mock.patch('bodhi.client.bindings.BodhiClient.csrf',
0065390
                 mock.MagicMock(return_value='a_csrf_token'))
4188a1e
@@ -1128,7 +1135,14 @@ class TestQueryBuildrootOverrides(unittest.TestCase):
0065390
             )
0065390
         ]
0065390
         self.assertEqual(send_request.mock_calls, calls)
0065390
-        mock_open.assert_called_with(fedora.client.openidbaseclient.b_SESSION_FILE, 'rb')
0065390
+        # Before F31 the file was opened in binary mode, and then it changed.
0065390
+        # Only check the path.
4188a1e
+        self.assertNotEqual(mock_open.call_count, 0)
4188a1e
+        first_args = [args[0][0] for args in mock_open.call_args_list]
4188a1e
+        self.assertIn(
4188a1e
+            fedora.client.openidbaseclient.b_SESSION_FILE,
4188a1e
+            first_args
0065390
+        )
0065390
 
0065390
     @mock.patch('bodhi.client.bindings.BodhiClient.csrf',
0065390
                 mock.MagicMock(return_value='a_csrf_token'))