test: refactor MockClient state fields into a dataclass
This commit is contained in:
@@ -1,12 +1,14 @@
|
|||||||
|
from dataclasses import dataclass, field
|
||||||
|
|
||||||
from auditui.library import LibraryClient
|
from auditui.library import LibraryClient
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True)
|
||||||
class MockClient:
|
class MockClient:
|
||||||
def __init__(self) -> None:
|
put_calls: list[tuple[str, dict]] = field(default_factory=list)
|
||||||
self.put_calls: list[tuple[str, dict]] = []
|
post_calls: list[tuple[str, dict]] = field(default_factory=list)
|
||||||
self.post_calls: list[tuple[str, dict]] = []
|
_post_response: dict = field(default_factory=dict)
|
||||||
self._post_response: dict = {}
|
raise_on_put: bool = False
|
||||||
self.raise_on_put = False
|
|
||||||
|
|
||||||
def put(self, path: str, body: dict) -> dict:
|
def put(self, path: str, body: dict) -> dict:
|
||||||
if self.raise_on_put:
|
if self.raise_on_put:
|
||||||
|
|||||||
Reference in New Issue
Block a user