diff options
| author | Nejc Habjan <nejc.habjan@siemens.com> | 2023-03-12 17:28:15 +0100 |
|---|---|---|
| committer | John Villalovos <john@sodarock.com> | 2023-03-12 10:09:58 -0700 |
| commit | 76063c386ef9caf84ba866515cb053f6129714d9 (patch) | |
| tree | 81f537fba41cbea21ffa69de3c32d581d1e0256d /tests/unit/test_utils.py | |
| parent | 90f96acf9e649de9874cec612fc1b49c4a843447 (diff) | |
| download | gitlab-76063c386ef9caf84ba866515cb053f6129714d9.tar.gz | |
fix(client): properly parse content-type when charset is present
Diffstat (limited to 'tests/unit/test_utils.py')
| -rw-r--r-- | tests/unit/test_utils.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 7f75f55..60a10e0 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -8,6 +8,20 @@ import responses from gitlab import types, utils +@pytest.mark.parametrize( + "content_type,expected_type", + [ + ("application/json", "application/json"), + ("application/json; charset=utf-8", "application/json"), + ("", "text/plain"), + (None, "text/plain"), + ], +) +def test_get_content_type(content_type, expected_type): + parsed_type = utils.get_content_type(content_type) + assert parsed_type == expected_type + + @responses.activate def test_response_content(capsys): responses.add( |
