:orphan: :py:mod:`oioioi.quizzes.tests` ============================== .. py:module:: oioioi.quizzes.tests Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: oioioi.quizzes.tests.SubmitQuizMixin oioioi.quizzes.tests.TestTextInput oioioi.quizzes.tests.TestSubmission oioioi.quizzes.tests.TestScore oioioi.quizzes.tests.TestScoreRejudgeAfterNewQuestionsAdded oioioi.quizzes.tests.TestSubmissionView oioioi.quizzes.tests.TestEditQuizQuestions oioioi.quizzes.tests.TestQuizBleach oioioi.quizzes.tests.TestPictures oioioi.quizzes.tests.TestQuizProblemView .. py:class:: SubmitQuizMixin Bases: :py:obj:`oioioi.contests.tests.SubmitMixin` .. py:method:: submit_quiz(contest, problem_instance, answers) Submits a quiz with given answer :param contest: in what contest to submit :param problem_instance: indicates which quiz to submit :param answers: dictionary mapping question ids to: 1) answer id 2) list of answer ids if question is multiple choice :return response to the request .. py:class:: TestTextInput(methodName='runTest') Bases: :py:obj:`oioioi.base.tests.TestCase`, :py:obj:`SubmitQuizMixin` Similar to TransactionTestCase, but use `transaction.atomic()` to achieve test isolation. In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior). On database backends with no transaction support, TestCase behaves as TransactionTestCase. .. py:attribute:: fixtures :annotation: = ['test_users', 'test_basic_contest', 'test_problem_instance', 'test_quiz_problem_with_text_input'] .. py:method:: setUp() Hook method for setting up the test fixture before exercising it. .. py:method:: test_simple_submission() .. py:method:: test_second_possible_answer() .. py:method:: test_wrong_answer() .. py:class:: TestSubmission(methodName='runTest') Bases: :py:obj:`oioioi.base.tests.TestCase`, :py:obj:`SubmitQuizMixin` Similar to TransactionTestCase, but use `transaction.atomic()` to achieve test isolation. In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior). On database backends with no transaction support, TestCase behaves as TransactionTestCase. .. py:attribute:: fixtures :annotation: = ['test_users', 'test_basic_contest', 'test_quiz_problem', 'test_quiz_problem_second',... .. py:method:: setUp() Hook method for setting up the test fixture before exercising it. .. py:method:: test_simple_submission() .. py:method:: test_empty_multiple_choice() .. py:method:: test_wrong_id() .. py:method:: test_submission_unanswered_question() .. py:class:: TestScore(methodName='runTest') Bases: :py:obj:`oioioi.base.tests.TestCase` Similar to TransactionTestCase, but use `transaction.atomic()` to achieve test isolation. In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior). On database backends with no transaction support, TestCase behaves as TransactionTestCase. .. py:attribute:: fixtures :annotation: = ['test_users', 'test_contest', 'test_quiz_problem', 'test_quiz_problem_second',... .. py:method:: test_multiple_choice_no_correct_answer_score() .. py:method:: test_all_answers_correct_score() .. py:method:: test_one_answer_incorrect_score() .. py:class:: TestScoreRejudgeAfterNewQuestionsAdded(methodName='runTest') Bases: :py:obj:`TestScore` Similar to TransactionTestCase, but use `transaction.atomic()` to achieve test isolation. In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior). On database backends with no transaction support, TestCase behaves as TransactionTestCase. .. py:method:: setUp() Hook method for setting up the test fixture before exercising it. .. py:method:: test_closed_added_question_no_given_answer_score() .. py:method:: test_open_added_question_no_given_answer_score() .. py:class:: TestSubmissionView(methodName='runTest') Bases: :py:obj:`oioioi.base.tests.TestCase` Similar to TransactionTestCase, but use `transaction.atomic()` to achieve test isolation. In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior). On database backends with no transaction support, TestCase behaves as TransactionTestCase. .. py:attribute:: fixtures :annotation: = ['test_users', 'test_contest', 'test_quiz_problem', 'test_problem_instance', 'test_quiz_submission'] .. py:method:: setUp() Hook method for setting up the test fixture before exercising it. .. py:method:: test_question_report() .. py:method:: test_submission_score_visible() .. py:method:: test_diff_submission_unavailable() .. py:class:: TestEditQuizQuestions(methodName='runTest') Bases: :py:obj:`oioioi.base.tests.TestCase` Similar to TransactionTestCase, but use `transaction.atomic()` to achieve test isolation. In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior). On database backends with no transaction support, TestCase behaves as TransactionTestCase. .. py:attribute:: fixtures :annotation: = ['test_users', 'test_contest', 'test_quiz_problem'] .. py:method:: setUp() Hook method for setting up the test fixture before exercising it. .. py:method:: test_edit_quiz_questions() .. py:class:: TestQuizBleach(methodName='runTest') Bases: :py:obj:`oioioi.base.tests.TestCase` Similar to TransactionTestCase, but use `transaction.atomic()` to achieve test isolation. In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior). On database backends with no transaction support, TestCase behaves as TransactionTestCase. .. py:attribute:: fixtures :annotation: = ['test_users', 'test_basic_contest', 'test_quiz_bleach', 'test_problem_instance'] .. py:method:: setUp() Hook method for setting up the test fixture before exercising it. .. py:method:: test_quizbleach() .. py:class:: TestPictures(methodName='runTest') Bases: :py:obj:`oioioi.base.tests.TestCase` Similar to TransactionTestCase, but use `transaction.atomic()` to achieve test isolation. In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior). On database backends with no transaction support, TestCase behaves as TransactionTestCase. .. py:attribute:: fixtures :annotation: = ['test_users', 'test_basic_contest', 'test_quiz_problem_pictures', 'test_problem_instance'] .. py:method:: setUp() Hook method for setting up the test fixture before exercising it. .. py:method:: test_embedding() .. py:method:: test_invalid_mode() .. py:method:: test_access() .. py:method:: test_download() .. py:class:: TestQuizProblemView(methodName='runTest') Bases: :py:obj:`oioioi.base.tests.TestCase` Similar to TransactionTestCase, but use `transaction.atomic()` to achieve test isolation. In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior). On database backends with no transaction support, TestCase behaves as TransactionTestCase. .. py:attribute:: fixtures :annotation: = ['test_users', 'test_contest', 'test_full_package', 'test_problem_instance',... .. py:attribute:: disabled_quiz_tabs :annotation: = ['Problem statement'] .. py:attribute:: allowed_quiz_tabs :annotation: = ['Secret key', 'Settings'] .. py:method:: test_quiz_tab_visibility() .. py:method:: test_normal_problem_tab_visibility()