Updated integration tests to not require exact match
This matches how we want clients to behave, they should ignore any extra fields that are sent in the response.
This commit is contained in:
9
tests_integration/tests/vendor/test_find.py
vendored
9
tests_integration/tests/vendor/test_find.py
vendored
@@ -7,14 +7,11 @@ from typing import Any
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from ..conftest import assert_lists_compatible
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
|
||||
|
||||
def vendor_lists_equal(a: Iterable[dict[str, Any]], b: Iterable[dict[str, Any]]) -> bool:
|
||||
"""Compare two lists of vendors where the order of the vendors is not guaranteed."""
|
||||
return sorted(a, key=lambda x: x["id"]) == sorted(b, key=lambda x: x["id"])
|
||||
|
||||
|
||||
@dataclass
|
||||
class Fixture:
|
||||
vendors: list[dict[str, Any]]
|
||||
@@ -62,7 +59,7 @@ def test_find_all_vendors(vendors: Fixture):
|
||||
|
||||
# Verify
|
||||
vendors_result = result.json()
|
||||
assert vendor_lists_equal(vendors_result, vendors.vendors)
|
||||
assert_lists_compatible(vendors_result, vendors.vendors)
|
||||
|
||||
|
||||
def test_find_all_vendors_sort_asc(vendors: Fixture):
|
||||
|
||||
Reference in New Issue
Block a user