Skip to content

Commit 87cbe4e

Browse files
committed
Adjust integration test for printing API
1 parent 0414353 commit 87cbe4e

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

.github/workflows/integration.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ jobs:
4242
run: sudo misc-tools/dj_make_chroot -a amd64
4343
- name: Check nginx
4444
run: curl -v https://localhost/domjudge/
45+
- name: Configure print command
46+
working-directory: submit
47+
run: |
48+
curl --fail -u 'admin:password' -X 'GET' 'http://localhost/domjudge/api/v4/config?strict=false' \
49+
| jq '.print_command |= "cp [file] /tmp/dj-printfile"' \
50+
| curl --fail -u 'admin:password' -X 'PUT' -T - 'http://localhost/domjudge/api/v4/config?strict=false' \
4551
- name: Testing submit client
4652
working-directory: submit
4753
run: make check-full

submit/submit_online.bats

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,12 @@ setup() {
136136
assert_regex "Submission received: id = s[0-9]*, time = [0-9]{2}:[0-9]{2}:[0-9]{2}"
137137
assert_regex "Check http[^ ]*/[0-9]* for the result."
138138
}
139+
140+
@test "submit print job" {
141+
run ./submit -P -l C ../example_problems/hello/submissions/accepted/test-hello.c
142+
assert_success
143+
assert_regex "DOMjudge reported a successful print job."
144+
run diff /tmp/dj-printfile ../example_problems/hello/submissions/accepted/test-hello.c
145+
# Diff has exit code 0 iff the files are equal
146+
assert_success
147+
}

submit/submit_standalone.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ setup() {
4040
@test "display basic usage information" {
4141
run ./submit --help
4242
assert_success
43-
assert_line "usage: submit [--version] [-h] [-c CONTEST] [-p PROBLEM] [-l LANGUAGE] [-e ENTRY_POINT]"
43+
assert_line "usage: submit [--version] [-h] [-c CONTEST] [-P] [-p PROBLEM] [-l LANGUAGE] [-e ENTRY_POINT]"
4444
assert_line " [-v [{DEBUG,INFO,WARNING,ERROR,CRITICAL}]] [-q] [-y] [-u URL]"
4545
# The help printer does print this differently on versions of argparse for nargs=*.
4646
assert_regex " (filename )?[filename ...]"

0 commit comments

Comments
 (0)