Skip to content

Commit 93342d6

Browse files
committed
test: rename standby_build to server_build in server client tests
1 parent 791be85 commit 93342d6

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

‎tests/unit/test_actor_server.py‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -557,9 +557,9 @@ def handler(request: Request) -> Response:
557557

558558

559559
def expect_server_actor_with_build(
560-
httpserver: HTTPServer, *, standby_build: str | None, build_id: str, actor_definition: dict[str, Any] | None
560+
httpserver: HTTPServer, *, server_build: str | None, build_id: str, actor_definition: dict[str, Any] | None
561561
) -> None:
562-
actor_standby = {'isEnabled': True, 'build': standby_build}
562+
actor_standby = {'isEnabled': True, 'build': server_build}
563563
httpserver.expect_request(_ACTOR_PATH, method='GET').respond_with_json(
564564
actor_response(httpserver.url_for(_SERVER_PREFIX), taggedBuilds=_TAGGED_BUILDS, actorStandby=actor_standby)
565565
)
@@ -569,18 +569,18 @@ def expect_server_actor_with_build(
569569

570570

571571
@pytest.mark.parametrize(
572-
('standby_build', 'build_id'),
572+
('server_build', 'build_id'),
573573
[
574574
pytest.param(None, 'latest_build_id', id='no build set uses latest'),
575575
pytest.param('beta', 'beta_build_id', id='build tag'),
576576
],
577577
)
578578
def test_get_openapi_spec_from_tagged_build(
579-
httpserver: HTTPServer, sync_client: ApifyClient, standby_build: str | None, build_id: str
579+
httpserver: HTTPServer, sync_client: ApifyClient, server_build: str | None, build_id: str
580580
) -> None:
581581
"""The specification comes from the web server schema of the tagged build that serves the server interface."""
582582
expect_server_actor_with_build(
583-
httpserver, standby_build=standby_build, build_id=build_id, actor_definition={'webServerSchema': _OPENAPI_SPEC}
583+
httpserver, server_build=server_build, build_id=build_id, actor_definition={'webServerSchema': _OPENAPI_SPEC}
584584
)
585585

586586
assert sync_client.actor(_MOCKED_ACTOR_ID).server().get_openapi_spec() == _OPENAPI_SPEC
@@ -589,7 +589,7 @@ def test_get_openapi_spec_from_tagged_build(
589589
async def test_get_openapi_spec_from_tagged_build_async(httpserver: HTTPServer, async_client: ApifyClientAsync) -> None:
590590
"""Async variant of `test_get_openapi_spec_from_tagged_build`."""
591591
expect_server_actor_with_build(
592-
httpserver, standby_build='beta', build_id='beta_build_id', actor_definition={'webServerSchema': _OPENAPI_SPEC}
592+
httpserver, server_build='beta', build_id='beta_build_id', actor_definition={'webServerSchema': _OPENAPI_SPEC}
593593
)
594594

595595
assert await async_client.actor(_MOCKED_ACTOR_ID).server().get_openapi_spec() == _OPENAPI_SPEC
@@ -598,7 +598,7 @@ async def test_get_openapi_spec_from_tagged_build_async(httpserver: HTTPServer,
598598
def test_get_openapi_spec_from_build_number(httpserver: HTTPServer, sync_client: ApifyClient) -> None:
599599
"""A build number set for the server interface is looked up in the Actor's builds."""
600600
expect_server_actor_with_build(
601-
httpserver, standby_build='0.0.1', build_id='old_build_id', actor_definition={'webServerSchema': _OPENAPI_SPEC}
601+
httpserver, server_build='0.0.1', build_id='old_build_id', actor_definition={'webServerSchema': _OPENAPI_SPEC}
602602
)
603603
expect_builds_list(httpserver, {'latest_build_id': '0.0.2', 'old_build_id': '0.0.1'})
604604

@@ -610,7 +610,7 @@ def test_get_openapi_spec_passes_timeout_to_every_api_call(
610610
) -> None:
611611
"""The timeout of `get_openapi_spec` applies to fetching the Actor, listing its builds, and fetching the build."""
612612
expect_server_actor_with_build(
613-
httpserver, standby_build='0.0.1', build_id='old_build_id', actor_definition={'webServerSchema': _OPENAPI_SPEC}
613+
httpserver, server_build='0.0.1', build_id='old_build_id', actor_definition={'webServerSchema': _OPENAPI_SPEC}
614614
)
615615
expect_builds_list(httpserver, {'old_build_id': '0.0.1'})
616616
call = Mock(wraps=sync_client.http_client.call)
@@ -626,7 +626,7 @@ def test_request_reuses_server_url_fetched_by_get_openapi_spec(
626626
) -> None:
627627
"""A request after `get_openapi_spec` reuses the server URL it fetched."""
628628
expect_server_actor_with_build(
629-
httpserver, standby_build=None, build_id='latest_build_id', actor_definition={'webServerSchema': _OPENAPI_SPEC}
629+
httpserver, server_build=None, build_id='latest_build_id', actor_definition={'webServerSchema': _OPENAPI_SPEC}
630630
)
631631
httpserver.expect_request(f'{_SERVER_PREFIX}/', method='GET').respond_with_json({'ok': True})
632632
actor_server_client = sync_client.actor(_MOCKED_ACTOR_ID).server()
@@ -654,7 +654,7 @@ def test_get_url_passes_timeout(
654654
async def test_get_openapi_spec_from_build_number_async(httpserver: HTTPServer, async_client: ApifyClientAsync) -> None:
655655
"""Async variant of `test_get_openapi_spec_from_build_number`."""
656656
expect_server_actor_with_build(
657-
httpserver, standby_build='0.0.1', build_id='old_build_id', actor_definition={'webServerSchema': _OPENAPI_SPEC}
657+
httpserver, server_build='0.0.1', build_id='old_build_id', actor_definition={'webServerSchema': _OPENAPI_SPEC}
658658
)
659659
expect_builds_list(httpserver, {'latest_build_id': '0.0.2', 'old_build_id': '0.0.1'})
660660

@@ -673,15 +673,15 @@ def test_get_openapi_spec_without_schema_returns_none(
673673
) -> None:
674674
"""A build without a web server schema has no specification to return."""
675675
expect_server_actor_with_build(
676-
httpserver, standby_build=None, build_id='latest_build_id', actor_definition=actor_definition
676+
httpserver, server_build=None, build_id='latest_build_id', actor_definition=actor_definition
677677
)
678678

679679
assert sync_client.actor(_MOCKED_ACTOR_ID).server().get_openapi_spec() is None
680680

681681

682682
def test_get_openapi_spec_unknown_build_raises(httpserver: HTTPServer, sync_client: ApifyClient) -> None:
683683
"""A server interface build that is neither a tag nor a listed build number raises an error."""
684-
expect_server_actor_with_build(httpserver, standby_build='9.9.9', build_id='unused_build_id', actor_definition=None)
684+
expect_server_actor_with_build(httpserver, server_build='9.9.9', build_id='unused_build_id', actor_definition=None)
685685
expect_builds_list(httpserver, {'latest_build_id': '0.0.2'})
686686

687687
with pytest.raises(ApifyClientError, match='does not exist'):
@@ -704,7 +704,7 @@ def one_build_per_page(request: Request) -> Response:
704704
return Response(json.dumps({'data': data}), content_type='application/json')
705705

706706
handler = Mock(side_effect=one_build_per_page)
707-
expect_server_actor_with_build(httpserver, standby_build='0.0.4', build_id='unused_build_id', actor_definition=None)
707+
expect_server_actor_with_build(httpserver, server_build='0.0.4', build_id='unused_build_id', actor_definition=None)
708708
httpserver.expect_request(f'{_ACTOR_PATH}/builds', method='GET').respond_with_handler(handler)
709709

710710
with pytest.raises(ApifyClientError, match='does not exist'):
@@ -718,7 +718,7 @@ def test_get_openapi_spec_unknown_tag_raises_without_listing_builds(
718718
) -> None:
719719
"""A server interface build that is neither a tag nor a build number raises without listing the builds."""
720720
expect_server_actor_with_build(
721-
httpserver, standby_build='nightly', build_id='unused_build_id', actor_definition=None
721+
httpserver, server_build='nightly', build_id='unused_build_id', actor_definition=None
722722
)
723723

724724
with pytest.raises(ApifyClientError, match='Build nightly of Actor'):

0 commit comments

Comments
 (0)