:orphan: :py:mod:`oioioi.programs.tests` =============================== .. py:module:: oioioi.programs.tests Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: oioioi.programs.tests.SubmitFileMixin oioioi.programs.tests.TestProgrammingProblemController oioioi.programs.tests.TestProgrammingContestController oioioi.programs.tests.TestProgramsViews oioioi.programs.tests.TestSourceWithoutContest oioioi.programs.tests.TestHeaderLinks oioioi.programs.tests.TestProgramsXssViews oioioi.programs.tests.TestOtherSubmissions oioioi.programs.tests.TestNoOtherSubmissions oioioi.programs.tests.TestDiffView oioioi.programs.tests.TestSubmission oioioi.programs.tests.TestSubmissionAdmin oioioi.programs.tests.TestSubmittingAsAdmin oioioi.programs.tests.PrivateProgrammingContestController oioioi.programs.tests.TestSubmittingAsContestAdmin oioioi.programs.tests.TestSubmittingAsObserver oioioi.programs.tests.TestNotifications oioioi.programs.tests.TestScorers oioioi.programs.tests.TestUserOutsGenerating oioioi.programs.tests.TestAdminInOutDownload oioioi.programs.tests.ContestWithJudgeInfoController oioioi.programs.tests.TestRejudge oioioi.programs.tests.TestLimitsLimits oioioi.programs.tests.TestCompiler oioioi.programs.tests.TestMaxScoreMigration oioioi.programs.tests.TestReportDisplayTypes oioioi.programs.tests.TestAllowedLanguages oioioi.programs.tests.TestLanguageOverrideForTest Functions ~~~~~~~~~ .. autoapisummary:: oioioi.programs.tests.extract_code oioioi.programs.tests.extract_code_from_diff .. py:function:: extract_code(show_response) .. py:function:: extract_code_from_diff(show_response) .. py:class:: SubmitFileMixin Bases: :py:obj:`oioioi.contests.tests.SubmitMixin` .. py:method:: submit_file(contest, problem_instance, file_size=1024, file_name='submission.cpp', kind='NORMAL', user=None) .. py:method:: submit_code(contest, problem_instance, code='', prog_lang='C', send_file=False, kind='NORMAL', user=None) .. py:class:: TestProgrammingProblemController(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:method:: test_safe_exec_mode() .. py:class:: TestProgrammingContestController(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:method:: test_safe_exec_mode() .. py:class:: TestProgramsViews(methodName='runTest') Bases: :py:obj:`oioioi.base.tests.TestCase`, :py:obj:`oioioi.filetracker.tests.TestStreamingMixin` 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', 'test_permissions',... .. py:method:: test_submission_views() .. py:method:: test_test_views() .. py:method:: test_submissions_permissions() .. py:method:: test_model_solutions_view() .. py:class:: TestSourceWithoutContest(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_problem_instance_without_contest', 'test_submission_source', 'test_full_package'] .. py:method:: test_source_permissions() .. py:class:: TestHeaderLinks(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', 'test_submission'] .. py:method:: test_link_to_changelist_visibility() .. py:class:: TestProgramsXssViews(methodName='runTest') Bases: :py:obj:`oioioi.base.tests.TestCase`, :py:obj:`oioioi.filetracker.tests.TestStreamingMixin` 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', 'test_submission_xss'] .. py:method:: test_submission_xss_views() .. py:class:: TestOtherSubmissions(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', 'test_submission',... .. py:method:: _test_get(username) .. py:method:: test_admin() .. py:method:: test_user() .. py:class:: TestNoOtherSubmissions(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', 'test_submission'] .. py:method:: _test_get(username) .. py:method:: test_admin() .. py:method:: test_user() .. py:class:: TestDiffView(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', 'test_submission',... .. py:method:: test_saving_button() .. py:method:: test_diff_view() .. py:class:: TestSubmission(methodName='runTest') Bases: :py:obj:`oioioi.base.tests.TestCase`, :py:obj:`SubmitFileMixin` 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', 'test_submission',... .. py:method:: setUp() Hook method for setting up the test fixture before exercising it. .. py:method:: test_submission_completed_notification() .. py:method:: test_repeated_submission_fail() .. py:method:: test_repeated_submission_different_problems() .. py:method:: test_repeated_submission_success() .. py:method:: test_simple_submission() .. py:method:: test_huge_submission() .. py:method:: test_huge_code_length() .. py:method:: test_size_limit_accuracy() .. py:method:: test_submissions_limitation() .. py:method:: _assertUnsupportedExtension(contest, problem_instance, name, ext) .. py:method:: test_extension_checking() .. py:method:: test_code_pasting() .. py:method:: test_pasting_unicode_code() .. py:method:: test_limiting_extensions() .. py:class:: TestSubmissionAdmin(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', 'test_submission'] .. py:method:: test_submissions_changelist() .. py:class:: TestSubmittingAsAdmin(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_problem_instance', 'test_full_package'] .. py:method:: test_ignored_submission() .. py:method:: test_submitting_as_self() .. py:class:: PrivateProgrammingContestController(contest) Bases: :py:obj:`oioioi.programs.controllers.ProgrammingContestController` Contains the contest logic and rules. This is the computerized implementation of the contest's official rules. .. py:method:: registration_controller() .. py:class:: TestSubmittingAsContestAdmin(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', 'test_permissions'] .. py:method:: test_missing_permission() .. py:class:: TestSubmittingAsObserver(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', 'test_permissions'] .. py:method:: test_ignored_submission() .. py:class:: TestNotifications(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', 'test_permissions',... .. py:method:: test_initial_results_notification() .. py:class:: TestScorers(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:: t_results_ok :annotation: = [None, None, None, None, None, None, None] .. py:attribute:: t_results_ok_perc :annotation: = [None, None, None, None] .. py:attribute:: t_results_unequal_max_scores :annotation: = [None, None] .. py:attribute:: t_expected_unequal_max_scores :annotation: = [None, None] .. py:attribute:: t_results_wrong :annotation: = [None, None] .. py:attribute:: t_expected_wrong :annotation: = [None, None] .. py:method:: test_discrete_test_scorer() .. py:method:: test_threshold_linear_test_scorer() .. py:method:: g_results_ok() .. py:method:: g_results_wrong() .. py:method:: g_results_unequal_max_scores() .. py:method:: test_min_group_scorer() .. py:method:: test_sum_group_scorer() .. py:method:: test_sum_score_aggregator() .. py:class:: TestUserOutsGenerating(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', 'test_submission',... .. py:method:: test_report_after_generate() .. py:method:: test_generate_and_download_user_permission() .. py:class:: TestAdminInOutDownload(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', 'test_submission'] .. py:method:: test_report_href_visibility() .. py:class:: ContestWithJudgeInfoController(contest) Bases: :py:obj:`oioioi.programs.controllers.ProgrammingContestController` Contains the contest logic and rules. This is the computerized implementation of the contest's official rules. .. py:attribute:: judged :annotation: = False .. py:method:: submission_judged(submission, rejudged=False) .. py:class:: TestRejudge(methodName='runTest') Bases: :py:obj:`oioioi.base.tests.TestCase`, :py:obj:`SubmitFileMixin` 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', 'test_submission',... .. py:method:: _set_active_tests(active_tests, all_tests) .. py:method:: _test_rejudge(submit_active_tests, rejudge_active_tests, rejudge_type, tests_subset, expected_ok, expected_re) .. py:method:: test_rejudge_full() .. py:method:: test_rejudge_judged() .. py:method:: test_rejudge_new() .. py:class:: TestLimitsLimits(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', 'test_submission'] .. py:attribute:: form_data .. py:method:: edit_settings() .. py:method:: test_time_limit() .. py:method:: test_memory_limit() .. py:class:: TestCompiler(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', 'test_permissions',... .. py:method:: test_submit_view() .. py:method:: test_compiler_hints_view() .. py:method:: test_contest_admin_inline() .. py:method:: test_contest_contest_admin_inline() .. py:method:: test_problem_admin_inline() .. py:method:: test_check_compiler_config_valid() .. py:method:: test_check_compiler_config_invalid_compiler() .. py:method:: test_check_compiler_config_no_compiler() .. py:class:: TestMaxScoreMigration(methodName='runTest') Bases: :py:obj:`oioioi.base.utils.test_migrations.TestCaseMigrations` TestCase for Django Migrations migrate_from, migrate_to should be Django migration names of tested app setUpBeforeMigration(self, apps) method will be called before migrations are applied source: https://www.caktusgroup.com/blog/2016/02/02/writing-unit-tests-django-migrations/ .. py:attribute:: migrate_from :annotation: = 0012_testreport_max_score .. py:attribute:: migrate_to :annotation: = 0014_remove_testreport_test_max_score .. py:method:: make_report(problem_id, contest, apps, max_score) .. py:method:: setUpBeforeMigration(apps) .. py:method:: test() .. py:class:: TestReportDisplayTypes(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: = ['admin_admin', 'test_users', 'test_report_display_test'] .. py:method:: test_oi_display() .. py:method:: test_acm_display() .. py:method:: test_pa_display() .. py:class:: TestAllowedLanguages(methodName='runTest') Bases: :py:obj:`oioioi.base.tests.TestCase`, :py:obj:`SubmitFileMixin` 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', 'test_permissions',... .. py:method:: setUp() Hook method for setting up the test fixture before exercising it. .. py:method:: test_empty_whitelist() .. py:method:: test_allowed_languages_dict() .. py:method:: test_disallowed_language_submit_attempt() .. py:class:: TestLanguageOverrideForTest(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_contest', 'test_full_package', 'test_problem_instance'] .. py:method:: setUp() Hook method for setting up the test fixture before exercising it. .. py:method:: test_proper_env_override()