mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-10 16:04:04 +00:00
fix(multiplayer): validate proposal expiry
This commit is contained in:
@@ -175,7 +175,7 @@ func test_rest_responses_reject_malformed_resource_identifiers() -> void:
|
||||
|
||||
|
||||
func test_proposal_response_requires_structured_unique_participants() -> void:
|
||||
var base := {"proposal_id": "proposal_1234567890", "participants": [
|
||||
var base := {"proposal_id": "proposal_1234567890", "expires_at": "2099-08-31T12:00:00Z", "participants": [
|
||||
{"player_id": "player_1234567890", "response": "PENDING", "team": 0, "slot": 0},
|
||||
{"player_id": "player_1234567891", "response": "PENDING", "team": 1, "slot": 3}
|
||||
]}
|
||||
@@ -186,6 +186,13 @@ func test_proposal_response_requires_structured_unique_participants() -> void:
|
||||
var fractional_slot := base.duplicate(true)
|
||||
fractional_slot["participants"][0]["slot"] = 0.5
|
||||
assert_true(not ControlPlaneClient._valid_proposal_response(fractional_slot), "fractional participant slot is rejected")
|
||||
var malformed_expiry := base.duplicate(true)
|
||||
malformed_expiry["expires_at"] = "tomorrow"
|
||||
assert_true(not ControlPlaneClient._valid_proposal_response(malformed_expiry), "malformed proposal expiry is rejected")
|
||||
var missing_expiry := base.duplicate(true)
|
||||
missing_expiry.erase("expires_at")
|
||||
assert_true(not ControlPlaneClient._valid_proposal_response(missing_expiry), "missing proposal expiry is rejected")
|
||||
assert_true(int(ControlPlaneClient.normalize_proposal(base)["expires_at_unix"]) > 0, "proposal expiry is normalized")
|
||||
|
||||
|
||||
func test_assignment_endpoint_split_never_accepts_url_or_bad_port() -> void:
|
||||
|
||||
Reference in New Issue
Block a user