From 6f01f84ce2fa17b08e56dd5d3537a68d876a9988 Mon Sep 17 00:00:00 2001
From: Tim Burke <tim.burke@gmail.com>
Date: Fri, 15 Dec 2023 12:18:18 -0800
Subject: [PATCH] tests: Fix call assertion

Under py312, MagicMock.has_calls raises an AttributeError. This is
actually a good thing, as previously we weren't actually making the
assertions we thought we were making.

Fix the one place that we forgot the leading `assert_`, and switch it
to `any_order=True`; this is required for the test to pass, as there
are additional calls between the two expected calls.

See https://github.com/python/cpython/commit/1d4d677d

Change-Id: Ia2ff2f198b4c1312a3e7dce32f11b87050683d45
---
 test/unit/test_shell.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/test/unit/test_shell.py b/test/unit/test_shell.py
index eedbc4be..1bd26fff 100644
--- a/test/unit/test_shell.py
+++ b/test/unit/test_shell.py
@@ -867,12 +867,13 @@ class TestShell(unittest.TestCase):
             fh.write(b'12345678901234567890')
         swiftclient.shell.main(argv)
         expected_calls = [mock.call('container',
-                                    {'X-Storage-Policy': mock.ANY},
+                                    {'X-Storage-Policy': 'one'},
                                     response_dict={}),
                           mock.call('container_segments',
-                                    {'X-Storage-Policy': mock.ANY},
+                                    {'X-Storage-Policy': 'one'},
                                     response_dict={})]
-        connection.return_value.put_container.has_calls(expected_calls)
+        connection.return_value.put_container.assert_has_calls(expected_calls,
+                                                               any_order=True)
         connection.return_value.put_object.assert_called_with(
             'container',
             self.tmpfile.lstrip('/'),