TE-2524 Stop using nose.plugins - openedx

This commit is contained in:
Jeremy Bowman
2018-08-02 14:54:44 -04:00
parent 39ccbe3c89
commit c290bf8a07
66 changed files with 114 additions and 158 deletions

View File

@@ -3,7 +3,6 @@ Tests for bookmarks api.
"""
import ddt
from mock import patch
from nose.plugins.attrib import attr
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
@@ -36,13 +35,14 @@ class BookmarkApiEventTestMixin(object):
self.assertFalse(mock_tracker.called) # pylint: disable=maybe-no-member
@attr(shard=9)
@ddt.ddt
@skip_unless_lms
class BookmarksAPITests(BookmarkApiEventTestMixin, BookmarksTestsBase):
"""
These tests cover the parts of the API methods.
"""
shard = 9
def test_get_bookmark(self):
"""
Verifies that get_bookmark returns data as expected.

View File

@@ -8,7 +8,6 @@ import ddt
import mock
import pytz
from freezegun import freeze_time
from nose.plugins.attrib import attr
from opaque_keys.edx.keys import UsageKey
from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator
@@ -224,13 +223,14 @@ class BookmarksTestsBase(ModuleStoreTestCase):
self.assertEqual(bookmark_data['path'], bookmark.path)
@attr(shard=9)
@ddt.ddt
@skip_unless_lms
class BookmarkModelTests(BookmarksTestsBase):
"""
Test the Bookmark model.
"""
shard = 9
def setUp(self):
super(BookmarkModelTests, self).setUp()
@@ -410,13 +410,12 @@ class BookmarkModelTests(BookmarksTestsBase):
self.assertEqual(bookmark.path, [])
@attr(shard=9)
@ddt.ddt
class XBlockCacheModelTest(ModuleStoreTestCase):
"""
Test the XBlockCache model.
"""
shard = 9
COURSE_KEY = CourseLocator(org='test', course='test', run='test')
CHAPTER1_USAGE_KEY = BlockUsageLocator(COURSE_KEY, block_type='chapter', block_id='chapter1')
SECTION1_USAGE_KEY = BlockUsageLocator(COURSE_KEY, block_type='section', block_id='section1')

View File

@@ -2,7 +2,6 @@
Tests for bookmark services.
"""
from nose.plugins.attrib import attr
from opaque_keys.edx.keys import UsageKey
from openedx.core.djangolib.testing.utils import skip_unless_lms
@@ -10,12 +9,12 @@ from ..services import BookmarksService
from .test_models import BookmarksTestsBase
@attr(shard=9)
@skip_unless_lms
class BookmarksServiceTests(BookmarksTestsBase):
"""
Tests the Bookmarks service.
"""
shard = 9
def setUp(self):
super(BookmarksServiceTests, self).setUp()

View File

@@ -2,7 +2,6 @@
Tests for tasks.
"""
import ddt
from nose.plugins.attrib import attr
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.factories import check_mongo_calls, ItemFactory
@@ -11,12 +10,12 @@ from ..tasks import _calculate_course_xblocks_data, _update_xblocks_cache
from .test_models import BookmarksTestsBase
@attr(shard=9)
@ddt.ddt
class XBlockCacheTaskTests(BookmarksTestsBase):
"""
Test the XBlockCache model.
"""
shard = 9
def setUp(self):
super(XBlockCacheTaskTests, self).setUp()

View File

@@ -8,7 +8,6 @@ import ddt
from django.conf import settings
from django.urls import reverse
from mock import patch
from nose.plugins.attrib import attr
from rest_framework.test import APIClient
from openedx.core.djangolib.testing.utils import skip_unless_lms
@@ -61,7 +60,6 @@ class BookmarksViewsTestsBase(BookmarksTestsBase, BookmarkApiEventTestMixin):
return response
@attr(shard=9)
@ddt.ddt
@skip_unless_lms
class BookmarksListViewTests(BookmarksViewsTestsBase):
@@ -70,6 +68,8 @@ class BookmarksListViewTests(BookmarksViewsTestsBase):
GET /api/bookmarks/v1/bookmarks/?course_id={course_id1}
POST /api/bookmarks/v1/bookmarks
"""
shard = 9
@ddt.data(
(1, False),
(10, False),
@@ -366,13 +366,14 @@ class BookmarksListViewTests(BookmarksViewsTestsBase):
)
@attr(shard=9)
@ddt.ddt
@skip_unless_lms
class BookmarksDetailViewTests(BookmarksViewsTestsBase):
"""
This contains the tests for GET & DELETE methods of bookmark.views.BookmarksDetailView class
"""
shard = 9
@ddt.data(
('', False),
('fields=path,display_name', True)

View File

@@ -6,7 +6,6 @@ import datetime
import mock
import pytz
import urlparse
from nose.plugins.attrib import attr
from opaque_keys.edx.keys import CourseKey
from student.tests.factories import AdminFactory
@@ -38,12 +37,12 @@ def fetch_token_mock(*args, **kwargs): # pylint: disable=unused-argument
return
@attr(shard=1)
class APIsTestCase(SharedModuleStoreTestCase):
"""
Unit tests for the API module functions
"""
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE
shard = 1
@classmethod
def setUpClass(cls):

View File

@@ -3,20 +3,19 @@ Test for contentstore signals receiver
"""
import mock
from nose.plugins.attrib import attr
from django.test import TestCase
from opaque_keys.edx.keys import CourseKey
from xmodule.modulestore.django import modulestore, SignalHandler
@attr(shard=2)
class CCXConSignalTestCase(TestCase):
"""
The only tests currently implemented are for verifying that
the call for the ccxcon update are performed correctly by the
course_published signal handler
"""
shard = 2
@mock.patch('openedx.core.djangoapps.ccxcon.tasks.update_ccxcon.delay')
def test_course_published_ccxcon_call(self, mock_upc):

View File

@@ -3,7 +3,6 @@ Tests for the CCXCon celery tasks
"""
import mock
from nose.plugins.attrib import attr
from django.test import TestCase
@@ -11,11 +10,11 @@ from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.ccxcon import api, tasks
@attr(shard=2)
class CCXConTaskTestCase(TestCase):
"""
Tests for CCXCon tasks.
"""
shard = 2
@mock.patch('openedx.core.djangoapps.ccxcon.api.course_info_to_ccxcon')
def test_update_ccxcon_task_ok(self, mock_citc):

View File

@@ -5,11 +5,11 @@ from datetime import datetime
# pylint: disable=protected-access
from collections import namedtuple
from copy import deepcopy
import ddt
import itertools
from nose.plugins.attrib import attr
from unittest import TestCase
import ddt
from openedx.core.lib.graph_traversals import traverse_post_order
from ..block_structure import BlockStructure, BlockStructureModulestoreData
@@ -17,12 +17,13 @@ from ..exceptions import TransformerException
from .helpers import MockXBlock, MockTransformer, ChildrenMapTestMixin
@attr(shard=2)
@ddt.ddt
class TestBlockStructure(TestCase, ChildrenMapTestMixin):
"""
Tests for BlockStructure
"""
shard = 2
@ddt.data(
[],
ChildrenMapTestMixin.SIMPLE_CHILDREN_MAP,
@@ -46,12 +47,13 @@ class TestBlockStructure(TestCase, ChildrenMapTestMixin):
self.assertNotIn(len(children_map) + 1, block_structure)
@attr(shard=2)
@ddt.ddt
class TestBlockStructureData(TestCase, ChildrenMapTestMixin):
"""
Tests for BlockStructureBlockData and BlockStructureModulestoreData
"""
shard = 2
def test_non_versioned_transformer(self):
class TestNonVersionedTransformer(MockTransformer):
"""

View File

@@ -2,7 +2,6 @@
Tests for block_structure_factory.py
"""
from django.test import TestCase
from nose.plugins.attrib import attr
from xmodule.modulestore.exceptions import ItemNotFoundError
from ..store import BlockStructureStore
@@ -13,11 +12,12 @@ from .helpers import (
)
@attr(shard=2)
class TestBlockStructureFactory(TestCase, ChildrenMapTestMixin):
"""
Tests for BlockStructureFactory
"""
shard = 2
def setUp(self):
super(TestBlockStructureFactory, self).setUp()
self.children_map = self.SIMPLE_CHILDREN_MAP

View File

@@ -3,7 +3,6 @@ Tests for manager.py
"""
import ddt
from django.test import TestCase
from nose.plugins.attrib import attr
from ..block_structure import BlockStructureBlockData
from ..config import RAISE_ERROR_WHEN_NOT_FOUND, STORAGE_BACKING_FOR_CACHE, waffle
@@ -89,12 +88,13 @@ class TestTransformer1(MockTransformer):
return data_key + 't1.val1.' + unicode(block_key)
@attr(shard=2)
@ddt.ddt
class TestBlockStructureManager(UsageKeyFactoryMixin, ChildrenMapTestMixin, TestCase):
"""
Test class for BlockStructureManager.
"""
shard = 2
def setUp(self):
super(TestBlockStructureManager, self).setUp()

View File

@@ -2,7 +2,6 @@
Tests for block_structure/cache.py
"""
import ddt
from nose.plugins.attrib import attr
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
@@ -13,13 +12,13 @@ from ..store import BlockStructureStore
from .helpers import ChildrenMapTestMixin, UsageKeyFactoryMixin, MockCache, MockTransformer
@attr(shard=2)
@ddt.ddt
class TestBlockStructureStore(UsageKeyFactoryMixin, ChildrenMapTestMixin, CacheIsolationTestCase):
"""
Tests for BlockStructureStore
"""
ENABLED_CACHES = ['default']
shard = 2
def setUp(self):
super(TestBlockStructureStore, self).setUp()

View File

@@ -3,7 +3,6 @@ Tests for transformer_registry.py
"""
import ddt
from nose.plugins.attrib import attr
from unittest import TestCase
from ..transformer_registry import TransformerRegistry
@@ -31,12 +30,13 @@ class UnregisteredTestTransformer3(MockTransformer):
pass
@attr(shard=2)
@ddt.ddt
class TransformerRegistryTestCase(TestCase):
"""
Test cases for TransformerRegistry.
"""
shard = 2
def tearDown(self):
super(TransformerRegistryTestCase, self).tearDown()
clear_registered_transformers_cache()

View File

@@ -2,7 +2,6 @@
Tests for transformers.py
"""
from mock import MagicMock, patch
from nose.plugins.attrib import attr
from unittest import TestCase
from ..block_structure import BlockStructureModulestoreData
@@ -13,11 +12,12 @@ from .helpers import (
)
@attr(shard=2)
class TestBlockStructureTransformers(ChildrenMapTestMixin, TestCase):
"""
Test class for testing BlockStructureTransformers
"""
shard = 2
class UnregisteredTransformer(MockTransformer):
"""
Mock transformer that is not registered.

View File

@@ -7,7 +7,6 @@ import ddt
import itertools
import math
import mock
from nose.plugins.attrib import attr
import pytz
from django.conf import settings
@@ -41,13 +40,12 @@ from ..models import CourseOverview, CourseOverviewImageSet, CourseOverviewImage
from .factories import CourseOverviewFactory
@attr(shard=3)
@ddt.ddt
class CourseOverviewTestCase(CatalogIntegrationMixin, ModuleStoreTestCase):
"""
Tests for CourseOverview model.
"""
shard = 3
TODAY = timezone.now()
LAST_MONTH = 'last_month'
LAST_WEEK = 'last_week'
@@ -559,13 +557,13 @@ class CourseOverviewTestCase(CatalogIntegrationMixin, ModuleStoreTestCase):
self.assertEqual(course_id_to_overview, None)
@attr(shard=3)
@ddt.ddt
class CourseOverviewImageSetTestCase(ModuleStoreTestCase):
"""
Course thumbnail generation tests.
"""
ENABLED_SIGNALS = ['course_published']
shard = 3
def setUp(self):
"""Create an active CourseOverviewImageConfig with non-default values."""
@@ -1038,12 +1036,12 @@ class CourseOverviewImageSetTestCase(ModuleStoreTestCase):
return course_overview
@attr(shard=3)
@ddt.ddt
class CourseOverviewTabTestCase(ModuleStoreTestCase):
"""
Tests for CourseOverviewTab model.
"""
shard = 3
ENABLED_SIGNALS = ['course_published']

View File

@@ -1,7 +1,6 @@
import datetime
import ddt
from mock import patch
from nose.plugins.attrib import attr
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
@@ -11,7 +10,6 @@ from ..models import CourseOverview
@ddt.ddt
@attr(shard=3)
class CourseOverviewSignalsTestCase(ModuleStoreTestCase):
"""
Tests for CourseOverview signals.
@@ -19,6 +17,7 @@ class CourseOverviewSignalsTestCase(ModuleStoreTestCase):
ENABLED_SIGNALS = ['course_deleted', 'course_published']
TODAY = datetime.datetime.utcnow()
NEXT_WEEK = TODAY + datetime.timedelta(days=7)
shard = 3
@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
def test_caching(self, modulestore_type):

View File

@@ -4,7 +4,6 @@ Tests for cohorts
# pylint: disable=no-member
import ddt
from mock import call, patch
from nose.plugins.attrib import attr
import before_after
from django.contrib.auth.models import User
@@ -29,12 +28,12 @@ from ..models import (
from ..tests.helpers import CohortFactory, CourseCohortFactory, config_course_cohorts, config_course_cohorts_legacy
@attr(shard=2)
@patch("openedx.core.djangoapps.course_groups.cohorts.tracker", autospec=True)
class TestCohortSignals(TestCase):
"""
Test cases to validate event emissions for various cohort-related workflows
"""
shard = 2
def setUp(self):
super(TestCohortSignals, self).setUp()
@@ -135,13 +134,13 @@ class TestCohortSignals(TestCase):
self.assertFalse(mock_tracker.emit.called)
@attr(shard=2)
@ddt.ddt
class TestCohorts(ModuleStoreTestCase):
"""
Test the cohorts feature
"""
MODULESTORE = TEST_DATA_MIXED_MODULESTORE
shard = 2
def setUp(self):
"""
@@ -729,13 +728,13 @@ class TestCohorts(ModuleStoreTestCase):
self.assertEqual("Cohorted must be a boolean", text_type(value_error.exception))
@attr(shard=2)
@ddt.ddt
class TestCohortsAndPartitionGroups(ModuleStoreTestCase):
"""
Test Cohorts and Partitions Groups.
"""
MODULESTORE = TEST_DATA_MIXED_MODULESTORE
shard = 2
def setUp(self):
"""

View File

@@ -4,7 +4,6 @@ Test the partitions and partitions service
"""
import django.test
from mock import patch
from nose.plugins.attrib import attr
from courseware.tests.test_masquerade import StaffMasqueradeTestCase
from student.tests.factories import UserFactory
@@ -15,6 +14,7 @@ from xmodule.modulestore.tests.factories import ToyCourseFactory
from openedx.core.djangoapps.user_api.partition_schemes import RandomUserPartitionScheme
from openedx.core.djangolib.testing.utils import skip_unless_lms
from openedx.core.lib.tests import attr
from ..partition_scheme import CohortPartitionScheme, get_cohorted_user_partition
from ..models import CourseUserGroupPartitionGroup
from ..views import link_cohort_to_partition_group, unlink_cohort_partition_group

View File

@@ -6,14 +6,13 @@ Tests for course group views
import json
from collections import namedtuple
from nose.plugins.attrib import attr
from django.contrib.auth.models import User
from django.http import Http404
from django.test.client import RequestFactory
from django_comment_common.models import CourseDiscussionSettings
from django_comment_common.utils import get_course_discussion_settings
from opaque_keys.edx.locator import CourseLocator
from openedx.core.lib.tests import attr
from student.models import CourseEnrollment
from student.tests.factories import UserFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase

View File

@@ -1,7 +1,6 @@
"""Tests for models supporting Credentials-related functionality."""
from django.test import TestCase, override_settings
from nose.plugins.attrib import attr
from openedx.core.djangoapps.credentials.models import API_VERSION
from openedx.core.djangoapps.credentials.tests.mixins import CredentialsApiConfigMixin
@@ -12,9 +11,9 @@ CREDENTIALS_PUBLIC_SERVICE_URL = 'https://credentials.example.com'
@skip_unless_lms
@attr(shard=2)
class TestCredentialsApiConfig(CredentialsApiConfigMixin, TestCase):
"""Tests covering the CredentialsApiConfig model."""
shard = 2
@override_settings(
CREDENTIALS_INTERNAL_SERVICE_URL=CREDENTIALS_INTERNAL_SERVICE_URL,

View File

@@ -3,7 +3,6 @@ import uuid
from edx_oauth2_provider.tests.factories import ClientFactory
import mock
from nose.plugins.attrib import attr
from provider.constants import CONFIDENTIAL
from openedx.core.djangoapps.credentials.models import CredentialsApiConfig
@@ -18,10 +17,10 @@ UTILS_MODULE = 'openedx.core.djangoapps.credentials.utils'
@skip_unless_lms
@attr(shard=2)
@mock.patch(UTILS_MODULE + '.get_edx_api_data')
class TestGetCredentials(CredentialsApiConfigMixin, CacheIsolationTestCase):
""" Tests for credentials utility functions. """
shard = 2
ENABLED_CACHES = ['default']

View File

@@ -12,7 +12,6 @@ from django.contrib.auth.models import User
from django.core import mail
from django.db import connection
from django.test.utils import override_settings
from nose.plugins.attrib import attr
from opaque_keys.edx.keys import CourseKey
from course_modes.models import CourseMode
@@ -202,13 +201,13 @@ class CreditApiTestBase(ModuleStoreTestCase):
)
@attr(shard=2)
@skip_unless_lms
@ddt.ddt
class CreditRequirementApiTests(CreditApiTestBase):
"""
Test Python API for credit requirements and eligibility.
"""
shard = 2
@ddt.data(
[
@@ -874,12 +873,12 @@ class CreditRequirementApiTests(CreditApiTestBase):
self.assertIn(providers_email_message, text_content_first)
@attr(shard=2)
@ddt.ddt
class CreditProviderIntegrationApiTests(CreditApiTestBase):
"""
Test Python API for credit provider integration.
"""
shard = 2
USER_INFO = {
"username": "bob",
@@ -1201,7 +1200,6 @@ class CreditProviderIntegrationApiTests(CreditApiTestBase):
self.assertEqual(statuses[0]["status"], expected_status)
@attr(shard=2)
@skip_unless_lms
@override_settings(
ECOMMERCE_API_URL=TEST_API_URL,
@@ -1210,6 +1208,8 @@ class CreditProviderIntegrationApiTests(CreditApiTestBase):
@ddt.ddt
class CourseApiTests(CreditApiTestBase):
"""Test Python API for course product information."""
shard = 2
def setUp(self):
super(CourseApiTests, self).setUp()
self.worker_user = User.objects.create_user(username=TEST_ECOMMERCE_WORKER)

View File

@@ -5,7 +5,6 @@ Tests for credit course models.
import ddt
from django.test import TestCase
from nose.plugins.attrib import attr
from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.credit.models import (
@@ -31,12 +30,12 @@ def add_credit_course(course_key):
return credit_course
@attr(shard=2)
@ddt.ddt
class CreditEligibilityModelTests(TestCase):
"""
Tests for credit models used to track credit eligibility.
"""
shard = 2
def setUp(self):
super(CreditEligibilityModelTests, self).setUp()

View File

@@ -5,15 +5,14 @@ from __future__ import unicode_literals
from django.test import TestCase
from nose.plugins.attrib import attr
from openedx.core.djangoapps.credit import serializers
from openedx.core.djangoapps.credit.tests.factories import CreditProviderFactory, CreditEligibilityFactory
from student.tests.factories import UserFactory
@attr(shard=2)
class CreditProviderSerializerTests(TestCase):
""" CreditProviderSerializer tests. """
shard = 2
def test_data(self):
""" Verify the correct fields are serialized. """
@@ -32,9 +31,9 @@ class CreditProviderSerializerTests(TestCase):
self.assertDictEqual(serializer.data, expected)
@attr(shard=2)
class CreditEligibilitySerializerTests(TestCase):
""" CreditEligibilitySerializer tests. """
shard = 2
def test_data(self):
""" Verify the correct fields are serialized. """

View File

@@ -3,7 +3,6 @@ Tests for the Credit xBlock service
"""
import ddt
from nose.plugins.attrib import attr
from course_modes.models import CourseMode
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
@@ -16,12 +15,12 @@ from openedx.core.djangoapps.credit.api.eligibility import set_credit_requiremen
from student.models import CourseEnrollment, UserProfile
@attr(shard=2)
@ddt.ddt
class CreditServiceTests(ModuleStoreTestCase):
"""
Tests for the Credit xBlock service
"""
shard = 2
def setUp(self, **kwargs):
super(CreditServiceTests, self).setUp()

View File

@@ -8,7 +8,6 @@ from datetime import timedelta, datetime
from mock import MagicMock
from django.test.client import RequestFactory
from nose.plugins.attrib import attr
from course_modes.models import CourseMode
from student.models import CourseEnrollment
from student.tests.factories import UserFactory
@@ -23,7 +22,6 @@ from openedx.core.djangoapps.credit.signals import listen_for_grade_calculation
from openedx.core.djangolib.testing.utils import skip_unless_lms
@attr(shard=2)
@skip_unless_lms
@ddt.ddt
class TestMinGradedRequirementStatus(ModuleStoreTestCase):
@@ -34,6 +32,7 @@ class TestMinGradedRequirementStatus(ModuleStoreTestCase):
"""
VALID_DUE_DATE = datetime.now(pytz.UTC) + timedelta(days=20)
EXPIRED_DUE_DATE = datetime.now(pytz.UTC) - timedelta(days=20)
shard = 2
DATES = {
'valid': VALID_DUE_DATE,

View File

@@ -3,16 +3,12 @@
Tests for digital signatures used to validate messages to/from credit providers.
"""
from nose.plugins.attrib import attr
from django.test import TestCase
from django.test.utils import override_settings
from openedx.core.djangoapps.credit import signature
@attr(shard=2)
@override_settings(CREDIT_PROVIDER_SECRET_KEYS={
"asu": u'abcd1234'
})
@@ -20,6 +16,7 @@ class SignatureTest(TestCase):
"""
Tests for digital signatures.
"""
shard = 2
def test_unicode_secret_key(self):
# Test a key that has type `unicode` but consists of ASCII characters

View File

@@ -3,7 +3,6 @@ Tests for credit course tasks.
"""
import mock
from nose.plugins.attrib import attr
from datetime import datetime
from openedx.core.djangoapps.credit.api import get_credit_requirements
@@ -16,7 +15,6 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from edx_proctoring.api import create_exam
@attr(shard=2)
class TestTaskExecution(ModuleStoreTestCase):
"""Set of tests to ensure that the task code will do the right thing when
executed directly.
@@ -25,6 +23,7 @@ class TestTaskExecution(ModuleStoreTestCase):
allows us to ensure that when the listener is executed, it is done as
expected.
"""
shard = 2
def mocked_set_credit_requirements(course_key, requirements): # pylint: disable=no-self-argument, unused-argument
"""Used as a side effect when mocking method credit api method

View File

@@ -16,7 +16,6 @@ from django.urls import reverse
from django.test import TestCase, Client
from django.test.utils import override_settings
from edx_oauth2_provider.tests.factories import AccessTokenFactory, ClientFactory
from nose.plugins.attrib import attr
from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.credit.models import (
@@ -28,6 +27,7 @@ from openedx.core.djangoapps.credit.tests.factories import (
CreditProviderFactory, CreditEligibilityFactory, CreditCourseFactory, CreditRequestFactory,
)
from openedx.core.djangolib.testing.utils import skip_unless_lms
from openedx.core.lib.tests import attr
from openedx.core.lib.token_utils import JwtBuilder
from student.tests.factories import UserFactory, AdminFactory
from util.date_utils import to_timestamp

View File

@@ -4,7 +4,6 @@ Tests for EmbargoMiddleware
from contextlib import contextmanager
import mock
from nose.plugins.attrib import attr
import pygeoip
import ddt
@@ -38,14 +37,13 @@ from mock import patch
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {})
@attr(shard=3)
@ddt.ddt
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
@skip_unless_lms
@mock.patch.dict(settings.FEATURES, {'EMBARGO': True})
class EmbargoCheckAccessApiTests(ModuleStoreTestCase):
"""Test the embargo API calls to determine whether a user has access. """
shard = 3
ENABLED_CACHES = ['default', 'mongo_metadata_inheritance', 'loc_cache']
def setUp(self):

View File

@@ -3,7 +3,6 @@ Tests for EmbargoMiddleware with CountryAccessRules
"""
from mock import patch
from nose.plugins.attrib import attr
import ddt
from django.urls import reverse
@@ -21,7 +20,6 @@ from ..models import RestrictedCourse, IPFilter
from ..test_utils import restrict_course
@attr(shard=3)
@ddt.ddt
@skip_unless_lms
class EmbargoMiddlewareAccessTests(UrlResetMixin, ModuleStoreTestCase):
@@ -36,6 +34,7 @@ class EmbargoMiddlewareAccessTests(UrlResetMixin, ModuleStoreTestCase):
PASSWORD = 'secret'
URLCONF_MODULES = ['openedx.core.djangoapps.embargo']
shard = 3
@patch.dict(settings.FEATURES, {'EMBARGO': True})
def setUp(self):

View File

@@ -8,7 +8,6 @@ import unittest
from importlib import import_module
from urllib import urlencode
import pytest
from ddt import ddt, data
from django.conf import settings
from django.http import HttpResponseRedirect
@@ -23,7 +22,6 @@ from openedx.core.djangoapps.external_auth.views import (
)
from openedx.core.djangoapps.user_api import accounts as accounts_settings
from mock import patch
from nose.plugins.attrib import attr
from six import text_type
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
@@ -77,7 +75,6 @@ def gen_all_identities():
yield _build_identity_dict(mail, display_name, given_name, surname)
@attr(shard=3)
@ddt
@override_settings(SESSION_ENGINE='django.contrib.sessions.backends.cache')
class ShibSPTest(CacheIsolationTestCase):
@@ -85,6 +82,7 @@ class ShibSPTest(CacheIsolationTestCase):
Tests for the Shibboleth SP, which communicates via request.META
(Apache environment variables set by mod_shib)
"""
shard = 3
ENABLED_CACHES = ['default']

View File

@@ -5,7 +5,6 @@ Tests for CourseDetails
import datetime
import ddt
from pytz import UTC
from nose.plugins.attrib import attr
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
@@ -14,12 +13,13 @@ from xmodule.modulestore.tests.factories import CourseFactory
from openedx.core.djangoapps.models.course_details import CourseDetails, ABOUT_ATTRIBUTES
@attr(shard=2)
@ddt.ddt
class CourseDetailsTestCase(ModuleStoreTestCase):
"""
Tests the first course settings page (course dates, overview, etc.).
"""
shard = 2
def setUp(self):
super(CourseDetailsTestCase, self).setUp()
self.course = CourseFactory.create()

View File

@@ -11,7 +11,6 @@ from django.test import TestCase
from django.test.utils import override_settings
import ddt
import mock
from nose.plugins.attrib import attr
import piexif
from PIL import Image
from six import text_type
@@ -29,7 +28,6 @@ from ..images import (
from .helpers import make_image_file, make_uploaded_file
@attr(shard=2)
@ddt.ddt
@skip_unless_lms
class TestValidateUploadedImage(TestCase):
@@ -41,6 +39,7 @@ class TestValidateUploadedImage(TestCase):
valid_file_types=_get_valid_file_types()
)
)
shard = 2
def check_validation_result(self, uploaded_file, expected_failure_message):
"""
@@ -125,13 +124,13 @@ class TestValidateUploadedImage(TestCase):
self.assertEqual(text_type(ctx.exception), file_upload_bad_mimetype)
@attr(shard=2)
@ddt.ddt
@skip_unless_lms
class TestGenerateProfileImages(TestCase):
"""
Test create_profile_images
"""
shard = 2
def check_exif_orientation(self, image, expected_orientation):
"""
@@ -223,12 +222,13 @@ class TestGenerateProfileImages(TestCase):
yield name, image
@attr(shard=2)
@skip_unless_lms
class TestRemoveProfileImages(TestCase):
"""
Test remove_profile_images
"""
shard = 2
def test_remove(self):
"""
Ensure that the outcome of calling the function is that the named images

View File

@@ -3,7 +3,6 @@ Test cases for the HTTP endpoints of the profile image api.
"""
from contextlib import closing
import datetime
from nose.plugins.attrib import attr
from pytz import UTC
from django.urls import reverse
@@ -23,6 +22,7 @@ from openedx.core.djangoapps.user_api.accounts.image_helpers import (
get_profile_image_storage,
)
from openedx.core.djangolib.testing.utils import skip_unless_lms
from openedx.core.lib.tests import attr
from ..images import create_profile_images, ImageValidationError
from ..views import LOG_MESSAGE_CREATE, LOG_MESSAGE_DELETE

View File

@@ -3,7 +3,6 @@ This module contains tests for programs-related signals and signal handlers.
"""
from django.test import TestCase
from nose.plugins.attrib import attr
import mock
from opaque_keys.edx.keys import CourseKey
@@ -18,7 +17,6 @@ TEST_USERNAME = 'test-user'
TEST_COURSE_KEY = CourseKey.from_string('course-v1:edX+test_course+1')
@attr(shard=2)
# The credentials app isn't installed for the CMS.
@skip_unless_lms
@mock.patch('openedx.core.djangoapps.programs.tasks.v1.tasks.award_program_certificates.delay')
@@ -31,6 +29,7 @@ class CertAwardedReceiverTest(TestCase):
"""
Tests for the `handle_course_cert_awarded` signal handler function.
"""
shard = 2
@property
def signal_kwargs(self):
@@ -80,7 +79,6 @@ class CertAwardedReceiverTest(TestCase):
self.assertEqual(mock_task.call_args[0], (TEST_USERNAME,))
@attr(shard=2)
# The credentials app isn't installed for the CMS.
@skip_unless_lms
@mock.patch('openedx.core.djangoapps.programs.tasks.v1.tasks.award_course_certificate.delay')
@@ -93,6 +91,7 @@ class CertChangedReceiverTest(TestCase):
"""
Tests for the `handle_course_cert_changed` signal handler function.
"""
shard = 2
def setUp(self):
super(CertChangedReceiverTest, self).setUp()

View File

@@ -12,7 +12,6 @@ from django.conf import settings
from django.urls import reverse
from django.test import TestCase
from django.test.utils import override_settings
from nose.plugins.attrib import attr
from pytz import utc
from course_modes.models import CourseMode
@@ -57,11 +56,12 @@ UTILS_MODULE = 'openedx.core.djangoapps.programs.utils'
@ddt.ddt
@attr(shard=2)
@skip_unless_lms
@mock.patch(UTILS_MODULE + '.get_programs')
class TestProgramProgressMeter(TestCase):
"""Tests of the program progress utility class."""
shard = 2
def setUp(self):
super(TestProgramProgressMeter, self).setUp()

View File

@@ -11,7 +11,6 @@ from django.http import HttpResponse, HttpResponseRedirect, SimpleCookie
from django.test import TestCase
from django.test.utils import override_settings
from mock import patch
from nose.plugins.attrib import attr
from openedx.core.djangolib.testing.utils import get_mock_request
@@ -21,11 +20,12 @@ from ..middleware import SafeSessionMiddleware, SafeCookieData
from .test_utils import TestSafeSessionsLogMixin
@attr(shard=2)
class TestSafeSessionProcessRequest(TestSafeSessionsLogMixin, TestCase):
"""
Test class for SafeSessionMiddleware.process_request
"""
shard = 2
def setUp(self):
super(TestSafeSessionProcessRequest, self).setUp()
self.user = UserFactory.create()
@@ -122,12 +122,13 @@ class TestSafeSessionProcessRequest(TestSafeSessionsLogMixin, TestCase):
self.assert_user_in_session()
@attr(shard=2)
@ddt.ddt
class TestSafeSessionProcessResponse(TestSafeSessionsLogMixin, TestCase):
"""
Test class for SafeSessionMiddleware.process_response
"""
shard = 2
def setUp(self):
super(TestSafeSessionProcessResponse, self).setUp()
self.user = UserFactory.create()
@@ -225,13 +226,14 @@ class TestSafeSessionProcessResponse(TestSafeSessionsLogMixin, TestCase):
self.assert_response_with_delete_cookie()
@attr(shard=2)
@ddt.ddt
class TestSafeSessionMiddleware(TestSafeSessionsLogMixin, TestCase):
"""
Test class for SafeSessionMiddleware, testing both
process_request and process_response.
"""
shard = 2
def setUp(self):
super(TestSafeSessionMiddleware, self).setUp()
self.user = UserFactory.create()

View File

@@ -7,19 +7,19 @@ import ddt
from django.test import TestCase
import itertools
from mock import patch
from nose.plugins.attrib import attr
from time import time
from ..middleware import SafeCookieData, SafeCookieError
from .test_utils import TestSafeSessionsLogMixin
@attr(shard=2)
@ddt.ddt
class TestSafeCookieData(TestSafeSessionsLogMixin, TestCase):
"""
Test class for SafeCookieData
"""
shard = 2
def setUp(self):
super(TestSafeCookieData, self).setUp()
self.session_id = 'test_session_id'

View File

@@ -15,7 +15,6 @@ from django.core import mail
from django.test import TestCase
from django.test.client import RequestFactory
from mock import Mock, patch
from nose.plugins.attrib import attr
from nose.tools import raises
from six import iteritems
@@ -48,6 +47,7 @@ from openedx.core.djangoapps.user_api.errors import (
UserNotFound
)
from openedx.core.djangolib.testing.utils import skip_unless_lms
from openedx.core.lib.tests import attr
from student.models import PendingEmailChange
from student.tests.factories import UserFactory
from student.tests.tests import UserSettingsEventTestMixin

View File

@@ -4,7 +4,6 @@ Tests for helpers.py
import datetime
import hashlib
from mock import patch
from nose.plugins.attrib import attr
from pytz import UTC
from django.test import TestCase
@@ -17,13 +16,14 @@ TEST_SIZES = {'full': 50, 'small': 10}
TEST_PROFILE_IMAGE_UPLOAD_DT = datetime.datetime(2002, 1, 9, 15, 43, 01, tzinfo=UTC)
@attr(shard=2)
@patch.dict('django.conf.settings.PROFILE_IMAGE_SIZES_MAP', TEST_SIZES, clear=True)
@skip_unless_lms
class ProfileImageUrlTestCase(TestCase):
"""
Tests for profile image URL generation helpers.
"""
shard = 2
def setUp(self):
super(ProfileImageUrlTestCase, self).setUp()
self.user = UserFactory()

View File

@@ -14,7 +14,6 @@ from django.test.testcases import TransactionTestCase
from django.test.utils import override_settings
import mock
from nose.plugins.attrib import attr
import pytz
from rest_framework.test import APIClient, APITestCase
@@ -162,11 +161,11 @@ class UserAPITestCase(APITestCase):
@ddt.ddt
@skip_unless_lms
@attr(shard=2)
class TestOwnUsernameAPI(CacheIsolationTestCase, UserAPITestCase):
"""
Unit tests for the Accounts API.
"""
shard = 2
ENABLED_CACHES = ['default']
@@ -221,11 +220,11 @@ class TestOwnUsernameAPI(CacheIsolationTestCase, UserAPITestCase):
{'full': 50, 'small': 10},
clear=True
)
@attr(shard=2)
class TestAccountsAPI(CacheIsolationTestCase, UserAPITestCase):
"""
Unit tests for the Accounts API.
"""
shard = 2
ENABLED_CACHES = ['default']
@@ -812,12 +811,12 @@ class TestAccountsAPI(CacheIsolationTestCase, UserAPITestCase):
)
@attr(shard=2)
@skip_unless_lms
class TestAccountAPITransactions(TransactionTestCase):
"""
Tests the transactional behavior of the account API
"""
shard = 2
def setUp(self):
super(TestAccountAPITransactions, self).setUp()

View File

@@ -4,16 +4,16 @@ Test the user course tag API.
from django.test import TestCase
from student.tests.factories import UserFactory
from nose.plugins.attrib import attr
from openedx.core.djangoapps.user_api.course_tag import api as course_tag_api
from opaque_keys.edx.locator import CourseLocator
@attr(shard=2)
class TestCourseTagAPI(TestCase):
"""
Test the user service
"""
shard = 2
def setUp(self):
super(TestCourseTagAPI, self).setUp()
self.user = UserFactory.create()

View File

@@ -5,7 +5,6 @@ import tempfile
import shutil
import csv
from collections import defaultdict
from nose.plugins.attrib import attr
import ddt
from django.contrib.auth.models import User
@@ -24,12 +23,11 @@ from openedx.core.djangoapps.user_api.management.commands import email_opt_in_li
from openedx.core.djangolib.testing.utils import skip_unless_lms
@attr(shard=2)
@ddt.ddt
@skip_unless_lms
class EmailOptInListTest(ModuleStoreTestCase):
"""Tests for the email opt-in list management command. """
shard = 2
USER_USERNAME = "test_user"
USER_FIRST_NAME = u"Ṫëṡẗ"
USER_LAST_NAME = u"Űśéŕ"

View File

@@ -5,7 +5,6 @@ Unit tests for preference APIs.
import datetime
import ddt
from mock import patch
from nose.plugins.attrib import attr
from pytz import common_timezones, utc
from django.contrib.auth.models import User
@@ -40,7 +39,6 @@ from ...preferences.api import (
)
@attr(shard=2)
@skip_unless_lms
class TestPreferenceAPI(CacheIsolationTestCase):
"""
@@ -49,6 +47,7 @@ class TestPreferenceAPI(CacheIsolationTestCase):
are not specified.
"""
password = "test"
shard = 2
def setUp(self):
super(TestPreferenceAPI, self).setUp()
@@ -328,7 +327,6 @@ class TestPreferenceAPI(CacheIsolationTestCase):
)
@attr(shard=2)
@ddt.ddt
class UpdateEmailOptInTests(ModuleStoreTestCase):
"""
@@ -337,6 +335,7 @@ class UpdateEmailOptInTests(ModuleStoreTestCase):
USERNAME = u'frank-underwood'
PASSWORD = u'ṕáśśẃőŕd'
EMAIL = u'frank+underwood@example.com'
shard = 2
@ddt.data(
# Check that a 27 year old can opt-in

View File

@@ -4,8 +4,6 @@ Tests for verified track content views.
import json
from nose.plugins.attrib import attr
from django.http import Http404
from django.test.client import RequestFactory
@@ -18,12 +16,12 @@ from ..models import VerifiedTrackCohortedCourse
from ..views import cohorting_settings
@attr(shard=2)
@skip_unless_lms
class CohortingSettingsTestCase(SharedModuleStoreTestCase):
"""
Tests the `cohort_discussion_topics` view.
"""
shard = 2
@classmethod
def setUpClass(cls):

View File

@@ -7,16 +7,15 @@ import json
from unittest import TestCase
from mako.template import Template
from nose.plugins.attrib import attr
from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_string
@attr(shard=2)
class TestJSUtils(TestCase):
"""
Test JS utils
"""
shard = 2
class NoDefaultEncoding(object):
"""

View File

@@ -9,15 +9,14 @@ import ddt
from django.utils.translation import ugettext as _
from django.utils.translation import ungettext
from mako.template import Template
from nose.plugins.attrib import attr
from openedx.core.djangolib.markup import HTML, Text, strip_all_tags_but_br
@attr(shard=2)
@ddt.ddt
class FormatHtmlTest(unittest.TestCase):
"""Test that we can format plain strings and HTML into them properly."""
shard = 2
@ddt.data(
(u"hello", u"hello"),

View File

@@ -20,7 +20,6 @@ from django.test import TestCase
from django.test.utils import override_settings
from django.utils.http import urlencode
from django.utils.timezone import now
from nose.plugins.attrib import attr
from oauth2_provider import models as dot_models
from rest_framework import status
from rest_framework.permissions import IsAuthenticated
@@ -73,12 +72,13 @@ urlpatterns = [
]
@attr(shard=2)
@ddt.ddt
@unittest.skipUnless(settings.FEATURES.get("ENABLE_OAUTH2_PROVIDER"), "OAuth2 not enabled")
@override_settings(ROOT_URLCONF=__name__)
class OAuth2Tests(TestCase):
"""OAuth 2.0 authentication"""
shard = 2
def setUp(self):
super(OAuth2Tests, self).setUp()
self.dop_adapter = adapters.DOPAdapter()

View File

@@ -3,16 +3,15 @@ Test Custom Exceptions
"""
import ddt
from django.test import TestCase
from nose.plugins.attrib import attr
from rest_framework import exceptions as drf_exceptions
@attr(shard=2)
@ddt.ddt
class TestDictExceptionsAllowDictDetails(TestCase):
"""
Test that standard DRF exceptions can return dictionaries in error details.
"""
shard = 2
def test_drf_errors_are_not_coerced_to_strings(self):
# Demonstrate that dictionaries in exceptions are not coerced to strings.

View File

@@ -3,7 +3,6 @@ TestCases verifying proper behavior of custom DRF request parsers.
"""
from collections import namedtuple
from nose.plugins.attrib import attr
from io import BytesIO
from rest_framework import exceptions
@@ -12,11 +11,12 @@ from rest_framework.test import APITestCase, APIRequestFactory
from openedx.core.lib.api import parsers
@attr(shard=2)
class TestTypedFileUploadParser(APITestCase):
"""
Tests that verify the behavior of TypedFileUploadParser
"""
shard = 2
def setUp(self):
super(TestTypedFileUploadParser, self).setUp()
self.parser = parsers.TypedFileUploadParser()

View File

@@ -4,7 +4,6 @@ import ddt
from django.contrib.auth.models import AnonymousUser
from django.http import Http404
from django.test import TestCase, RequestFactory
from nose.plugins.attrib import attr
from rest_framework.generics import GenericAPIView
from student.roles import CourseStaffRole, CourseInstructorRole
@@ -31,9 +30,9 @@ class TestCcxObject(TestObject):
self.coach = user
@attr(shard=2)
class IsCourseStaffInstructorTests(TestCase):
""" Test for IsCourseStaffInstructor permission class. """
shard = 2
def setUp(self):
super(IsCourseStaffInstructorTests, self).setUp()
@@ -65,9 +64,9 @@ class IsCourseStaffInstructorTests(TestCase):
self.assertFalse(self.permission.has_object_permission(self.request, None, self.obj))
@attr(shard=2)
class IsMasterCourseStaffInstructorTests(TestCase):
""" Test for IsMasterCourseStaffInstructorTests permission class. """
shard = 2
def setUp(self):
super(IsMasterCourseStaffInstructorTests, self).setUp()
@@ -110,10 +109,10 @@ class IsMasterCourseStaffInstructorTests(TestCase):
self.permission.has_permission(post_request, None)
@attr(shard=2)
@ddt.ddt
class IsStaffOrOwnerTests(TestCase):
""" Tests for IsStaffOrOwner permission class. """
shard = 2
def setUp(self):
super(IsStaffOrOwnerTests, self).setUp()

View File

@@ -4,7 +4,6 @@ Tests for the gating API
import unittest
from mock import patch, Mock
from nose.plugins.attrib import attr
from ddt import ddt, data, unpack
from django.conf import settings
from lms.djangoapps.gating import api as lms_gating_api
@@ -17,12 +16,12 @@ from openedx.core.lib.gating.exceptions import GatingValidationError
from student.tests.factories import UserFactory
@attr(shard=2)
@ddt
class TestGatingApi(ModuleStoreTestCase, MilestonesTestCaseMixin):
"""
Tests for the gating API
"""
shard = 2
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE

View File

@@ -3,17 +3,16 @@ Tests for the plugin API
"""
from django.test import TestCase
from nose.plugins.attrib import attr
from openedx.core.lib.plugins import PluginError
from openedx.core.lib.course_tabs import CourseTabPluginManager
@attr(shard=2)
class TestCourseTabApi(TestCase):
"""
Unit tests for the course tab plugin API
"""
shard = 2
def test_get_plugin(self):
"""

View File

@@ -3,15 +3,14 @@
from unittest import TestCase
from mock import Mock, patch
from nose.plugins.attrib import attr
import xmodule.tabs as xmodule_tabs
from openedx.core.lib.course_tabs import CourseTabPluginManager
@attr(shard=2)
class CourseTabPluginManagerTestCase(TestCase):
"""Test cases for CourseTabPluginManager class"""
shard = 2
@patch('openedx.core.lib.course_tabs.CourseTabPluginManager.get_available_plugins')
def test_get_tab_types(self, get_available_plugins):
@@ -39,9 +38,9 @@ class CourseTabPluginManagerTestCase(TestCase):
)
@attr(shard=2)
class KeyCheckerTestCase(TestCase):
"""Test cases for KeyChecker class"""
shard = 2
def setUp(self):
super(KeyCheckerTestCase, self).setUp()
@@ -58,9 +57,9 @@ class KeyCheckerTestCase(TestCase):
xmodule_tabs.key_checker(self.invalid_keys)(self.dict_value)
@attr(shard=2)
class NeedNameTestCase(TestCase):
"""Test cases for NeedName validator"""
shard = 2
def setUp(self):
super(NeedNameTestCase, self).setUp()

View File

@@ -4,7 +4,6 @@ Tests for functionality in openedx/core/lib/courses.py.
import ddt
from django.test.utils import override_settings
from nose.plugins.attrib import attr
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
@@ -13,10 +12,10 @@ from xmodule.modulestore.tests.factories import CourseFactory
from ..courses import course_image_url
@attr(shard=2)
@ddt.ddt
class CourseImageTestCase(ModuleStoreTestCase):
"""Tests for course image URLs."""
shard = 2
def verify_url(self, expected_url, actual_url):
"""

View File

@@ -5,7 +5,6 @@ import json
import httpretty
import mock
from django.core.cache import cache
from nose.plugins.attrib import attr
from openedx.core.djangoapps.catalog.models import CatalogIntegration
from openedx.core.djangoapps.catalog.tests.mixins import CatalogIntegrationMixin
@@ -20,11 +19,11 @@ TEST_API_URL = 'http://www-internal.example.com/api'
@skip_unless_lms
@attr(shard=2)
@httpretty.activate
class TestGetEdxApiData(CatalogIntegrationMixin, CredentialsApiConfigMixin, CacheIsolationTestCase):
"""Tests for edX API data retrieval utility."""
ENABLED_CACHES = ['default']
shard = 2
def setUp(self):
super(TestGetEdxApiData, self).setUp()

View File

@@ -5,16 +5,14 @@ Tests for graph traversal generator functions.
from collections import defaultdict
from unittest import TestCase
from nose.plugins.attrib import attr
from ..graph_traversals import traverse_post_order, traverse_pre_order, traverse_topologically
@attr(shard=2)
class TestGraphTraversals(TestCase):
"""
Test Class for graph traversal generator functions.
"""
shard = 2
def setUp(self):
# Creates a test graph with the following disconnected

View File

@@ -2,14 +2,12 @@
import ddt
import jwt
from django.test import TestCase
from nose.plugins.attrib import attr
from openedx.core.djangoapps.oauth_dispatch.tests import mixins
from openedx.core.lib.token_utils import JwtBuilder
from student.tests.factories import UserFactory, UserProfileFactory
@attr(shard=2)
@ddt.ddt
class TestJwtBuilder(mixins.AccessTokenMixin, TestCase):
"""
@@ -17,6 +15,7 @@ class TestJwtBuilder(mixins.AccessTokenMixin, TestCase):
"""
expires_in = 10
shard = 2
def setUp(self):
super(TestJwtBuilder, self).setUp()

View File

@@ -7,7 +7,6 @@ import uuid
import ddt
from django.test.client import RequestFactory
from nose.plugins.attrib import attr
from web_fragments.fragment import Fragment
from openedx.core.lib.url_utils import quote_slashes
@@ -26,12 +25,12 @@ from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@attr(shard=2)
@ddt.ddt
class TestXblockUtils(SharedModuleStoreTestCase):
"""
Tests for xblock utility functions.
"""
shard = 2
@classmethod
def setUpClass(cls):

View File

@@ -3,7 +3,6 @@ from collections import namedtuple
import ddt
import itertools
import mock
from nose.plugins.attrib import attr
import random
import string
from unittest import TestCase
@@ -53,13 +52,13 @@ def _make_attribute_test_cases():
)
@attr('shard2')
@ddt.ddt
class DiscussionXBlockImportExportTests(TestCase):
"""
Import and export tests
"""
DISCUSSION_XBLOCK_LOCATION = "openedx.core.lib.xblock_builtin.xblock_discussion.xblock_discussion.DiscussionXBlock"
shard = 2
def setUp(self):
"""

View File

@@ -2,7 +2,6 @@
import uuid
import mock
from nose.plugins.attrib import attr
from django.conf import settings
from django.core.urlresolvers import reverse
@@ -60,12 +59,12 @@ class JournalBundleViewTest(CacheIsolationTestCase, SiteMixin):
self.assertContains(response, journal_bundle["courses"][0]["course_runs"][0]["title"])
@attr(shard=1)
@mock.patch.dict(settings.FEATURES, {"JOURNALS_ENABLED": True})
class JournalIndexViewTest(SiteMixin, ModuleStoreTestCase):
"""
Tests for Journals Listing in Marketing Pages.
"""
shard = 1
def setUp(self):
super(JournalIndexViewTest, self).setUp()

View File

@@ -6,7 +6,6 @@ import unittest
from django.conf import settings
from django.urls import reverse
from nose.plugins.attrib import attr
from six import text_type
from lms.djangoapps.courseware.tests.factories import GlobalStaffFactory
@@ -134,13 +133,14 @@ class TestCrowdsourceHinter(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
self.assert_request_status_code(200, self.course_url)
@attr(shard=6)
class TestHinterFunctions(TestCrowdsourceHinter):
"""
Check that the essential functions of the hinter work as expected.
Tests cover the basic process of receiving a hint, adding a new hint,
and rating/reporting hints.
"""
shard = 6
def test_get_hint_with_no_hints(self):
"""
Check that a generic statement is returned when no default/specific hints exist

View File

@@ -15,8 +15,8 @@ from django.urls import reverse
from ddt import data, ddt
from lms.djangoapps.courseware.tests.factories import GlobalStaffFactory
from lms.djangoapps.courseware.tests.helpers import LoginEnrollmentTestCase
from nose.plugins.attrib import attr
from six import text_type
from openedx.core.lib.tests import attr
from openedx.core.lib.url_utils import quote_slashes
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory

View File

@@ -7,7 +7,6 @@ import unittest
from django.conf import settings
from django.contrib.auth.models import User
from django.urls import reverse
from nose.plugins.attrib import attr
from lms.djangoapps.courseware.tests.factories import GlobalStaffFactory
from lms.djangoapps.courseware.tests.helpers import LoginEnrollmentTestCase
@@ -191,7 +190,6 @@ class TestReviewXBlock(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
self.enroll(course, verify=True)
@attr(shard=6)
@ddt.ddt
class TestReviewFunctions(TestReviewXBlock):
"""
@@ -199,6 +197,8 @@ class TestReviewFunctions(TestReviewXBlock):
Tests cover the basic process of receiving a hint, adding a new hint,
and rating/reporting hints.
"""
shard = 6
def test_no_review_problems(self):
"""
If a user has not seen any problems, they should

View File

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