diff options
author | Tim Burke <tim.burke@gmail.com> | 2019-07-26 22:56:08 -0700 |
---|---|---|
committer | Tim Burke <tim.burke@gmail.com> | 2019-08-01 20:42:31 -0700 |
commit | 78753987468cb6b04d0b4e06b432e22f5a7189bd (patch) | |
tree | 67a7363af5abd18dd11c557f2b0e47bf8c356455 /tests/unit/test_service.py | |
parent | 5bd66947fc3d8987d4b24d5119a346031004229e (diff) | |
download | python-swiftclient-78753987468cb6b04d0b4e06b432e22f5a7189bd.tar.gz |
Delete/overwrite symlinks better
Previously, when deleting a symlink that points to an xLO, we'd clean
up the xLO's segments then delete the symlink, leaving the xLO itself
busted.
Similar trouble would come from overwriting a symlink pointing to an
xLO. Check for a Content-Location in the HEAD response and leave such
segments.
Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>
Change-Id: I45b210cf380a68bd88187c91fa2d63a8b2bb709b
Diffstat (limited to 'tests/unit/test_service.py')
-rw-r--r-- | tests/unit/test_service.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/unit/test_service.py b/tests/unit/test_service.py index 12fbaa0..b760352 100644 --- a/tests/unit/test_service.py +++ b/tests/unit/test_service.py @@ -312,8 +312,8 @@ class TestServiceDelete(_TestServiceBase): s = SwiftService() r = s._delete_object(mock_conn, 'test_c', 'test_o', self.opts, mock_q) - mock_conn.head_object.assert_called_once_with('test_c', 'test_o', - headers={}) + mock_conn.head_object.assert_called_once_with( + 'test_c', 'test_o', query_string='symlink=get', headers={}) mock_conn.delete_object.assert_called_once_with( 'test_c', 'test_o', query_string=None, response_dict={}, headers={} @@ -335,7 +335,8 @@ class TestServiceDelete(_TestServiceBase): r = s._delete_object(mock_conn, 'test_c', 'test_o', opt_c, mock_q) mock_conn.head_object.assert_called_once_with( - 'test_c', 'test_o', headers={'Skip-Middleware': 'Test'}) + 'test_c', 'test_o', headers={'Skip-Middleware': 'Test'}, + query_string='symlink=get') mock_conn.delete_object.assert_called_once_with( 'test_c', 'test_o', query_string=None, response_dict={}, headers={'Skip-Middleware': 'Test'} @@ -362,8 +363,8 @@ class TestServiceDelete(_TestServiceBase): r = s._delete_object(mock_conn, 'test_c', 'test_o', self.opts, mock_q) after = time.time() - mock_conn.head_object.assert_called_once_with('test_c', 'test_o', - headers={}) + mock_conn.head_object.assert_called_once_with( + 'test_c', 'test_o', query_string='symlink=get', headers={}) mock_conn.delete_object.assert_called_once_with( 'test_c', 'test_o', query_string=None, response_dict={}, headers={} @@ -389,8 +390,8 @@ class TestServiceDelete(_TestServiceBase): s = SwiftService() r = s._delete_object(mock_conn, 'test_c', 'test_o', self.opts, mock_q) - mock_conn.head_object.assert_called_once_with('test_c', 'test_o', - headers={}) + mock_conn.head_object.assert_called_once_with( + 'test_c', 'test_o', query_string='symlink=get', headers={}) mock_conn.delete_object.assert_called_once_with( 'test_c', 'test_o', query_string='multipart-manifest=delete', |