File: test_http_headers.py

package info (click to toggle)
todoist-api-python 3.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 520 kB
  • sloc: python: 3,822; makefile: 3
file content (25 lines) | stat: -rw-r--r-- 718 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from __future__ import annotations

from todoist_api_python._core.http_headers import create_headers


def test_create_headers_default() -> None:
    headers = create_headers()
    assert headers == {}


def test_create_headers_authorization() -> None:
    token = "A Token"
    headers = create_headers(token=token)
    assert headers["Authorization"] == f"Bearer {token}"


def test_create_headers_content_type() -> None:
    headers = create_headers(with_content=True)
    assert headers["Content-Type"] == "application/json; charset=utf-8"


def test_create_headers_request_id() -> None:
    request_id = "12345"
    headers = create_headers(request_id=request_id)
    assert headers["X-Request-Id"] == request_id