Skip to content

Commit

Permalink
tokens tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pcrespov committed Dec 11, 2024
1 parent d3a221d commit 35e3ff2
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@

import random
from collections.abc import AsyncIterator
from copy import deepcopy
from http import HTTPStatus
from itertools import repeat
from uuid import UUID

import pytest
from aiohttp.test_utils import TestClient
Expand Down Expand Up @@ -145,16 +147,18 @@ async def test_read_token(
data, error = await assert_status(resp, expected)

if not error:
expected_token = random.choice(fake_tokens)
expected_token = deepcopy(random.choice(fake_tokens))
sid = expected_token["service"]

# get one
url = client.app.router["get_token"].url_for(service=sid)
assert "/v0/me/tokens/%s" % sid == str(url)
assert f"/v0/me/tokens/{sid}" == str(url)
resp = await client.get(url.path)

data, error = await assert_status(resp, expected)

expected_token["token_key"] = f'{UUID(expected_token["token_key"])}'
expected_token["token_secret"] = None
assert data == expected_token, "list and read item are both read operations"


Expand Down

0 comments on commit 35e3ff2

Please sign in to comment.