|
@@ 374-399 (lines=26) @@
|
| 371 |
|
for email in mail.outbox: |
| 372 |
|
self.assertIn("Validation failed", email.subject) |
| 373 |
|
self.assertIn("failed", email.body) |
| 374 |
|
self.assertIn("localhost", email.body) |
| 375 |
|
|
| 376 |
|
def test_broken_validator_feedback(self): |
| 377 |
|
from django.core import mail |
| 378 |
|
|
| 379 |
|
grading = create_pass_fail_grading() |
| 380 |
|
assignment = create_validated_assignment( |
| 381 |
|
self.course, grading, "/submfiles/validation/1000tfm/", "validator.zip") |
| 382 |
|
assignment.save() |
| 383 |
|
sf = create_submission_file("/submfiles/validation/1000tfm/packed.zip") |
| 384 |
|
sub = create_validatable_submission( |
| 385 |
|
self.user, assignment, sf) |
| 386 |
|
test_machine = self._register_executor() |
| 387 |
|
sub.assignment.test_machines.add(test_machine) |
| 388 |
|
|
| 389 |
|
# Fire up the executor |
| 390 |
|
self.assertEqual(False, self._run_executor()) |
| 391 |
|
sub.refresh_from_db() |
| 392 |
|
self.assertEqual(sub.state, Submission.TEST_VALIDITY_FAILED) |
| 393 |
|
text = sub.get_validation_result().result |
| 394 |
|
self.assertIn("Internal error", text) |
| 395 |
|
# Check mail outbox for student information |
| 396 |
|
self.assertEqual(1, len(mail.outbox)) |
| 397 |
|
for email in mail.outbox: |
| 398 |
|
self.assertIn("Validation failed", email.subject) |
| 399 |
|
self.assertIn("failed", email.body) |
| 400 |
|
self.assertIn("localhost", email.body) |
| 401 |
|
|
| 402 |
|
def test_output_logging(self): |
|
@@ 421-443 (lines=23) @@
|
| 418 |
|
self.assertIn("provide your input", text) |
| 419 |
|
|
| 420 |
|
def test_too_long_full_test(self): |
| 421 |
|
grading = create_pass_fail_grading() |
| 422 |
|
assignment = create_validated_assignment( |
| 423 |
|
self.course, |
| 424 |
|
grading, |
| 425 |
|
"/submfiles/validation/d000fff/", |
| 426 |
|
"validator_build.py", |
| 427 |
|
"validator_run.py") |
| 428 |
|
assignment.attachment_test_timeout = 1 |
| 429 |
|
assignment.save() |
| 430 |
|
sf = create_submission_file("/submfiles/validation/d000fff/helloworld.c") |
| 431 |
|
sub = create_validatable_submission( |
| 432 |
|
self.user, assignment, sf) |
| 433 |
|
test_machine = self._register_executor() |
| 434 |
|
sub.assignment.test_machines.add(test_machine) |
| 435 |
|
|
| 436 |
|
# Fire up the executor for validation |
| 437 |
|
self.assertEqual(True, self._run_executor()) |
| 438 |
|
# Fire up the executor for full test |
| 439 |
|
self.assertEqual(True, self._run_executor()) |
| 440 |
|
# Check if timeout marking took place |
| 441 |
|
sub.refresh_from_db() |
| 442 |
|
self.assertEqual(sub.state, Submission.TEST_FULL_FAILED) |
| 443 |
|
assert("timeout" in sub.get_fulltest_result().result_tutor) |
| 444 |
|
# Failed full tests shall not be reported |
| 445 |
|
self.assertEqual(0, len(mail.outbox)) |
| 446 |
|
|
|
@@ 356-372 (lines=17) @@
|
| 353 |
|
self.course, grading, "/submfiles/validation/d000fff/", "validator_run.py") |
| 354 |
|
assignment.attachment_test_timeout = 1 |
| 355 |
|
assignment.save() |
| 356 |
|
sf = create_submission_file("/submfiles/validation/d000fff/helloworld.c") |
| 357 |
|
sub = create_validatable_submission( |
| 358 |
|
self.user, assignment, sf) |
| 359 |
|
test_machine = self._register_executor() |
| 360 |
|
sub.assignment.test_machines.add(test_machine) |
| 361 |
|
|
| 362 |
|
# Fire up the executor, should mark the submission as timed out |
| 363 |
|
self.assertEqual(True, self._run_executor()) |
| 364 |
|
# Check if timeout marking took place |
| 365 |
|
sub.refresh_from_db() |
| 366 |
|
self.assertEqual(sub.state, Submission.TEST_VALIDITY_FAILED) |
| 367 |
|
text = sub.get_validation_result().result |
| 368 |
|
self.assertIn("took too long", text) |
| 369 |
|
# Check mail outbox for student information |
| 370 |
|
self.assertEqual(1, len(mail.outbox)) |
| 371 |
|
for email in mail.outbox: |
| 372 |
|
self.assertIn("Validation failed", email.subject) |
| 373 |
|
self.assertIn("failed", email.body) |
| 374 |
|
self.assertIn("localhost", email.body) |
| 375 |
|
|