cic-internal-integration/apps/cic-ussd/tests/cic_ussd/http/test_responses.py
2021-08-06 16:29:01 +00:00

19 lines
683 B
Python

# standard imports
# external imports
import pytest
# local imports
from cic_ussd.http.responses import with_content_headers
# test imports
@pytest.mark.parametrize('headers, response, expected_result',[
([('Content-Type', 'text/plain')], 'some-text', (b'some-text', [('Content-Type', 'text/plain'), ('Content-Length', '9')])),
([('Content-Type', 'text/plain'), ('Content-Length', '0')], 'some-text', (b'some-text', [('Content-Type', 'text/plain'), ('Content-Length', '9')]))
])
def test_with_content_headers(headers, response, expected_result):
response_bytes, headers = with_content_headers(headers, response)
assert response_bytes, headers == expected_result