示例#1
0
 def test_fail_missing_source_with_language(self):
     # We allow submissions with missing files, as long as we can identify
     # the language.
     self.assertFalse(add_submission(
         self.contest.id, self.user.username, self.task.name, _TS,
         {"source2": self.get_path(_FILENAME_2)}))
     self.assertSubmissionNotInDb(_TS)
示例#2
0
 def test_fail_language_only_in_one(self):
     self.assertFalse(add_submission(
         self.contest.id, self.user.username, self.task.name, _TS, {
             "source1.%l": self.get_path(_FILENAME_1),
             "source2.%l": self.get_path(_FILENAME_2),
          }))
     self.assertSubmissionNotInDb(_TS)
示例#3
0
 def test_fail_no_language_inferrable_missing_extension(self):
     # Task requires a language, but the file we provide does not have
     # an extension defining the language.
     self.assertFalse(add_submission(
         self.contest.id, self.user.username, self.task.name, _TS,
         {"source.%l": self.get_path(_FILENAME_2)}))
     self.assertSubmissionNotInDb(_TS)
示例#4
0
 def test_fail_no_language_inferrable_missing_source(self):
     # Task requires a language, but we don't provide any file that
     # indicate it.
     self.assertFalse(
         add_submission(self.contest.id, self.user.username, self.task.name,
                        _TS, {}))
     self.assertSubmissionNotInDb(_TS)
示例#5
0
 def test_fail_no_language_inferrable_missing_extension(self):
     # Task requires a language, but the file we provide does not have
     # an extension defining the language.
     self.assertFalse(
         add_submission(self.contest.id, self.user.username, self.task.name,
                        _TS, {"source.%l": self.get_path(_FILENAME_2)}))
     self.assertSubmissionNotInDb(_TS)
示例#6
0
 def test_fail_file_not_found(self):
     # We provide a path, but the file does not exist.
     self.assertFalse(
         add_submission(
             self.contest.id, self.user.username, self.task.name, _TS,
             {"source.%l": self.get_path("source_not_existing.c")}))
     self.assertSubmissionNotInDb(_TS)
示例#7
0
 def test_fail_file_not_in_submission_format(self):
     # We provide a file, but for the wrong filename.
     self.assertFalse(
         add_submission(self.contest.id, self.user.username, self.task.name,
                        _TS,
                        {"wrong_source.%l": self.get_path(_FILENAME_1)}))
     self.assertSubmissionNotInDb(_TS)
示例#8
0
 def test_fail_language_only_in_one(self):
     self.assertFalse(add_submission(
         self.contest.id, self.user.username, self.task.name, _TS, {
             "source1.%l": self.get_path(_FILENAME_1),
             "source2.%l": self.get_path(_FILENAME_2),
          }))
     self.assertSubmissionNotInDb(_TS)
示例#9
0
 def test_fail_missing_source_with_language(self):
     # We allow submissions with missing files, as long as we can identify
     # the language.
     self.assertFalse(
         add_submission(self.contest.id, self.user.username, self.task.name,
                        _TS, {"source2": self.get_path(_FILENAME_2)}))
     self.assertSubmissionNotInDb(_TS)
示例#10
0
 def test_fail_inconsistent_language(self):
     # Language for the two files is different.
     self.assertFalse(add_submission(
         self.contest.id, self.user.username, self.task.name, _TS, {
             "source1.%l": self.get_path(_FILENAME_1),
             "source2.%l": self.get_path(_FILENAME_3),
         }))
     self.assertSubmissionNotInDb(_TS)
示例#11
0
 def test_success_missing_source_without_language(self):
     # We allow submissions with missing files, as long as we can identify
     # the language.
     self.assertTrue(add_submission(
         self.contest.id, self.user.username, self.task.name, _TS,
         {"source1.%l": self.get_path(_FILENAME_1)}))
     self.assertSubmissionInDb(_TS, self.task, _LANGUAGE_1,
                               {"source1.%l": _DIGEST_1})
示例#12
0
 def test_success_missing_source_without_language(self):
     # We allow submissions with missing files, as long as we can identify
     # the language.
     self.assertTrue(
         add_submission(self.contest.id, self.user.username, self.task.name,
                        _TS, {"source1.%l": self.get_path(_FILENAME_1)}))
     self.assertSubmissionInDb(_TS, self.task, _LANGUAGE_1,
                               {"source1.%l": _DIGEST_1})
示例#13
0
 def test_fail_inconsistent_language(self):
     # Language for the two files is different.
     self.assertFalse(add_submission(
         self.contest.id, self.user.username, self.task.name, _TS, {
             "source1.%l": self.get_path(_FILENAME_1),
             "source2.%l": self.get_path(_FILENAME_3),
         }))
     self.assertSubmissionNotInDb(_TS)
示例#14
0
 def test_success_many(self):
     self.assertTrue(add_submission(
         self.contest.id, self.user.username, self.task.name, _TS, {
             "source1.%l": self.get_path(_FILENAME_1),
             "source2": self.get_path(_FILENAME_2),
          }))
     self.assertSubmissionInDb(_TS, self.task, _LANGUAGE_1, {
         "source1.%l": _DIGEST_1,
         "source2": _DIGEST_2,
     })
示例#15
0
 def test_success_many(self):
     self.assertTrue(add_submission(
         self.contest.id, self.user.username, self.task.name, _TS, {
             "source1.%l": self.get_path(_FILENAME_1),
             "source2": self.get_path(_FILENAME_2),
          }))
     self.assertSubmissionInDb(_TS, self.task, _LANGUAGE_1, {
         "source1.%l": _DIGEST_1,
         "source2": _DIGEST_2,
     })
示例#16
0
 def test_fail_no_contest(self):
     # We pass a non-existing contest id.
     self.assertFalse(add_submission(
         self.contest.id + 100, self.user.username, self.task.name, _TS,
         {}))
     self.assertSubmissionNotInDb(_TS)
示例#17
0
 def test_fail_task_not_in_contest(self):
     # We pass a contest that does not contain the task.
     self.assertFalse(add_submission(
         self.other_contest.id, self.user.username, self.task.name, _TS,
         {}))
     self.assertSubmissionNotInDb(_TS)
示例#18
0
 def test_fail_no_language_inferrable_missing_source(self):
     # Task requires a language, but we don't provide any file that
     # indicate it.
     self.assertFalse(add_submission(
         self.contest.id, self.user.username, self.task.name, _TS, {}))
     self.assertSubmissionNotInDb(_TS)
示例#19
0
 def test_fail_file_not_found(self):
     # We provide a path, but the file does not exist.
     self.assertFalse(add_submission(
         self.contest.id, self.user.username, self.task.name, _TS,
         {"source.%l": self.get_path("source_not_existing.c")}))
     self.assertSubmissionNotInDb(_TS)
示例#20
0
 def test_fail_task_not_in_contest(self):
     # We pass a contest that does not contain the task.
     self.assertFalse(
         add_submission(self.other_contest.id, self.user.username,
                        self.task.name, _TS, {}))
     self.assertSubmissionNotInDb(_TS)
示例#21
0
 def test_fail_no_contest(self):
     # We pass a non-existing contest id.
     self.assertFalse(
         add_submission(self.contest.id + 100, self.user.username,
                        self.task.name, _TS, {}))
     self.assertSubmissionNotInDb(_TS)
示例#22
0
 def test_fail_no_user(self):
     # We pass a non-existing username.
     self.assertFalse(
         add_submission(self.contest.id, self.user.username + "_wrong",
                        self.task.name, _TS, {}))
     self.assertSubmissionNotInDb(_TS)
示例#23
0
 def test_success_no_source(self):
     # Here we don't provide any file, but language is not required.
     self.assertTrue(add_submission(
         self.contest.id, self.user.username, self.task.name, _TS, {}))
     self.assertSubmissionInDb(_TS, self.task, None, {})
示例#24
0
 def test_fail_no_user(self):
     # We pass a non-existing username.
     self.assertFalse(add_submission(
         self.contest.id, self.user.username + "_wrong", self.task.name,
         _TS, {}))
     self.assertSubmissionNotInDb(_TS)
示例#25
0
 def test_success_no_language(self):
     self.assertTrue(
         add_submission(self.contest.id, self.user.username, self.task.name,
                        _TS, {"source": self.get_path(_FILENAME_2)}))
     self.assertSubmissionInDb(_TS, self.task, None, {"source": _DIGEST_2})
示例#26
0
 def test_fail_file_not_in_submission_format(self):
     # We provide a file, but for the wrong filename.
     self.assertFalse(add_submission(
         self.contest.id, self.user.username, self.task.name, _TS,
         {"wrong_source.%l": self.get_path(_FILENAME_1)}))
     self.assertSubmissionNotInDb(_TS)
示例#27
0
 def test_success_no_source(self):
     # Here we don't provide any file, but language is not required.
     self.assertTrue(
         add_submission(self.contest.id, self.user.username, self.task.name,
                        _TS, {}))
     self.assertSubmissionInDb(_TS, self.task, None, {})
示例#28
0
 def test_success_no_language(self):
     self.assertTrue(add_submission(
         self.contest.id, self.user.username, self.task.name, _TS,
         {"source": self.get_path(_FILENAME_2)}))
     self.assertSubmissionInDb(_TS, self.task, None, {"source": _DIGEST_2})