Skip to content

Commit a28cca9

Browse files
committed
add test for bearer token auth varaiants
1 parent f9e10f1 commit a28cca9

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

tests/test_auth.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def test_basic_auth():
2626
flow.send(response)
2727

2828

29-
def test_bearer_token_auth():
30-
auth = httpx.BearerTokenAuth(bearer_token="my_token")
29+
def test_bearer_token_auth_header():
30+
auth = httpx.BearerTokenAuth(bearer_token="secret")
3131
request = httpx.Request("GET", "https://www.example.com")
3232

3333
# The initial request should include a bearer token auth header.
@@ -41,6 +41,22 @@ def test_bearer_token_auth():
4141
flow.send(response)
4242

4343

44+
def test_bearer_token_auth_form_encoded():
45+
with pytest.raises(
46+
NotImplementedError,
47+
):
48+
auth = httpx.BearerTokenAuth(bearer_token="secret", variant="FORM-ENCODED")
49+
assert auth # pragma: no cover
50+
51+
52+
def test_bearer_token_auth_query():
53+
with pytest.raises(
54+
NotImplementedError,
55+
):
56+
auth = httpx.BearerTokenAuth(bearer_token="secret", variant="QUERY")
57+
assert auth # pragma: no cover
58+
59+
4460
def test_digest_auth_with_200():
4561
auth = httpx.DigestAuth(username="user", password="pass")
4662
request = httpx.Request("GET", "https://www.example.com")

0 commit comments

Comments
 (0)