# Path: tests/format_multipart_upload.py
# def format_multipart_upload(metadata, media, content_type="application/octet-stream"):
#     boundary = "test_separator_deadbeef"
#     payload = (
#         ("--" + boundary + "\r\n").join(
#             [
#                 "",
#                 # object metadata "part"
#                 "\r\n".join(
#                     [
#                         "Content-Type: application/json; charset=UTF-8",
#                         "",
#                         json.dumps(metadata),
#                         "",
#                     ]
#                 ),
#                 # object media "part"
#                 "\r\n".join(
#                     [
#                         "Content-Type: " + content_type,
#                         "Content-Length: %d" % len(media),
#                         "",
#                         media,
#                         "",
#                     ]
#                 ),
#             ]
#         )
#         + "--"
#         + boundary
#         + "--\r\n"
#     )
#     return boundary, payload


import base64
import hashlib
import json
import unittest
import unittest.mock
import datetime
import gcs
import testbench
from werkzeug.test import create_environ
from werkzeug.wrappers import Request
from google.storage.v2 import storage_pb2
from tests.format_multipart_upload import format_multipart_upload
            "stall-at-256KiB": 200,
        }
        for instruction, status_code in cases.items():
            request = Request(
                create_environ(
                    base_url="http://localhost:8080",
                    headers={"x-goog-testbench-instructions": instruction},
                    data=json.dumps({}),
                )
            )
            response = blob.rest_media(request)
            self.assertEqual(response.status_code, status_code, msg=instruction)
            self.assertEqual(
                response.data,
                b"How vexingly quick daft zebras jump!",
                msg=instruction,
            )

            request = testbench.common.FakeRequest.init_xml(request)
            response = blob.rest_media(request)
            self.assertEqual(
                response.status_code, status_code, msg="XML " + instruction
            )
            self.assertEqual(
                response.data,
                b"How vexingly quick daft zebras jump!",
                msg="XML " + instruction,
            )

    def test_stall_always(self):

# Path: tests/format_multipart_upload.py
# def format_multipart_upload(metadata, media, content_type="application/octet-stream"):
#     boundary = "test_separator_deadbeef"
#     payload = (
#         ("--" + boundary + "\r\n").join(
#             [
#                 "",
#                 # object metadata "part"
#                 "\r\n".join(
#                     [
#                         "Content-Type: application/json; charset=UTF-8",
#                         "",
#                         json.dumps(metadata),
#                         "",
#                     ]
#                 ),
#                 # object media "part"
#                 "\r\n".join(
#                     [
#                         "Content-Type: " + content_type,
#                         "Content-Length: %d" % len(media),
#                         "",
#                         media,
#                         "",
#                     ]
#                 ),
#             ]
#         )
#         + "--"
#         + boundary
#         + "--\r\n"
#     )
#     return boundary, payload


# Path: tests/test_object.py
import base64
import hashlib
import json
import unittest
import unittest.mock
import datetime
import gcs
import testbench
from werkzeug.test import create_environ
from werkzeug.wrappers import Request
from google.storage.v2 import storage_pb2
from tests.format_multipart_upload import format_multipart_upload

            "stall-at-256KiB": 200,
        }
        for instruction, status_code in cases.items():
            request = Request(
                create_environ(
                    base_url="http://localhost:8080",
                    headers={"x-goog-testbench-instructions": instruction},
                    data=json.dumps({}),
                )
            )
            response = blob.rest_media(request)
            self.assertEqual(response.status_code, status_code, msg=instruction)
            self.assertEqual(
                response.data,
                b"How vexingly quick daft zebras jump!",
                msg=instruction,
            )

            request = testbench.common.FakeRequest.init_xml(request)
            response = blob.rest_media(request)
            self.assertEqual(
                response.status_code, status_code, msg="XML " + instruction
            )
            self.assertEqual(
                response.data,
                b"How vexingly quick daft zebras jump!",
                msg="XML " + instruction,
            )

    def test_stall_always(self):

        boundary, payload = format_multipart_upload(