Skip to content

Commit

Permalink
use fixinventoryclient
Browse files Browse the repository at this point in the history
  • Loading branch information
aquamatthias committed Feb 27, 2024
1 parent 9c49161 commit 9e3592a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion fixcore/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ test = [
"pytest",
"pytest-asyncio",
"pytest-cov",
"fixclient>=1.5.0",
"fixinventoryclient>=2.0.0",
"toml",
"tox",
"types-aiofiles",
Expand Down
29 changes: 16 additions & 13 deletions fixcore/tests/fixcore/web/api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from networkx import MultiDiGraph
from datetime import timedelta
from fixclient import models as rc
from fixclient.async_client import FixClient
from fixclient.async_client import FixInventoryClient
from fixclient.json_utils import json_loadb
from fixclient.models import JsObject
from fixcore.report import ReportCheck, Benchmark
Expand All @@ -38,15 +38,15 @@ def graph_to_json(graph: MultiDiGraph) -> List[rc.JsObject]:
@fixture
async def core_client(
client_session: ClientSession, foo_kinds: List[Kind], db_access: DbAccess
) -> AsyncIterator[FixClient]:
) -> AsyncIterator[FixInventoryClient]:
async with create_core_client(client_session, foo_kinds, db_access, None) as client:
yield client


@fixture
async def core_client_with_psk(
client_session: ClientSession, foo_kinds: List[Kind], db_access: DbAccess
) -> AsyncIterator[FixClient]:
) -> AsyncIterator[FixInventoryClient]:
async with create_core_client(client_session, foo_kinds, db_access, psk="test") as client:
yield client

Expand All @@ -57,7 +57,7 @@ async def create_core_client(
foo_kinds: List[Kind],
db_access: DbAccess,
psk: Optional[str] = None,
) -> AsyncIterator[FixClient]:
) -> AsyncIterator[FixInventoryClient]:
"""
Note: adding this fixture to a test: a complete fixcore process is started.
The fixture ensures that the underlying process has entered the ready state.
Expand Down Expand Up @@ -121,7 +121,7 @@ async def create_core_client(
count -= 1
if count == 0:
raise AssertionError("Process does not came up as expected")
async with FixClient(f"http://localhost:{http_port}", psk=psk) as client:
async with FixInventoryClient(f"http://localhost:{http_port}", psk=psk) as client:
yield client
# terminate the process
process.terminate()
Expand All @@ -138,7 +138,7 @@ async def create_core_client(


@pytest.mark.asyncio
async def test_system_api(core_client: FixClient, client_session: ClientSession) -> None:
async def test_system_api(core_client: FixInventoryClient, client_session: ClientSession) -> None:
assert await core_client.ping() == "pong"
assert await core_client.ready() == "ok"
# make sure we get redirected to the api docs
Expand All @@ -151,7 +151,7 @@ async def test_system_api(core_client: FixClient, client_session: ClientSession)


@pytest.mark.asyncio
async def test_model_api(core_client: FixClient, client_session: ClientSession) -> None:
async def test_model_api(core_client: FixInventoryClient, client_session: ClientSession) -> None:
# GET /model
assert len((await core_client.model()).kinds) >= len(predefined_kinds)

Expand Down Expand Up @@ -179,7 +179,7 @@ async def test_model_api(core_client: FixClient, client_session: ClientSession)


@pytest.mark.asyncio
async def test_graph_api(core_client: FixClient) -> None:
async def test_graph_api(core_client: FixInventoryClient) -> None:
# make sure we have a clean slate
with suppress(Exception):
await core_client.delete_graph(g)
Expand Down Expand Up @@ -324,7 +324,7 @@ async def search_graph_at(


@pytest.mark.asyncio
async def test_subscribers(core_client: FixClient) -> None:
async def test_subscribers(core_client: FixInventoryClient) -> None:
# provide a clean slate
for subscriber in await core_client.subscribers():
await core_client.delete_subscriber(subscriber.id)
Expand Down Expand Up @@ -359,7 +359,7 @@ async def test_subscribers(core_client: FixClient) -> None:


@pytest.mark.asyncio
async def test_cli(core_client: FixClient) -> None:
async def test_cli(core_client: FixInventoryClient) -> None:
# make sure we have a clean slate
with suppress(Exception):
await core_client.delete_graph(g)
Expand Down Expand Up @@ -393,7 +393,7 @@ async def test_cli(core_client: FixClient) -> None:


@pytest.mark.asyncio
async def test_config(core_client: FixClient, foo_kinds: List[rc.Kind]) -> None:
async def test_config(core_client: FixInventoryClient, foo_kinds: List[rc.Kind]) -> None:
# make sure we have a clean slate
async for config in core_client.configs():
await core_client.delete_config(config)
Expand Down Expand Up @@ -475,7 +475,10 @@ async def test_config(core_client: FixClient, foo_kinds: List[rc.Kind]) -> None:

@pytest.mark.asyncio
async def test_report(
core_client: FixClient, client_session: ClientSession, inspection_checks: List[ReportCheck], benchmark: Benchmark
core_client: FixInventoryClient,
client_session: ClientSession,
inspection_checks: List[ReportCheck],
benchmark: Benchmark,
) -> None:
url = core_client.fixcore_url
# get all benchmarks (predefined)
Expand Down Expand Up @@ -530,7 +533,7 @@ async def test_report(


@pytest.mark.asyncio
async def test_authorization(core_client_with_psk: FixClient, client_session: ClientSession) -> None:
async def test_authorization(core_client_with_psk: FixInventoryClient, client_session: ClientSession) -> None:
url = core_client_with_psk.fixcore_url
# make sure all users are deleted
await core_client_with_psk.delete_config("fix.users")
Expand Down
2 changes: 1 addition & 1 deletion fixshell/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies = [
"fixinventorylib==4.0.0a2",
"prompt-toolkit",
"rich",
"fixclient",
"fixinventoryclient",
"aiohttp[speedups]",
]

Expand Down
2 changes: 1 addition & 1 deletion requirements-all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ pyyaml==6.0.1
requests==2.31.0
requests-oauthlib==1.3.1
requests-toolbelt==1.0.0
fixclient==2.0.0
fixinventoryclient==2.0.0
fixinventorydata==0.2.4
fixdatalink[extra]==2.0.0
resotoui==3.7.1
Expand Down
2 changes: 1 addition & 1 deletion requirements-extra.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pyyaml==6.0.1
requests==2.31.0
requests-oauthlib==1.3.1
requests-toolbelt==1.0.0
fixclient==2.0.0
fixinventoryclient==2.0.0
fixinventorydata==0.2.4
fixdatalink[extra]==2.0.0
resotoui==3.7.1
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pyyaml==6.0.1
requests==2.31.0
requests-oauthlib==1.3.1
requests-toolbelt==1.0.0
fixclient==2.0.0
fixinventoryclient==2.0.0
fixinventorydata==0.2.4
fixdatalink==2.0.0
resotoui==3.7.1
Expand Down

0 comments on commit 9e3592a

Please sign in to comment.