Skip to content

Commit 81d7588

Browse files
test token method
1 parent e0c094c commit 81d7588

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/test_do_token.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import os
2+
import pytest
3+
4+
from carto.do_token import DoTokenManager
5+
6+
7+
@pytest.fixture(scope="module")
8+
def do_token_manager(api_key_auth_client):
9+
"""
10+
Returns a do token manager that can be reused in tests
11+
:param api_key_auth_client: Fixture that provides a valid
12+
APIKeyAuthClient object
13+
:return: DoTokenManager instance
14+
"""
15+
return DoTokenManager(api_key_auth_client)
16+
17+
18+
@pytest.mark.skipif("TRAVIS" in os.environ and os.environ["TRAVIS"] == "true",
19+
reason="Integration tests not executed in Travis")
20+
def test_get_token(do_token_manager):
21+
"""
22+
Get all the datasets from the API
23+
:param do_token_manager: Fixture that provides a do token manager to work with
24+
"""
25+
token = do_token_manager.get()
26+
27+
assert token is not None
28+
assert token.access_token is not None
29+
assert isinstance(token.access_token, str)
30+
assert len(token.access_token) > 0

0 commit comments

Comments
 (0)