def test_object_copy(self): request = self.mock_rest_request( body='{"dest_container":"eggs", "dest_name":"bacon"}', ) self.mock_swift_copy_object.return_value = self.objects.first() response = swift.ObjectCopy().post(request, 'spam', u'test object%\u6346') self.assertStatusCode(response, 201) self.assertEqual( response['location'], '=?utf-8?q?/api/swift/containers/eggs/object/test_object' '=25=E6=8D=86?=') self.mock_swift_copy_object.assert_called_once_with( request, 'spam', u'test object%\u6346', 'eggs', 'bacon') self.assertStatusCode(response, 201)
def test_object_copy(self, nc): request = self.mock_rest_request( body='{"dest_container":"eggs", "dest_name":"bacon"}', ) nc.swift_copy_object.return_value = self._objects[0] response = swift.ObjectCopy().post(request, 'spam', u'test object%\u6346') self.assertStatusCode(response, 201) self.assertEqual( response['location'], '=?utf-8?q?/api/swift/containers/eggs/object/test_object' '=25=E6=8D=86?=') self.assertTrue(nc.swift_copy_object.called) call = nc.swift_copy_object.call_args[0] self.assertEqual( call[0:5], (request, 'spam', u'test object%\u6346', 'eggs', 'bacon')) self.assertStatusCode(response, 201)