Rebrand the Rust client crate (coven/ → hh/, package+binary "hack-house"), README, CLI strings, and branch (coven → hack-house). Gitea repo renamed cmd-chat → hack-house to match. Crypto/server logic unchanged; selftest + golden-vector test still green, binary is now `hack-house`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
57 lines
1.3 KiB
Python
57 lines
1.3 KiB
Python
from typing import Optional
|
|
|
|
import pytest
|
|
|
|
from sanic_ext.extensions.openapi.definitions import Server
|
|
from sanic_ext.extensions.openapi.types import Definition
|
|
|
|
|
|
@pytest.fixture
|
|
def Thing():
|
|
class Thing(Definition):
|
|
name: str
|
|
foo: Optional[bool]
|
|
bar: Optional[bool]
|
|
|
|
def __init__(self, name, foo=None, bar=None):
|
|
super().__init__(name=name, foo=foo, bar=bar)
|
|
|
|
return Thing
|
|
|
|
|
|
def test_serialize_null_show_by_default(Thing):
|
|
thing = Thing(name="ok")
|
|
serialized = thing.serialize()
|
|
|
|
assert serialized["name"] == "ok"
|
|
assert serialized["foo"] is None
|
|
assert serialized["bar"] is None
|
|
|
|
|
|
def test_serialize_some_nullable(Thing):
|
|
Thing.__nullable__ = ["foo"]
|
|
thing = Thing(name="ok")
|
|
serialized = thing.serialize()
|
|
|
|
assert serialized["name"] == "ok"
|
|
assert serialized["foo"] is None
|
|
assert "bar" not in serialized
|
|
|
|
|
|
def test_serialize_no_nullable(Thing):
|
|
Thing.__nullable__ = False
|
|
thing = Thing(name="ok")
|
|
serialized = thing.serialize()
|
|
|
|
assert serialized["name"] == "ok"
|
|
assert "foo" not in serialized
|
|
assert "bar" not in serialized
|
|
|
|
|
|
def test_server_definitions_defaults():
|
|
assert Server(url="url").fields == {
|
|
"url": "url",
|
|
"description": None,
|
|
"variables": {},
|
|
}
|