Skip to content

Commit a8c8900

Browse files
committed
Add test coverage for None content
1 parent eee3546 commit a8c8900

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/test_vws_auth_tools.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,29 @@ def test_authorization_header(content: bytes | str) -> None:
6363
)
6464

6565
assert result == "VWS my_access_key:8Uy6SKuO5sSBY2X8/znlPFmDF/k="
66+
67+
68+
@pytest.mark.parametrize("content", [b"", None])
69+
def test_authorization_header_none_content(content: bytes | None) -> None:
70+
"""
71+
The Authorization header is the same whether the content is None or b"".
72+
"""
73+
access_key = "my_access_key"
74+
# Ignore "Possible hardcoded password" as it is appropriate here.
75+
secret_key = "my_secret_key" # noqa: S105
76+
method = "HTTPMETHOD"
77+
content_type = "some/content/type"
78+
date = "some_date_string"
79+
request_path = "/foo"
80+
81+
result = vws_auth_tools.authorization_header(
82+
access_key=access_key,
83+
secret_key=secret_key,
84+
method=method,
85+
content=content,
86+
content_type=content_type,
87+
date=date,
88+
request_path=request_path,
89+
)
90+
91+
assert result == "VWS my_access_key:XXvKyRyMkwS8/1P1WLQ0duqNpKs="

0 commit comments

Comments
 (0)