upload_asset with data in memory (#1601)

* Expose upload from memory functionality
* Upload from memory basic test
* Test for custom file like object
* Reorganized existing release tests
* Remove docstrings & comments from tests
* Modify logic
* Explain why encode ignores its argument

Fixes #1140
This commit is contained in:
Jesse Li
2020-08-03 18:42:06 +10:00
committed by GitHub
parent 06dae3877c
commit a778639362
36 changed files with 1599 additions and 558 deletions
+15
View File
@@ -447,6 +447,21 @@ class Requester:
headers["Content-Length"] = str(os.path.getsize(input))
return self.__requestEncode(cnx, verb, url, parameters, headers, input, encode)
def requestMemoryBlobAndCheck(
self, verb, url, parameters, headers, file_like, cnx=None
):
# The expected signature of encode means that the argument is ignored.
def encode(_):
return headers["Content-Type"], file_like
if not cnx:
cnx = self.__customConnection(url)
return self.__check(
*self.__requestEncode(
cnx, verb, url, parameters, headers, file_like, encode
)
)
def __requestEncode(
self, cnx, verb, url, parameters, requestHeaders, input, encode
):