TE-2524 Stop using nose.plugins - LMS 2

This commit is contained in:
Jeremy Bowman
2018-08-01 13:54:06 -04:00
parent e5b88f864f
commit 4e8668d3be
71 changed files with 91 additions and 135 deletions

View File

@@ -4,7 +4,6 @@ Tests for ProctoredExamTransformer.
import ddt
from milestones.tests.utils import MilestonesTestCaseMixin
from mock import Mock, patch
from nose.plugins.attrib import attr
from gating import api as lms_gating_api
from lms.djangoapps.course_blocks.api import get_course_blocks
@@ -16,7 +15,6 @@ from student.tests.factories import CourseEnrollmentFactory
from ..milestones import MilestonesAndSpecialExamsTransformer
@attr(shard=3)
@ddt.ddt
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_SPECIAL_EXAMS': True})
class MilestonesTransformerTestCase(CourseStructureTestCase, MilestonesTestCaseMixin):
@@ -24,6 +22,7 @@ class MilestonesTransformerTestCase(CourseStructureTestCase, MilestonesTestCaseM
Test behavior of ProctoredExamTransformer
"""
TRANSFORMER_CLASS_TO_TEST = MilestonesAndSpecialExamsTransformer
shard = 3
def setUp(self):
"""

View File

@@ -7,7 +7,6 @@ from __future__ import unicode_literals
from datetime import datetime
import ddt
from nose.plugins.attrib import attr
from rest_framework.request import Request
from rest_framework.test import APIRequestFactory
from xblock.core import XBlock
@@ -22,7 +21,6 @@ from ..serializers import CourseDetailSerializer, CourseSerializer
from .mixins import CourseApiFactoryMixin
@attr(shard=3)
@ddt.ddt
class TestCourseSerializer(CourseApiFactoryMixin, ModuleStoreTestCase):
"""
@@ -31,6 +29,7 @@ class TestCourseSerializer(CourseApiFactoryMixin, ModuleStoreTestCase):
expected_mongo_calls = 0
maxDiff = 5000 # long enough to show mismatched dicts, in case of error
serializer_class = CourseSerializer
shard = 3
ENABLED_SIGNALS = ['course_published']

View File

@@ -8,11 +8,11 @@ from django.core.exceptions import ImproperlyConfigured
from django.urls import reverse
from django.test import RequestFactory
from django.test.utils import override_settings
from nose.plugins.attrib import attr
from search.tests.test_course_discovery import DemoCourse
from search.tests.tests import TEST_INDEX_NAME
from search.tests.utils import SearcherMixin
from openedx.core.lib.tests import attr
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, SharedModuleStoreTestCase
from waffle.testutils import override_switch

View File

@@ -5,13 +5,11 @@ from datetime import timedelta
import ddt
from django.utils.timezone import now
from nose.plugins.attrib import attr
from ..hidden_content import HiddenContentTransformer
from .helpers import BlockParentsMapTestCase, update_block
@attr(shard=3)
@ddt.ddt
class HiddenContentTransformerTestCase(BlockParentsMapTestCase):
"""
@@ -19,6 +17,7 @@ class HiddenContentTransformerTestCase(BlockParentsMapTestCase):
"""
TRANSFORMER_CLASS_TO_TEST = HiddenContentTransformer
ALL_BLOCKS = {0, 1, 2, 3, 4, 5, 6}
shard = 3
class DueDateType(object):
"""

View File

@@ -2,7 +2,6 @@
Tests for SplitTestTransformer.
"""
import ddt
from nose.plugins.attrib import attr
import openedx.core.djangoapps.user_api.course_tag.api as course_tag_api
from openedx.core.djangoapps.user_api.partition_schemes import RandomUserPartitionScheme
@@ -15,7 +14,6 @@ from ..user_partitions import UserPartitionTransformer, _get_user_partition_grou
from .helpers import CourseStructureTestCase, create_location
@attr(shard=3)
@ddt.ddt
class SplitTestTransformerTestCase(CourseStructureTestCase):
"""
@@ -23,6 +21,7 @@ class SplitTestTransformerTestCase(CourseStructureTestCase):
"""
TEST_PARTITION_ID = 0
TRANSFORMER_CLASS_TO_TEST = UserPartitionTransformer
shard = 3
def setUp(self):
"""

View File

@@ -6,7 +6,6 @@ from datetime import timedelta
import ddt
from django.utils.timezone import now
from mock import patch
from nose.plugins.attrib import attr
from courseware.tests.factories import BetaTesterFactory
@@ -14,7 +13,6 @@ from ..start_date import DEFAULT_START_DATE, StartDateTransformer
from .helpers import BlockParentsMapTestCase, update_block
@attr(shard=3)
@ddt.ddt
class StartDateTransformerTestCase(BlockParentsMapTestCase):
"""
@@ -23,6 +21,7 @@ class StartDateTransformerTestCase(BlockParentsMapTestCase):
STUDENT = 1
BETA_USER = 2
TRANSFORMER_CLASS_TO_TEST = StartDateTransformer
shard = 3
class StartDateType(object):
"""

View File

@@ -6,7 +6,6 @@ import string
from collections import namedtuple
import ddt
from nose.plugins.attrib import attr
from openedx.core.djangoapps.course_groups.cohorts import add_user_to_cohort
from openedx.core.djangoapps.course_groups.partition_scheme import CohortPartitionScheme
@@ -69,12 +68,13 @@ class UserPartitionTestMixin(object):
self.partition_cohorts.append(partition_cohorts)
@attr(shard=3)
@ddt.ddt
class UserPartitionTransformerTestCase(UserPartitionTestMixin, CourseStructureTestCase):
"""
UserPartitionTransformer Test
"""
shard = 3
def setup_partitions_and_course(self, active=True):
"""
Setup course structure and create user for user partition
@@ -242,12 +242,13 @@ class UserPartitionTransformerTestCase(UserPartitionTestMixin, CourseStructureTe
)
@attr(shard=3)
@ddt.ddt
class MergedGroupAccessTestData(UserPartitionTestMixin, CourseStructureTestCase):
"""
_MergedGroupAccess Test
"""
shard = 3
def setUp(self):
"""
Setup course structure and create user for user partition

View File

@@ -2,19 +2,18 @@
Tests for VisibilityTransformer.
"""
import ddt
from nose.plugins.attrib import attr
from ..visibility import VisibilityTransformer
from .helpers import BlockParentsMapTestCase, update_block
@attr(shard=3)
@ddt.ddt
class VisibilityTransformerTestCase(BlockParentsMapTestCase):
"""
VisibilityTransformer Test
"""
TRANSFORMER_CLASS_TO_TEST = VisibilityTransformer
shard = 3
# Following test cases are based on BlockParentsMapTestCase.parents_map
@ddt.data(

View File

@@ -3,13 +3,13 @@ Tests for wiki permissions
"""
from django.contrib.auth.models import Group
from nose.plugins.attrib import attr
from wiki.models import URLPath
from course_wiki import settings
from course_wiki.utils import course_wiki_slug, user_is_article_course_staff
from course_wiki.views import get_or_create_root
from courseware.tests.factories import InstructorFactory, StaffFactory
from openedx.core.lib.tests import attr
from student.tests.factories import UserFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory

View File

@@ -4,7 +4,6 @@ Tests for wiki middleware.
from unittest import skip
from django.test.client import Client
from nose.plugins.attrib import attr
from wiki.models import URLPath
from course_wiki.views import get_or_create_root
@@ -14,9 +13,9 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@attr(shard=1)
class TestComprehensiveTheming(ModuleStoreTestCase):
"""Tests for comprehensive theming of wiki pages."""
shard = 1
def setUp(self):
"""Test setup."""

View File

@@ -3,7 +3,6 @@ Tests for wiki middleware.
"""
from django.test.client import Client
from nose.plugins.attrib import attr
from wiki.models import URLPath
from course_wiki.views import get_or_create_root
@@ -12,9 +11,9 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@attr(shard=1)
class TestWikiAccessMiddleware(ModuleStoreTestCase):
"""Tests for WikiAccessMiddleware."""
shard = 1
def setUp(self):
"""Test setup."""

View File

@@ -4,7 +4,6 @@ Tests for course wiki
from django.urls import reverse
from mock import patch
from nose.plugins.attrib import attr
from six import text_type
from courseware.tests.tests import LoginEnrollmentTestCase
@@ -13,11 +12,11 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@attr(shard=1)
class WikiRedirectTestCase(EnterpriseTestConsentRequired, LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Tests for wiki course redirection.
"""
shard = 1
def setUp(self):
super(WikiRedirectTestCase, self).setUp()

View File

@@ -7,7 +7,6 @@ Tests for Django management commands
import json
from StringIO import StringIO
from nose.plugins.attrib import attr
from six import text_type
import factory
@@ -27,7 +26,6 @@ DATA_DIR = settings.COMMON_TEST_DATA_ROOT
XML_COURSE_DIRS = ['simple']
@attr(shard=1)
class CommandsTestBase(SharedModuleStoreTestCase):
"""
Base class for testing different django commands.
@@ -39,6 +37,7 @@ class CommandsTestBase(SharedModuleStoreTestCase):
__test__ = False
url_name = '2012_Fall'
ENABLED_SIGNALS = ['course_published']
shard = 1
@classmethod
def setUpClass(cls):

View File

@@ -10,12 +10,12 @@ from django.urls import reverse
from django.test.utils import override_settings
from milestones.tests.utils import MilestonesTestCaseMixin
from mock import patch
from nose.plugins.attrib import attr
from six import text_type
from waffle.testutils import override_switch
from course_modes.models import CourseMode
from lms.djangoapps.ccx.tests.factories import CcxFactory
from openedx.core.lib.tests import attr
from openedx.features.course_experience.waffle import WAFFLE_NAMESPACE as COURSE_EXPERIENCE_WAFFLE_NAMESPACE
from openedx.features.course_experience.waffle import ENABLE_COURSE_ABOUT_SIDEBAR_HTML
from shoppingcart.models import Order, PaidCourseRegistration

View File

@@ -14,7 +14,6 @@ from django.test import TestCase
from django.test.client import RequestFactory
from milestones.tests.utils import MilestonesTestCaseMixin
from mock import Mock, patch
from nose.plugins.attrib import attr
from opaque_keys.edx.locator import CourseLocator
import courseware.access as access
@@ -31,6 +30,7 @@ from courseware.tests.helpers import LoginEnrollmentTestCase, masquerade_as_grou
from lms.djangoapps.ccx.models import CustomCourseForEdX
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from openedx.core.djangoapps.waffle_utils.testutils import WAFFLE_TABLES
from openedx.core.lib.tests import attr
from student.models import CourseEnrollment
from student.roles import CourseCcxCoachRole, CourseStaffRole
from student.tests.factories import (

View File

@@ -11,10 +11,10 @@ from django.test.utils import override_settings
from ccx_keys.locator import CCXLocator
from lms.djangoapps.ccx.tests.factories import CcxFactory
from nose.plugins.attrib import attr
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
from openedx.core.djangoapps.site_configuration.tests.test_util import with_site_configuration_context
from openedx.core.djangoapps.waffle_utils.testutils import WAFFLE_TABLES, override_waffle_flag
from openedx.core.lib.tests import attr
from openedx.features.course_experience import UNIFIED_COURSE_TAB_FLAG
from openedx.features.enterprise_support.tests.mixins.enterprise import EnterpriseTestConsentRequired
from pyquery import PyQuery as pq

View File

@@ -7,7 +7,6 @@ from copy import deepcopy
from django.contrib.auth.models import User
from django.urls import reverse
from nose.plugins.attrib import attr
from common.test.utils import XssTestMixin
from courseware.tests.helpers import LoginEnrollmentTestCase
@@ -16,12 +15,11 @@ from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@attr(shard=1)
class SurveyViewsTests(LoginEnrollmentTestCase, SharedModuleStoreTestCase, XssTestMixin):
"""
All tests for the views.py file
"""
shard = 1
STUDENT_INFO = [('view@test.com', 'foo')]
@classmethod

View File

@@ -6,7 +6,6 @@ import crum
import datetime
from mock import patch
from nose.plugins.attrib import attr
import pytz
from django.test import RequestFactory
@@ -23,8 +22,8 @@ from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@attr(shard=3)
class VerifiedUpgradeToolTest(SharedModuleStoreTestCase):
shard = 3
@classmethod
def setUpClass(cls):

View File

@@ -12,7 +12,6 @@ from django.conf import settings
from django.urls import reverse
from django.test.client import RequestFactory
from django.test.utils import override_settings
from nose.plugins.attrib import attr
from opaque_keys.edx.keys import CourseKey
from six import text_type
@@ -34,6 +33,7 @@ from courseware.module_render import get_module_for_descriptor
from lms.djangoapps.courseware.courseware_access_exception import CoursewareAccessException
from openedx.core.djangolib.testing.utils import get_mock_request
from openedx.core.lib.courses import course_image_url
from openedx.core.lib.tests import attr
from student.tests.factories import UserFactory
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import _get_modulestore_branch_setting, modulestore

View File

@@ -9,7 +9,6 @@ from django.urls import reverse
from django.test import RequestFactory
from freezegun import freeze_time
from mock import patch
from nose.plugins.attrib import attr
from pytz import utc
from course_modes.models import CourseMode
@@ -37,6 +36,7 @@ from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
from openedx.core.djangoapps.site_configuration.tests.factories import SiteFactory
from openedx.core.djangoapps.user_api.preferences.api import set_user_preference
from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag
from openedx.core.lib.tests import attr
from openedx.features.course_experience import UNIFIED_COURSE_TAB_FLAG, UPGRADE_DEADLINE_MESSAGE, CourseHomeMessages
from student.tests.factories import TEST_PASSWORD, CourseEnrollmentFactory, UserFactory
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase

View File

@@ -1,15 +1,15 @@
from django.test import TestCase
from nose.plugins.attrib import attr
from opaque_keys.edx.keys import CourseKey
from xmodule.modulestore.django import modulestore
@attr(shard=1)
class TestDraftModuleStore(TestCase):
"""
Test the draft modulestore
"""
shard = 1
def test_get_items_with_course_items(self):
store = modulestore()

View File

@@ -17,7 +17,6 @@ from courseware.module_render import get_module, handle_xblock_callback, toc_for
from courseware.tests.factories import InstructorFactory, StaffFactory, UserFactory
from courseware.tests.helpers import LoginEnrollmentTestCase
from milestones.tests.utils import MilestonesTestCaseMixin
from nose.plugins.attrib import attr
from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag
from openedx.core.djangolib.testing.utils import get_mock_request
from openedx.features.course_experience import COURSE_OUTLINE_PAGE_FLAG, UNIFIED_COURSE_TAB_FLAG
@@ -36,7 +35,6 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
@attr(shard=2)
@patch.dict('django.conf.settings.FEATURES', {'ENTRANCE_EXAMS': True})
class EntranceExamTestCases(LoginEnrollmentTestCase, ModuleStoreTestCase, MilestonesTestCaseMixin):
"""
@@ -45,6 +43,8 @@ class EntranceExamTestCases(LoginEnrollmentTestCase, ModuleStoreTestCase, Milest
Creates a test course from scratch. The tests below are designed to execute
workflows regardless of the feature flag settings.
"""
shard = 2
@patch.dict('django.conf.settings.FEATURES', {'ENTRANCE_EXAMS': True})
def setUp(self):
"""

View File

@@ -1,15 +1,14 @@
from django.test import TestCase
from django.test.utils import override_settings
from nose.plugins.attrib import attr
from util.testing import UrlResetMixin
@attr(shard=1)
class FaviconTestCase(UrlResetMixin, TestCase):
"""
Tests of the courseware favicon.
"""
shard = 1
def test_favicon_redirect(self):
resp = self.client.get("/favicon.ico")

View File

@@ -5,9 +5,9 @@ Tests for `field_overrides` module.
import unittest
from django.test.utils import override_settings
from nose.plugins.attrib import attr
from xblock.field_data import DictFieldData
from openedx.core.lib.tests import attr
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory

View File

@@ -8,17 +8,16 @@ import unittest
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
from nose.plugins.attrib import attr
from openedx.core.djangoapps.theming.tests.test_util import with_comprehensive_theme
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
@attr(shard=1)
class TestFooter(TestCase):
"""
Tests for edx and OpenEdX footer
"""
shard = 1
SOCIAL_MEDIA_NAMES = [
"facebook",

View File

@@ -4,7 +4,6 @@ access control rules.
"""
import ddt
from nose.plugins.attrib import attr
from stevedore.extension import Extension, ExtensionManager
import courseware.access as access
@@ -50,13 +49,14 @@ def resolve_attrs(test_method):
return _wrapper
@attr(shard=7)
@ddt.ddt
class GroupAccessTestCase(ModuleStoreTestCase):
"""
Tests to ensure that has_access() correctly enforces the visibility
restrictions specified in the `group_access` field of XBlocks.
"""
shard = 7
def set_user_group(self, user, partition, group):
"""
Internal DRY / shorthand.

View File

@@ -11,10 +11,10 @@ from django.urls import reverse, reverse_lazy
from django.test import TestCase
from django.test.client import Client
from django.utils import translation
from nose.plugins.attrib import attr
from openedx.core.djangoapps.dark_lang.models import DarkLangConfig
from openedx.core.djangoapps.lang_pref import LANGUAGE_KEY
from openedx.core.lib.tests import attr
from student.tests.factories import UserFactory

View File

@@ -5,14 +5,12 @@ import urllib
from collections import OrderedDict
import mock
import pytest
from django.conf import settings
from django.urls import reverse
import oauthlib
from courseware.tests.helpers import BaseTestXmodule
from courseware.views.views import get_course_lti_endpoints
from nose.plugins.attrib import attr
from openedx.core.lib.url_utils import quote_slashes
from six import text_type
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
@@ -20,7 +18,6 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.x_module import STUDENT_VIEW
@attr(shard=1)
class TestLTI(BaseTestXmodule):
"""
Integration test for lti xmodule.
@@ -30,6 +27,7 @@ class TestLTI(BaseTestXmodule):
of `oauthlib` library.
"""
CATEGORY = "lti"
shard = 1
def setUp(self):
"""
@@ -126,7 +124,6 @@ class TestLTI(BaseTestXmodule):
self.assertEqual(generated_content, expected_content)
@attr(shard=1)
class TestLTIModuleListing(SharedModuleStoreTestCase):
"""
a test for the rest endpoint that lists LTI modules in a course
@@ -134,6 +131,7 @@ class TestLTIModuleListing(SharedModuleStoreTestCase):
# arbitrary constant
COURSE_SLUG = "100"
COURSE_NAME = "test_course"
shard = 1
@classmethod
def setUpClass(cls):

View File

@@ -18,11 +18,11 @@ from courseware.masquerade import CourseMasquerade, MasqueradingKeyValueStore, g
from courseware.tests.factories import StaffFactory
from courseware.tests.helpers import LoginEnrollmentTestCase, masquerade_as_group_member
from courseware.tests.test_submitting_problems import ProblemSubmissionTestMixin
from nose.plugins.attrib import attr
from openedx.core.djangoapps.lang_pref import LANGUAGE_KEY
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
from openedx.core.djangoapps.user_api.preferences.api import get_user_preference, set_user_preference
from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag
from openedx.core.lib.tests import attr
from openedx.features.course_experience import UNIFIED_COURSE_TAB_FLAG
from student.models import CourseEnrollment
from student.tests.factories import UserFactory

View File

@@ -2,14 +2,12 @@
Tests related to the Site Configuration feature
"""
import pytest
from bs4 import BeautifulSoup
from contextlib import contextmanager
from django.conf import settings
from django.urls import reverse
from django.test.utils import override_settings
from mock import patch
from nose.plugins.attrib import attr
from six import text_type
from course_modes.models import CourseMode
@@ -19,12 +17,11 @@ from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
@attr(shard=1)
class TestSites(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
"""
This is testing of the Site Configuration feature
"""
shard = 1
STUDENT_INFO = [('view@test.com', 'foo'), ('view2@test.com', 'foo')]
ENABLED_SIGNALS = ['course_published']

View File

@@ -4,7 +4,6 @@ Tests for courseware middleware
from django.http import Http404
from django.test.client import RequestFactory
from nose.plugins.attrib import attr
from lms.djangoapps.courseware.exceptions import Redirect
from lms.djangoapps.courseware.middleware import RedirectMiddleware
@@ -12,9 +11,9 @@ from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@attr(shard=1)
class CoursewareMiddlewareTestCase(SharedModuleStoreTestCase):
"""Tests that courseware middleware is correctly redirected"""
shard = 1
@classmethod
def setUpClass(cls):

View File

@@ -7,7 +7,6 @@ from functools import partial
from django.db import DatabaseError
from django.test import TestCase
from mock import Mock, patch
from nose.plugins.attrib import attr
from xblock.core import XBlock
from xblock.exceptions import KeyValueMultiSaveError
from xblock.fields import BlockScope, Scope, ScopeIds
@@ -27,6 +26,7 @@ from courseware.tests.factories import (
course_id,
location
)
from openedx.core.lib.tests import attr
from student.tests.factories import UserFactory

View File

@@ -8,7 +8,6 @@ from datetime import datetime
from functools import partial
import ddt
import pytest
import pytz
from bson import ObjectId
from completion.models import BlockCompletion
@@ -25,7 +24,6 @@ from edx_proctoring.tests.test_services import MockCreditService, MockGradesServ
from freezegun import freeze_time
from milestones.tests.utils import MilestonesTestCaseMixin
from mock import MagicMock, Mock, patch
from nose.plugins.attrib import attr
from opaque_keys.edx.keys import CourseKey, UsageKey
from pyquery import PyQuery
from six import text_type
@@ -53,6 +51,7 @@ from openedx.core.djangoapps.credit.api import set_credit_requirement_status, se
from openedx.core.djangoapps.credit.models import CreditCourse
from openedx.core.lib.courses import course_image_url
from openedx.core.lib.gating import api as gating_api
from openedx.core.lib.tests import attr
from openedx.core.lib.url_utils import quote_slashes
from student.models import anonymous_id_for_user
from verify_student.tests.factories import SoftwareSecurePhotoVerificationFactory

View File

@@ -7,7 +7,6 @@ from django.conf import settings
from django.urls import reverse
from django.test.utils import override_settings
from mock import patch
from nose.plugins.attrib import attr
from six import text_type
from courseware.tests.factories import GlobalStaffFactory
@@ -20,12 +19,11 @@ from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
@attr(shard=1)
class TestNavigation(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Check that navigation state is saved properly.
"""
shard = 1
STUDENT_INFO = [('view@test.com', 'foo'), ('view2@test.com', 'foo')]
@classmethod

View File

@@ -14,19 +14,18 @@ from django.utils import timezone
from django.utils.http import int_to_base36
from freezegun import freeze_time
from mock import patch
from nose.plugins.attrib import attr
from courseware.tests.helpers import LoginEnrollmentTestCase
from student.models import PasswordHistory
@attr(shard=1)
@patch.dict("django.conf.settings.FEATURES", {'ADVANCED_SECURITY': True})
@ddt.ddt
class TestPasswordHistory(LoginEnrollmentTestCase):
"""
Go through some of the PasswordHistory use cases
"""
shard = 1
def _login(self, email, password, should_succeed=True, err_msg_check=None):
"""

View File

@@ -3,7 +3,6 @@ Test for split test XModule
"""
from django.urls import reverse
from mock import MagicMock
from nose.plugins.attrib import attr
from six import text_type
from courseware.model_data import FieldDataCache
@@ -15,7 +14,6 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.partitions.partitions import Group, UserPartition
@attr(shard=1)
class SplitTestBase(SharedModuleStoreTestCase):
"""
Sets up a basic course and user for split test testing.
@@ -26,6 +24,7 @@ class SplitTestBase(SharedModuleStoreTestCase):
ICON_CLASSES = None
TOOLTIPS = None
VISIBLE_CONTENT = None
shard = 1
@classmethod
def setUpClass(cls):
@@ -285,11 +284,12 @@ class TestVertSplitTestVert(SplitTestBase):
]
@attr(shard=1)
class SplitTestPosition(SharedModuleStoreTestCase):
"""
Check that we can change positions in a course with partitions defined
"""
shard = 1
@classmethod
def setUpClass(cls):
super(SplitTestPosition, cls).setUpClass()

View File

@@ -17,7 +17,6 @@ from django.test import TestCase
from django.test.client import RequestFactory
from django.utils.timezone import now
from mock import patch
from nose.plugins.attrib import attr
from six import text_type
from capa.tests.response_xml_factory import (
@@ -34,6 +33,7 @@ from lms.djangoapps.grades.tasks import compute_all_grades_for_course
from openedx.core.djangoapps.credit.api import get_credit_requirement_status, set_credit_requirements
from openedx.core.djangoapps.credit.models import CreditCourse, CreditProvider
from openedx.core.djangoapps.user_api.tests.factories import UserCourseTagFactory
from openedx.core.lib.tests import attr
from openedx.core.lib.url_utils import quote_slashes
from student.models import CourseEnrollment, anonymous_id_for_user
from submissions import api as submissions_api

View File

@@ -2,13 +2,11 @@
Test cases for tabs.
"""
import pytest
from django.contrib.auth.models import AnonymousUser
from django.urls import reverse
from django.http import Http404
from milestones.tests.utils import MilestonesTestCaseMixin
from mock import MagicMock, Mock, patch
from nose.plugins.attrib import attr
from six import text_type
from courseware.courses import get_course_by_id
@@ -25,6 +23,7 @@ from courseware.tests.helpers import LoginEnrollmentTestCase
from courseware.views.views import StaticCourseTabView, get_static_tab_fragment
from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag
from openedx.core.djangolib.testing.utils import get_mock_request
from openedx.core.lib.tests import attr
from openedx.features.course_experience import UNIFIED_COURSE_TAB_FLAG
from student.models import CourseEnrollment
from student.tests.factories import UserFactory

View File

@@ -12,11 +12,11 @@ import freezegun
from django.core.files.base import ContentFile
from django.utils.timezone import now
from mock import MagicMock, Mock, patch
from nose.plugins.attrib import attr
from webob import Request, Response
from common.test.utils import normalize_repr
from openedx.core.djangoapps.contentserver.caching import del_cached_content
from openedx.core.lib.tests import attr
from xmodule.contentstore.content import StaticContent
from xmodule.contentstore.django import contentstore
from xmodule.exceptions import NotFoundError

View File

@@ -31,9 +31,9 @@ from edxval.api import (
from edxval.utils import create_file_in_fs
from lxml import etree
from mock import MagicMock, Mock, patch
from nose.plugins.attrib import attr
from path import Path as path
from openedx.core.lib.tests import attr
from xmodule.contentstore.content import StaticContent
from xmodule.exceptions import NotFoundError
from xmodule.modulestore import ModuleStoreEnum

View File

@@ -14,8 +14,6 @@ You can then use the CourseFactory and XModuleItemFactory as defined in
common/lib/xmodule/xmodule/modulestore/tests/factories.py to create the
course, section, subsection, unit, etc.
"""
from nose.plugins.attrib import attr
from xmodule.tests import LogicTest
from xmodule.video_module import VideoDescriptor
@@ -35,7 +33,6 @@ SOURCE_XML = """
"""
@attr(shard=1)
class VideoModuleLogicTest(LogicTest):
"""Tests for logic of Video Xmodule."""
@@ -44,6 +41,7 @@ class VideoModuleLogicTest(LogicTest):
raw_field_data = {
'data': '<video />'
}
shard = 1
def test_parse_youtube(self):
"""Test parsing old-style Youtube ID strings into a dict."""

View File

@@ -3,7 +3,6 @@ import datetime
import pytz
from django.urls import reverse
from mock import patch
from nose.plugins.attrib import attr
from six import text_type
from courseware.access import has_access
@@ -23,7 +22,6 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
@attr(shard=1)
class TestViewAuth(EnterpriseTestConsentRequired, ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Check that view authentication works properly.
@@ -31,6 +29,7 @@ class TestViewAuth(EnterpriseTestConsentRequired, ModuleStoreTestCase, LoginEnro
ACCOUNT_INFO = [('view@test.com', 'foo'), ('view2@test.com', 'foo')]
ENABLED_SIGNALS = ['course_published']
shard = 1
@staticmethod
def _reverse_urls(names, course):
@@ -410,11 +409,12 @@ class TestViewAuth(EnterpriseTestConsentRequired, ModuleStoreTestCase, LoginEnro
self.assertTrue(self.enroll(self.course))
@attr(shard=1)
class TestBetatesterAccess(ModuleStoreTestCase, CourseAccessTestMixin):
"""
Tests for the beta tester feature
"""
shard = 1
def setUp(self):
super(TestBetatesterAccess, self).setUp()

View File

@@ -22,7 +22,6 @@ from django.test.utils import override_settings
from freezegun import freeze_time
from milestones.tests.utils import MilestonesTestCaseMixin
from mock import MagicMock, PropertyMock, create_autospec, patch
from nose.plugins.attrib import attr
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator
from pytz import UTC
@@ -62,6 +61,7 @@ from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag, WaffleFlagNam
from openedx.core.djangoapps.waffle_utils.testutils import WAFFLE_TABLES, override_waffle_flag
from openedx.core.djangolib.testing.utils import get_mock_request
from openedx.core.lib.gating import api as gating_api
from openedx.core.lib.tests import attr
from openedx.core.lib.url_utils import quote_slashes
from openedx.features.course_experience import COURSE_OUTLINE_PAGE_FLAG, UNIFIED_COURSE_TAB_FLAG
from openedx.features.enterprise_support.tests.mixins.enterprise import EnterpriseTestConsentRequired

View File

@@ -4,17 +4,15 @@
import json
from operator import itemgetter
from nose.plugins.attrib import attr
from xmodule.x_module import STUDENT_VIEW
from .helpers import BaseTestXmodule
@attr(shard=1)
class TestWordCloud(BaseTestXmodule):
"""Integration test for word cloud xmodule."""
CATEGORY = "word_cloud"
shard = 1
def _get_resource_url(self, item):
"""

View File

@@ -6,12 +6,12 @@ from unittest import TestCase
import mock
from django.urls import reverse
from nose.plugins.attrib import attr
from opaque_keys.edx.keys import CourseKey
from six import text_type
from courseware.tests.helpers import LoginEnrollmentTestCase
from lms.djangoapps.lms_xblock.field_data import LmsFieldData
from openedx.core.lib.tests import attr
from xmodule.error_module import ErrorDescriptor
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_MODULESTORE, ModuleStoreTestCase

View File

@@ -13,7 +13,6 @@ from django.conf import settings
from django.core.management import call_command
from django.core.management.base import CommandError
from django.test.utils import override_settings
from nose.plugins.attrib import attr
from opaque_keys.edx.keys import CourseKey
import dashboard.git_import as git_import
@@ -42,7 +41,6 @@ FEATURES_WITH_SSL_AUTH = settings.FEATURES.copy()
FEATURES_WITH_SSL_AUTH['AUTH_USE_CERTIFICATES'] = True
@attr(shard=3)
@override_settings(
MONGODB_LOG=TEST_MONGODB_LOG,
GIT_REPO_DIR=settings.TEST_ROOT / "course_repos_{}".format(uuid4().hex)
@@ -53,7 +51,7 @@ class TestGitAddCourse(SharedModuleStoreTestCase):
"""
Tests the git_add_course management command for proper functions.
"""
shard = 3
TEST_REPO = 'https://github.com/mitocw/edx4edx_lite.git'
TEST_COURSE = 'MITx/edx4edx/edx4edx'
TEST_BRANCH = 'testing_do_not_delete'

View File

@@ -15,7 +15,6 @@ from django.urls import reverse
from django.test.client import Client
from django.test.utils import override_settings
from pytz import UTC
from nose.plugins.attrib import attr
from opaque_keys.edx.keys import CourseKey
from six import text_type
@@ -109,7 +108,6 @@ class SysadminBaseTestCase(SharedModuleStoreTestCase):
self.addCleanup(shutil.rmtree, path)
@attr(shard=1)
@override_settings(
MONGODB_LOG=TEST_MONGODB_LOG,
GIT_REPO_DIR=settings.TEST_ROOT / "course_repos_{}".format(uuid4().hex)
@@ -120,6 +118,7 @@ class TestSysAdminMongoCourseImport(SysadminBaseTestCase):
"""
Check that importing into the mongo module store works
"""
shard = 1
@classmethod
def tearDownClass(cls):

View File

@@ -2,11 +2,11 @@
Test instructor.access
"""
from nose.plugins.attrib import attr
from nose.tools import raises
from django_comment_common.models import FORUM_ROLE_MODERATOR, Role
from lms.djangoapps.instructor.access import allow_access, list_with_level, revoke_access, update_forum_role
from openedx.core.lib.tests import attr
from student.roles import CourseBetaTesterRole, CourseCcxCoachRole, CourseStaffRole
from student.tests.factories import UserFactory
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase

View File

@@ -23,7 +23,6 @@ from django.test.utils import override_settings
from pytz import UTC
from django.utils.translation import ugettext as _
from mock import Mock, NonCallableMock, patch
from nose.plugins.attrib import attr
from nose.tools import raises
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locator import UsageKey
@@ -62,6 +61,7 @@ from lms.djangoapps.instructor_task.api_helper import (
from openedx.core.djangoapps.course_groups.cohorts import set_course_cohorted
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.site_configuration.tests.mixins import SiteMixin
from openedx.core.lib.tests import attr
from openedx.core.lib.xblock_utils import grade_histogram
from shoppingcart.models import (
Coupon,

View File

@@ -6,7 +6,6 @@ Unit tests for the localization of emails sent by instructor.api methods.
from django.core import mail
from django.urls import reverse
from django.test.utils import override_settings
from nose.plugins.attrib import attr
from six import text_type
from courseware.tests.factories import InstructorFactory
@@ -18,12 +17,13 @@ from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@attr(shard=1)
class TestInstructorAPIEnrollmentEmailLocalization(SharedModuleStoreTestCase):
"""
Test whether the enroll, unenroll and beta role emails are sent in the
proper language, i.e: the student's language.
"""
shard = 1
@classmethod
def setUpClass(cls):
super(TestInstructorAPIEnrollmentEmailLocalization, cls).setUpClass()

View File

@@ -13,7 +13,6 @@ from django.core.exceptions import ObjectDoesNotExist
from django.core.files.uploadedfile import SimpleUploadedFile
from django.urls import reverse
from django.test.utils import override_settings
from nose.plugins.attrib import attr
from capa.xqueue_interface import XQueueInterface
from lms.djangoapps.certificates import api as certs_api
@@ -34,6 +33,7 @@ from courseware.tests.factories import GlobalStaffFactory, InstructorFactory, Us
from lms.djangoapps.grades.tests.utils import mock_passing_grade
from lms.djangoapps.verify_student.services import IDVerificationService
from lms.djangoapps.verify_student.tests.factories import SoftwareSecurePhotoVerificationFactory
from openedx.core.lib.tests import attr
from student.models import CourseEnrollment
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory

View File

@@ -6,7 +6,6 @@ import datetime
import pytz
from django.urls import reverse
from nose.plugins.attrib import attr
from six import text_type
from course_modes.models import CourseMode
@@ -18,11 +17,12 @@ from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@attr(shard=1)
class TestECommerceDashboardViews(SiteMixin, SharedModuleStoreTestCase):
"""
Check for E-commerce view on the new instructor dashboard
"""
shard = 1
@classmethod
def setUpClass(cls):
super(TestECommerceDashboardViews, cls).setUpClass()

View File

@@ -6,7 +6,6 @@ that the view is conditionally available when Course Auth is turned on.
"""
from django.urls import reverse
from nose.plugins.attrib import attr
from opaque_keys.edx.keys import CourseKey
from six import text_type
@@ -16,12 +15,13 @@ from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_MODULESTORE,
from xmodule.modulestore.tests.factories import CourseFactory
@attr(shard=1)
class TestNewInstructorDashboardEmailViewMongoBacked(SharedModuleStoreTestCase):
"""
Check for email view on the new instructor dashboard
for Mongo-backed courses
"""
shard = 1
@classmethod
def setUpClass(cls):
super(TestNewInstructorDashboardEmailViewMongoBacked, cls).setUpClass()
@@ -109,13 +109,13 @@ class TestNewInstructorDashboardEmailViewMongoBacked(SharedModuleStoreTestCase):
self.assertNotIn(self.email_link, response.content)
@attr(shard=1)
class TestNewInstructorDashboardEmailViewXMLBacked(SharedModuleStoreTestCase):
"""
Check for email view on the new instructor dashboard
"""
MODULESTORE = TEST_DATA_MIXED_MODULESTORE
shard = 1
@classmethod
def setUpClass(cls):

View File

@@ -12,7 +12,6 @@ from django.conf import settings
from django.utils.translation import override as override_language
from django.utils.translation import get_language
from mock import patch
from nose.plugins.attrib import attr
from opaque_keys.edx.locator import CourseLocator
from six import text_type
@@ -32,6 +31,7 @@ from lms.djangoapps.instructor.enrollment import (
unenroll_email
)
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, get_mock_request
from openedx.core.lib.tests import attr
from student.models import CourseEnrollment, CourseEnrollmentAllowed, anonymous_id_for_user
from student.roles import CourseCcxCoachRole
from student.tests.factories import AdminFactory, UserFactory

View File

@@ -6,7 +6,6 @@ import ddt
from django.conf import settings
from django.urls import reverse
from mock import patch
from nose.plugins.attrib import attr
from six import text_type
from student.roles import CourseStaffRole, CourseInstructorRole
@@ -15,13 +14,14 @@ from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@attr(shard=1)
@patch.dict(settings.FEATURES, {'ENABLE_SPECIAL_EXAMS': True})
@ddt.ddt
class TestProctoringDashboardViews(SharedModuleStoreTestCase):
"""
Check for Proctoring view on the new instructor dashboard
"""
shard = 1
@classmethod
def setUpClass(cls):
super(TestProctoringDashboardViews, cls).setUpClass()

View File

@@ -6,7 +6,6 @@ import json
from django.urls import reverse
from django.test.utils import override_settings
from django.utils.translation import ugettext as _
from nose.plugins.attrib import attr
from six import text_type
from course_modes.models import CourseMode
@@ -27,12 +26,13 @@ from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@attr(shard=1)
@override_settings(REGISTRATION_CODE_LENGTH=8)
class TestCourseRegistrationCodeStatus(SharedModuleStoreTestCase):
"""
Test registration code status.
"""
shard = 1
@classmethod
def setUpClass(cls):
super(TestCourseRegistrationCodeStatus, cls).setUpClass()

View File

@@ -5,7 +5,6 @@ Tests for the InstructorService
import json
import mock
from nose.plugins.attrib import attr
from courseware.models import StudentModule
from lms.djangoapps.instructor.access import allow_access
@@ -17,11 +16,12 @@ from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@attr(shard=1)
class InstructorServiceTests(SharedModuleStoreTestCase):
"""
Tests for the InstructorService
"""
shard = 1
@classmethod
def setUpClass(cls):
super(InstructorServiceTests, cls).setUpClass()

View File

@@ -3,12 +3,12 @@ Tests of the instructor dashboard spoc gradebook
"""
from django.urls import reverse
from nose.plugins.attrib import attr
from six import text_type
from capa.tests.response_xml_factory import StringResponseXMLFactory
from courseware.tests.factories import StudentModuleFactory
from lms.djangoapps.grades.tasks import compute_all_grades_for_course
from openedx.core.lib.tests import attr
from student.tests.factories import AdminFactory, CourseEnrollmentFactory, UserFactory
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory

View File

@@ -13,12 +13,12 @@ from django.core.exceptions import MultipleObjectsReturned
from django.test import TestCase
from django.test.utils import override_settings
from pytz import UTC
from nose.plugins.attrib import attr
from opaque_keys.edx.keys import CourseKey
from six import text_type
from courseware.field_overrides import OverrideFieldData
from lms.djangoapps.ccx.tests.test_overrides import inject_field_overrides
from openedx.core.lib.tests import attr
from student.tests.factories import UserFactory
from xmodule.fields import Date
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, SharedModuleStoreTestCase

View File

@@ -10,7 +10,6 @@ from django.urls import reverse
from django.test.client import RequestFactory
from django.test.utils import override_settings
from mock import patch
from nose.plugins.attrib import attr
from pytz import UTC
from six import text_type
@@ -46,12 +45,12 @@ def intercept_renderer(path, context):
return response
@attr(shard=3)
@ddt.ddt
class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssTestMixin):
"""
Tests for the instructor dashboard (not legacy).
"""
shard = 3
def setUp(self):
"""

View File

@@ -2,12 +2,10 @@
Tests for the LTI provider views
"""
import pytest
from django.urls import reverse
from django.test import TestCase
from django.test.client import RequestFactory
from mock import MagicMock, patch
from nose.plugins.attrib import attr
from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator
from courseware.testutils import RenderXBlockTestMixin
@@ -181,7 +179,6 @@ class LtiLaunchTest(LtiTestMixin, TestCase):
self.assertEqual(consumer.instance_guid, u'consumer instance guid')
@attr(shard=3)
class LtiLaunchTestRender(LtiTestMixin, RenderXBlockTestMixin, ModuleStoreTestCase):
"""
Tests for the rendering returned by lti_launch view.
@@ -189,6 +186,7 @@ class LtiLaunchTestRender(LtiTestMixin, RenderXBlockTestMixin, ModuleStoreTestCa
the tests defined in RenderXBlockTestMixin.
"""
SUCCESS_ENROLLED_STAFF_MONGO_COUNT = 9
shard = 3
def get_response(self, usage_key, url_encoded_params=None):
"""

View File

@@ -5,7 +5,6 @@ Tests for course_info
import ddt
from django.conf import settings
from milestones.tests.utils import MilestonesTestCaseMixin
from nose.plugins.attrib import attr
from xmodule.html_module import CourseInfoModule
from xmodule.modulestore import ModuleStoreEnum
@@ -15,13 +14,13 @@ from xmodule.modulestore.xml_importer import import_course_from_xml
from ..testutils import MobileAPITestCase, MobileAuthTestMixin, MobileCourseAccessTestMixin
@attr(shard=3)
@ddt.ddt
class TestUpdates(MobileAPITestCase, MobileAuthTestMixin, MobileCourseAccessTestMixin, MilestonesTestCaseMixin):
"""
Tests for /api/mobile/v0.5/course_info/{course_id}/updates
"""
REVERSE_INFO = {'name': 'course-updates-list', 'params': ['course_id']}
shard = 3
def verify_success(self, response):
super(TestUpdates, self).verify_success(response)
@@ -83,13 +82,13 @@ class TestUpdates(MobileAPITestCase, MobileAuthTestMixin, MobileCourseAccessTest
self.assertIn("Update" + str(num), update_data['content'])
@attr(shard=3)
@ddt.ddt
class TestHandouts(MobileAPITestCase, MobileAuthTestMixin, MobileCourseAccessTestMixin, MilestonesTestCaseMixin):
"""
Tests for /api/mobile/v0.5/course_info/{course_id}/handouts
"""
REVERSE_INFO = {'name': 'course-handouts-list', 'params': ['course_id']}
shard = 3
@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
def test_handouts(self, default_ms):

View File

@@ -12,7 +12,6 @@ from django.test import RequestFactory, override_settings
from django.utils import timezone
from milestones.tests.utils import MilestonesTestCaseMixin
from mock import patch
from nose.plugins.attrib import attr
from lms.djangoapps.certificates.api import generate_user_certificates
from lms.djangoapps.certificates.models import CertificateStatuses
@@ -27,6 +26,7 @@ from mobile_api.testutils import (
MobileCourseAccessTestMixin
)
from openedx.core.lib.courses import course_image_url
from openedx.core.lib.tests import attr
from student.models import CourseEnrollment
from util.milestones_helpers import set_prerequisite_courses
from util.testing import UrlResetMixin

View File

@@ -14,13 +14,13 @@ from django.conf import settings
from edxval import api
from milestones.tests.utils import MilestonesTestCaseMixin
from mock import patch
from nose.plugins.attrib import attr
from mobile_api.models import MobileApiConfig
from mobile_api.testutils import MobileAPITestCase, MobileAuthTestMixin, MobileCourseAccessTestMixin
from openedx.core.djangoapps.course_groups.cohorts import add_user_to_cohort, remove_user_from_cohort
from openedx.core.djangoapps.course_groups.models import CourseUserGroupPartitionGroup
from openedx.core.djangoapps.course_groups.tests.helpers import CohortFactory
from openedx.core.lib.tests import attr
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.factories import ItemFactory
from xmodule.partitions.partitions import Group, UserPartition

View File

@@ -20,7 +20,6 @@ from django.db import DatabaseError
from django.test import TestCase
from django.test.utils import override_settings
from mock import Mock, MagicMock, patch
from nose.plugins.attrib import attr
from opaque_keys.edx.locator import CourseLocator
from course_modes.models import CourseMode
@@ -56,13 +55,13 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@attr(shard=3)
@ddt.ddt
class OrderTest(ModuleStoreTestCase):
"""
Test shopping cart orders (e.g., cart contains various items,
order is taken through various pieces of cart state, etc.)
"""
shard = 3
def setUp(self):
super(OrderTest, self).setUp()
@@ -489,12 +488,13 @@ class OrderItemTest(TestCase):
self.assertEqual(item.get_list_price(), item.list_price)
@attr(shard=3)
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_PAID_COURSE_REGISTRATION': True})
class PaidCourseRegistrationTest(ModuleStoreTestCase):
"""
Paid Course Registration Tests.
"""
shard = 3
def setUp(self):
super(PaidCourseRegistrationTest, self).setUp()

View File

@@ -21,7 +21,6 @@ from django.test import TestCase
from django.test.utils import override_settings
from freezegun import freeze_time
from mock import Mock, patch
from nose.plugins.attrib import attr
from pytz import UTC
from six import text_type
@@ -70,13 +69,13 @@ render_mock = Mock(side_effect=mock_render_to_response)
postpay_mock = Mock()
@attr(shard=3)
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_PAID_COURSE_REGISTRATION': True})
@ddt.ddt
class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
"""
Test shopping cart view under various states
"""
shard = 3
@classmethod
def setUpClass(cls):

View File

@@ -8,7 +8,6 @@ from urllib import urlencode
import ddt
import mock
import pytest
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import get_user_model
@@ -26,7 +25,6 @@ from django.utils.translation import ugettext as _
from edx_oauth2_provider.tests.factories import AccessTokenFactory, ClientFactory, RefreshTokenFactory
from edx_rest_api_client import exceptions
from http.cookies import SimpleCookie
from nose.plugins.attrib import attr
from oauth2_provider.models import AccessToken as dot_access_token
from oauth2_provider.models import RefreshToken as dot_refresh_token
from provider.oauth2.models import AccessToken as dop_access_token
@@ -295,11 +293,10 @@ class StudentAccountUpdateTest(CacheIsolationTestCase, UrlResetMixin):
self.assertFalse(dop_refresh_token.objects.filter(user=user).exists())
@attr(shard=7)
@ddt.ddt
class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMixin, ModuleStoreTestCase):
""" Tests for the student account views that update the user's account information. """
shard = 7
USERNAME = "bob"
EMAIL = "bob@example.com"
PASSWORD = "password"

View File

@@ -9,11 +9,9 @@ import re
from datetime import datetime, timedelta
import ddt
import pytest
from django.contrib.auth.models import User
from django.urls import reverse
from django.db.models import signals
from nose.plugins.attrib import attr
from pytz import UTC
from common.test.utils import disable_signal
@@ -90,12 +88,12 @@ class SupportViewManageUserTests(SupportViewTestCase):
self.assertEqual(test_user.has_usable_password(), False)
@attr(shard=3)
@ddt.ddt
class SupportViewAccessTests(SupportViewTestCase):
"""
Tests for access control of support views.
"""
shard = 3
@ddt.data(*(
(url_name, role, has_access)

View File

@@ -13,7 +13,6 @@ from django.db.models.signals import post_save
from django.utils import translation
from elasticsearch.exceptions import ConnectionError
from mock import patch
from nose.plugins.attrib import attr
from rest_framework.test import APIClient, APITestCase
from search.search_engine_base import SearchEngine
@@ -32,7 +31,6 @@ from ..search_indexes import CourseTeam, CourseTeamIndexer, course_team_post_sav
from .factories import LAST_ACTIVITY_AT, CourseTeamFactory
@attr(shard=1)
class TestDashboard(SharedModuleStoreTestCase):
"""Tests for the Teams dashboard."""
shard = 6

View File

@@ -24,7 +24,6 @@ from django.test.client import Client, RequestFactory
from django.test.utils import override_settings
from django.utils.translation import ugettext as _
from mock import Mock, patch
from nose.plugins.attrib import attr
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locator import CourseLocator
from waffle.testutils import override_switch
@@ -45,6 +44,7 @@ from lms.djangoapps.verify_student.views import (
from openedx.core.djangoapps.embargo.test_utils import restrict_course
from openedx.core.djangoapps.theming.tests.test_util import with_comprehensive_theme
from openedx.core.djangoapps.user_api.accounts.api import get_account_settings
from openedx.core.lib.tests import attr
from shoppingcart.models import CertificateItem, Order
from student.models import CourseEnrollment
from student.tests.factories import CourseEnrollmentFactory, UserFactory

View File

@@ -2,6 +2,6 @@
set -e
export LOWER_PYLINT_THRESHOLD=1000
export UPPER_PYLINT_THRESHOLD=3965
export UPPER_PYLINT_THRESHOLD=3875
export ESLINT_THRESHOLD=5590
export STYLELINT_THRESHOLD=973