Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
ServerState,
)
from pydantic import Field, IPvAnyAddress
from pydantic_extra_types.country import CountryAlpha2
from starlette.concurrency import run_in_threadpool

from ...common.anonymous_credentials import VerificationStatus
Expand Down Expand Up @@ -239,13 +240,13 @@ def probe_update_post(probe_update: ProbeUpdate) -> ProbeUpdateResponse:


class CheckIn(BaseModel):
run_type: str = "timed"
probe_cc: str = "ZZ"
probe_asn: str = "AS0"
on_wifi: bool = False
charging: bool = False
software_name: str = ""
software_version: str = ""
run_type: str = Field("timed")
charging: bool = Field(False)
probe_cc: CountryAlpha2 = Field("ZZ")
probe_asn: str = Field("AS0")
on_wifi: bool = Field(False)
software_name: str = Field("")
software_version: str = Field("")
web_connectivity: Optional[Dict[str, Any]] = None


Expand Down
13 changes: 13 additions & 0 deletions ooniapi/services/ooniprobe/tests/integ/test_checkin.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ async def test_check_in_geoip(client):
assert c["probe_network_name"] is not None


@pytest.mark.asyncio
async def test_check_in_invalid_probe_cc(client):
j = dict(
probe_cc="Z0", # invalid country-code
probe_asn="AS1234",
on_wifi=True,
charging=False,
)
r = client.post("/api/v1/check-in", json=j)

assert r.status_code == 422 # model validation error


@pytest.mark.asyncio
async def test_check_in_basic(client, load_url_priorities):
j = dict(
Expand Down
Loading