Skip to content

Commit

Permalink
Merge pull request #2225 from freedomofpress/fix-regenerate-sdk-casse…
Browse files Browse the repository at this point in the history
…ttes

fix(`test_download_submission_autoresume`): don't hard-code mock's `Content-Length` header
  • Loading branch information
legoktm committed Sep 17, 2024
2 parents 75b5252 + 2287d66 commit 36671f2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions client/tests/sdk/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ def fileno(self):
return 1

class StubbedStderr:
def __init__(self):
def __init__(self, content_length):
self.content_length = content_length
self.closed = False

def read(self, n=-1):
Expand All @@ -243,7 +244,7 @@ def read(self, n=-1):
"content-type": "application/pgp-encrypted",
"etag": "sha256:3aa5ec3fe60b235a76bfc2c3a5c5d525687f04c1670060632a21b6a77c131f65", # noqa: E501
"content-disposition": "attachment; filename=3-assessable_firmness-doc.gz.gpg", # noqa: E501
"content-length": "651",
"content-length": self.content_length,
"accept-ranges": "bytes",
}
}
Expand All @@ -264,7 +265,7 @@ def __init__(self, *args, content="", **kwargs):
if "securedrop.Proxy" in cmd or "securedrop-proxy" in cmd:
self._is_securedrop_proxy = True
self.stdout = StubbedStdout()
self.stderr = StubbedStderr()
self.stderr = StubbedStderr(len(content))
else:
self._is_securedrop_proxy = False

Expand Down

0 comments on commit 36671f2

Please sign in to comment.