|
@@ 348-374 (lines=27) @@
|
| 345 |
|
self.assertEqual(NUM_PARALLEL, len(results)) |
| 346 |
|
self.assertNotEqual(0, len(results[0].result)) |
| 347 |
|
|
| 348 |
|
def test_too_long_validation(self): |
| 349 |
|
from django.core import mail |
| 350 |
|
|
| 351 |
|
grading = create_pass_fail_grading() |
| 352 |
|
assignment = create_validated_assignment( |
| 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 |
|
|
| 376 |
|
def test_broken_validator_feedback(self): |
| 377 |
|
from django.core import mail |
|
@@ 376-400 (lines=25) @@
|
| 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): |
| 403 |
|
grading = create_pass_fail_grading() |