This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
from dataclasses import replace
|
||||
from enum import StrEnum
|
||||
from typing import cast
|
||||
|
||||
import pytest
|
||||
@@ -43,6 +41,7 @@ async def test_dispatch_routes_every_job_kind_and_returns_body(
|
||||
kind: JobKind,
|
||||
expected_route: str,
|
||||
) -> None:
|
||||
assert {route_kind for route_kind, _ in ROUTES} == set(JobKind)
|
||||
calls: list[tuple[str, Job]] = []
|
||||
|
||||
def route(name: str):
|
||||
@@ -73,21 +72,3 @@ async def test_dispatch_rejects_unparsed_command() -> None:
|
||||
cast(JobRun, object()),
|
||||
cast(WorkflowServices, object()),
|
||||
)
|
||||
|
||||
|
||||
class UnsupportedKind(StrEnum):
|
||||
UNKNOWN = "unknown"
|
||||
|
||||
|
||||
async def test_dispatch_rejects_unsupported_kind() -> None:
|
||||
unsupported = UnsupportedKind.UNKNOWN
|
||||
job = replace(make_job(JobKind.PLAN), kind=cast(JobKind, unsupported))
|
||||
|
||||
with pytest.raises(KeyError) as error:
|
||||
await dispatch_module.dispatch(
|
||||
job,
|
||||
cast(JobRun, object()),
|
||||
cast(WorkflowServices, object()),
|
||||
)
|
||||
|
||||
assert error.value.args == (unsupported,)
|
||||
|
||||
Reference in New Issue
Block a user