DevPlace CI / test (push) Failing after 28m20s
Also streamline the top navigation: drop the Tools dropdown, make Quizzes and Battles icon-only entries, and remove the Workspace, Containers and Editor entry points from the project detail page.
37 lines
1.0 KiB
Python
37 lines
1.0 KiB
Python
from devplacepy.docs_api import field, endpoint
|
|
|
|
|
|
def test_field_defaults_nullable_false():
|
|
spec = field("username", "path", "string", True, "alice", "A username.")
|
|
assert spec["nullable"] is False
|
|
|
|
|
|
def test_field_nullable_true_is_threaded_into_spec():
|
|
spec = field(
|
|
"avatar_seed",
|
|
"response",
|
|
"string",
|
|
description="Null falls back to the username.",
|
|
nullable=True,
|
|
)
|
|
assert spec["nullable"] is True
|
|
assert spec["location"] == "response"
|
|
|
|
|
|
def test_endpoint_carries_response_field_specs_in_params():
|
|
ep = endpoint(
|
|
id="example",
|
|
method="GET",
|
|
path="/example",
|
|
title="Example",
|
|
summary="An example endpoint.",
|
|
auth="public",
|
|
params=[
|
|
field("uid", "response", "string", nullable=False),
|
|
field("bio", "response", "string", nullable=True),
|
|
],
|
|
)
|
|
by_name = {p["name"]: p for p in ep["params"]}
|
|
assert by_name["uid"]["nullable"] is False
|
|
assert by_name["bio"]["nullable"] is True
|