Skip to content

Commit

Permalink
Add test for no-pid API update
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Mar 4, 2025
1 parent 86eadc4 commit a5ec163
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/api/api_paper.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
// api_paper.php -- HotCRP paper API call
// Copyright (c) 2008-2024 Eddie Kohler; see LICENSE.
// Copyright (c) 2008-2025 Eddie Kohler; see LICENSE.

class Paper_API extends MessageSet {
/** @var Conf
Expand Down
11 changes: 10 additions & 1 deletion test/t_paperapi.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
// t_paperapi.php -- HotCRP tests
// Copyright (c) 2024 Eddie Kohler; see LICENSE.
// Copyright (c) 2024-2025 Eddie Kohler; see LICENSE.

class PaperAPI_Tester {
/** @var Conf
Expand Down Expand Up @@ -286,6 +286,15 @@ function test_match() {
xassert_eqq($jr->ok, false);
}

function test_no_pid() {
$qreq = $this->make_post_json_qreq(["calories" => 9], ["p" => "1"]);
$jr = call_api("=paper", $this->u_chair, $qreq);
xassert_eqq($jr->ok, true);
xassert_eqq($jr->change_list, ["calories"]);
xassert_eqq($jr->paper->pid, 1);
xassert_eqq($jr->paper->calories, 9);
}

function test_new_paper_after_deadline() {
$this->conf->save_setting("sub_update", Conf::$now - 10);
$this->conf->save_setting("sub_sub", Conf::$now - 10);
Expand Down

0 comments on commit a5ec163

Please sign in to comment.