Skip to content

Commit

Permalink
Auth tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mediuminvader committed Apr 12, 2023
1 parent 88789f3 commit 0bbe8b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

from time import sleep

from pydozer.auth import AuthClient
from pydozer.api import ApiClient
from pydozer.ingest import IngestClient

import pytest


Expand Down Expand Up @@ -32,7 +34,13 @@ def dozer_server():

@pytest.fixture
def api_client() -> ApiClient:
return ApiClient("users", url=DOZER_API_URL)
master_token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJjYWNoZV91c2VyIiwic3ViIjoiYXBpQGRvemVyLmNvbSIsImV4cCI6MTY4MTI4NzcwNDAyNywiYWNjZXNzIjoiQWxsIn0.aD5L6XURIr3hrUp0LzfUQWKHairjK6DDkMlzvnVvzHA'

client = AuthClient(token=master_token, url=DOZER_API_URL)

restricted_token = client.get_auth_token()

return ApiClient("users", url=DOZER_API_URL, token=restricted_token)


@pytest.fixture
Expand Down
3 changes: 2 additions & 1 deletion tests/test_dozer.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,5 @@ def test_ingest_query(ingestion_client: IngestClient, api_client: ApiClient):

res = api_client.query({'$limit': 1})
assert res is not None
assert len(res.records) >= 1
assert len(res.records) >= 1

0 comments on commit 0bbe8b1

Please sign in to comment.