Commit 08993aea by Christine Lytwynec

Merge pull request #7959 from edx/clytwynec/split_lms_unittests_into_shards

Clytwynec/split lms unittests into shards
parents 435b75b1 8d0683e2
......@@ -3,9 +3,12 @@ Tests for the Video Branding configuration.
"""
from django.test import TestCase
from django.core.exceptions import ValidationError
from nose.plugins.attrib import attr
from branding.models import BrandingInfoConfig
@attr('shard_1')
class BrandingInfoConfigTest(TestCase):
"""
Test the BrandingInfoConfig model.
......
......@@ -12,6 +12,7 @@ from django.test.client import RequestFactory
from pytz import UTC
from mock import patch, Mock
from nose.plugins.attrib import attr
from edxmako.shortcuts import render_to_response
from branding.views import index
......@@ -43,6 +44,7 @@ def mock_render_to_response(*args, **kwargs):
RENDER_MOCK = Mock(side_effect=mock_render_to_response)
@attr('shard_1')
class AnonymousIndexPageTest(ModuleStoreTestCase):
"""
Tests that anonymous users can access the '/' page, Need courses with start date
......@@ -116,6 +118,7 @@ class AnonymousIndexPageTest(ModuleStoreTestCase):
self.assertEqual(response._headers.get("location")[1], "/login") # pylint: disable=protected-access
@attr('shard_1')
class PreRequisiteCourseCatalog(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Test to simulate and verify fix for disappearing courses in
......@@ -163,6 +166,7 @@ class PreRequisiteCourseCatalog(ModuleStoreTestCase, LoginEnrollmentTestCase):
self.assertIn('course that has pre requisite', resp.content)
@attr('shard_1')
class IndexPageCourseCardsSortingTests(ModuleStoreTestCase):
"""
Test for Index page course cards sorting
......
......@@ -4,6 +4,7 @@ Unit tests for student optouts from course email
"""
import json
from mock import patch, Mock
from nose.plugins.attrib import attr
from django.core import mail
from django.core.management import call_command
......@@ -16,6 +17,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@attr('shard_1')
@patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message'))
class TestOptoutCourseEmails(ModuleStoreTestCase):
"""
......
......@@ -4,6 +4,7 @@ Unit tests for sending course email
"""
import json
from mock import patch, Mock
from nose.plugins.attrib import attr
import os
from unittest import skipIf
......@@ -85,6 +86,7 @@ class EmailSendFromDashboardTestCase(ModuleStoreTestCase):
}
@attr('shard_1')
@patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False})
@patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message'))
class TestEmailSendFromDashboardMockedHtmlToText(EmailSendFromDashboardTestCase):
......@@ -313,6 +315,7 @@ class TestEmailSendFromDashboardMockedHtmlToText(EmailSendFromDashboardTestCase)
self.assertItemsEqual(outbox_contents, should_send_contents)
@attr('shard_1')
@patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False})
@skipIf(os.environ.get("TRAVIS") == 'true', "Skip this test in Travis CI.")
class TestEmailSendFromDashboard(EmailSendFromDashboardTestCase):
......
......@@ -11,6 +11,7 @@ from django.core.urlresolvers import reverse
from django.db import DatabaseError
import json
from mock import patch, Mock
from nose.plugins.attrib import attr
from smtplib import SMTPDataError, SMTPServerDisconnected, SMTPConnectError
from bulk_email.models import CourseEmail, SEND_TO_ALL
......@@ -35,6 +36,7 @@ class EmailTestException(Exception):
pass
@attr('shard_1')
@patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message'))
@patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False})
class TestEmailErrors(ModuleStoreTestCase):
......
......@@ -4,6 +4,7 @@ Unit tests for bulk-email-related forms.
"""
from django.conf import settings
from mock import patch
from nose.plugins.attrib import attr
from bulk_email.models import CourseAuthorization, CourseEmailTemplate
from bulk_email.forms import CourseAuthorizationAdminForm, CourseEmailTemplateForm
......@@ -15,6 +16,7 @@ from xmodule.modulestore.django import modulestore
from xmodule.modulestore import ModuleStoreEnum
@attr('shard_1')
class CourseAuthorizationFormTest(ModuleStoreTestCase):
"""Test the CourseAuthorizationAdminForm form for Mongo-backed courses."""
......
......@@ -8,11 +8,13 @@ from django.conf import settings
from student.tests.factories import UserFactory
from mock import patch, Mock
from nose.plugins.attrib import attr
from bulk_email.models import CourseEmail, SEND_TO_STAFF, CourseEmailTemplate, CourseAuthorization
from opaque_keys.edx.locations import SlashSeparatedCourseKey
@attr('shard_1')
@patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message'))
class CourseEmailTest(TestCase):
"""Test the CourseEmail model."""
......@@ -57,6 +59,7 @@ class CourseEmailTest(TestCase):
CourseEmail.create(course_id, sender, to_option, subject, html_message)
@attr('shard_1')
class NoCourseEmailTemplateTest(TestCase):
"""Test the CourseEmailTemplate model without loading the template data."""
......@@ -65,6 +68,7 @@ class NoCourseEmailTemplateTest(TestCase):
CourseEmailTemplate.get_template()
@attr('shard_1')
class CourseEmailTemplateTest(TestCase):
"""Test the CourseEmailTemplate model."""
......@@ -134,6 +138,7 @@ class CourseEmailTemplateTest(TestCase):
template.render_plaintext("My new plain text.", context)
@attr('shard_1')
class CourseAuthorizationTest(TestCase):
"""Test the CourseAuthorization model."""
......
......@@ -9,6 +9,7 @@ import json
from uuid import uuid4
from itertools import cycle, chain, repeat
from mock import patch, Mock
from nose.plugins.attrib import attr
from smtplib import SMTPServerDisconnected, SMTPDataError, SMTPConnectError, SMTPAuthenticationError
from boto.ses.exceptions import (
SESAddressNotVerifiedError,
......@@ -71,6 +72,7 @@ def my_update_subtask_status(entry_id, current_task_id, new_subtask_status):
update_subtask_status(entry_id, current_task_id, new_subtask_status)
@attr('shard_1')
@patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message'))
class TestBulkEmailInstructorTask(InstructorTaskCourseTestCase):
"""Tests instructor task that send bulk email."""
......
......@@ -4,6 +4,7 @@ tests for the models
from datetime import datetime, timedelta
from django.utils.timezone import UTC
from mock import patch
from nose.plugins.attrib import attr
from student.models import CourseEnrollment # pylint: disable=import-error
from student.roles import CourseCcxCoachRole # pylint: disable=import-error
from student.tests.factories import ( # pylint: disable=import-error
......@@ -29,6 +30,7 @@ from ..models import (
from ..overrides import override_field_for_ccx
@attr('shard_1')
class TestCcxMembership(ModuleStoreTestCase):
"""Unit tests for the CcxMembership model
"""
......@@ -135,6 +137,7 @@ class TestCcxMembership(ModuleStoreTestCase):
self.assertTrue(self.has_ccx_future_membership(user))
@attr('shard_1')
class TestCCX(ModuleStoreTestCase):
"""Unit tests for the CustomCourseForEdX model
"""
......
......@@ -4,6 +4,7 @@ tests for overrides
import datetime
import mock
import pytz
from nose.plugins.attrib import attr
from courseware.field_overrides import OverrideFieldData # pylint: disable=import-error
from django.test.utils import override_settings
......@@ -17,6 +18,7 @@ from ..overrides import override_field_for_ccx
from .test_views import flatten, iter_blocks
@attr('shard_1')
@override_settings(FIELD_OVERRIDE_PROVIDERS=(
'ccx.overrides.CustomCoursesForEdxOverrideProvider',))
class TestFieldOverrides(ModuleStoreTestCase):
......
"""
test utils
"""
from nose.plugins.attrib import attr
from ccx.models import ( # pylint: disable=import-error
CcxMembership,
CcxFutureMembership,
......@@ -21,6 +23,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@attr('shard_1')
class TestEmailEnrollmentState(ModuleStoreTestCase):
"""unit tests for the EmailEnrollmentState class
"""
......@@ -120,6 +123,7 @@ class TestEmailEnrollmentState(ModuleStoreTestCase):
self.assertTrue(member in representation)
@attr('shard_1')
# TODO: deal with changes in behavior for auto_enroll
class TestGetEmailParams(ModuleStoreTestCase):
"""tests for ccx.utils.get_email_params
......@@ -176,6 +180,7 @@ class TestGetEmailParams(ModuleStoreTestCase):
self.assertTrue(auto['auto_enroll'])
@attr('shard_1')
# TODO: deal with changes in behavior for auto_enroll
class TestEnrollEmail(ModuleStoreTestCase):
"""tests for the enroll_email function from ccx.utils
......@@ -356,6 +361,7 @@ class TestEnrollEmail(ModuleStoreTestCase):
self.assertEqual(self.outbox, [])
@attr('shard_1')
# TODO: deal with changes in behavior for auto_enroll
class TestUnenrollEmail(ModuleStoreTestCase):
"""Tests for the unenroll_email function from ccx.utils"""
......@@ -504,6 +510,7 @@ class TestUnenrollEmail(ModuleStoreTestCase):
self.assertEqual(self.outbox, [])
@attr('shard_1')
class TestUserCCXList(ModuleStoreTestCase):
"""Unit tests for ccx.utils.get_all_ccx_for_user"""
......
......@@ -6,6 +6,7 @@ import json
import re
import pytz
from mock import patch
from nose.plugins.attrib import attr
from capa.tests.response_xml_factory import StringResponseXMLFactory
from courseware.field_overrides import OverrideFieldData # pylint: disable=import-error
......@@ -55,6 +56,7 @@ def intercept_renderer(path, context):
return response
@attr('shard_1')
class TestCoachDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Tests for Custom Courses views.
......@@ -433,6 +435,7 @@ def patched_get_children(self, usage_key_filter=None): # pylint: disable=missin
return list(iter_children())
@attr('shard_1')
@override_settings(FIELD_OVERRIDE_PROVIDERS=(
'ccx.overrides.CustomCoursesForEdxOverrideProvider',))
@patch('xmodule.x_module.XModuleMixin.get_children', patched_get_children, spec=True)
......@@ -584,6 +587,7 @@ class TestCCXGrades(ModuleStoreTestCase, LoginEnrollmentTestCase):
self.assertEqual(len(grades['section_breakdown']), 4)
@attr('shard_1')
class TestSwitchActiveCCX(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""Verify the view for switching which CCX is active, if any
"""
......
......@@ -5,6 +5,7 @@ import ddt
from django.test import TestCase, RequestFactory
from django.test.utils import override_settings
from mock import patch
from nose.plugins.attrib import attr
from opaque_keys.edx.locator import CourseLocator
from xmodule.modulestore.tests.factories import CourseFactory
......@@ -25,6 +26,7 @@ from certificates.queue import XQueueCertInterface, XQueueAddToQueueError
from certificates.tests.factories import GeneratedCertificateFactory
@attr('shard_1')
class CertificateDownloadableStatusTests(ModuleStoreTestCase):
"""Tests for the `certificate_downloadable_status` helper function. """
......@@ -104,6 +106,7 @@ class CertificateDownloadableStatusTests(ModuleStoreTestCase):
)
@attr('shard_1')
@override_settings(CERT_QUEUE='certificates')
class GenerateUserCertificatesTest(ModuleStoreTestCase):
"""Tests for generating certificates for students. """
......@@ -164,6 +167,7 @@ class GenerateUserCertificatesTest(ModuleStoreTestCase):
yield mock_send_to_queue
@attr('shard_1')
@ddt.ddt
class CertificateGenerationEnabledTest(TestCase):
"""Test enabling/disabling self-generated certificates for a course. """
......@@ -225,6 +229,7 @@ class CertificateGenerationEnabledTest(TestCase):
self.assertEqual(expect_enabled, actual_enabled)
@attr('shard_1')
class GenerateExampleCertificatesTest(TestCase):
"""Test generation of example certificates. """
......
"""Tests for the create_fake_certs management command. """
from django.test import TestCase
from django.core.management.base import CommandError
from nose.plugins.attrib import attr
from opaque_keys.edx.locator import CourseLocator
from student.tests.factories import UserFactory
......@@ -8,6 +9,7 @@ from certificates.management.commands import create_fake_cert
from certificates.models import GeneratedCertificate
@attr('shard_1')
class CreateFakeCertTest(TestCase):
"""Tests for the create_fake_certs management command. """
......
......@@ -3,6 +3,7 @@ from django.conf import settings
from django.core.exceptions import ValidationError
from django.test import TestCase
from django.test.utils import override_settings
from nose.plugins.attrib import attr
from opaque_keys.edx.locator import CourseLocator
from certificates.models import (
......@@ -15,6 +16,7 @@ FEATURES_INVALID_FILE_PATH = settings.FEATURES.copy()
FEATURES_INVALID_FILE_PATH['CERTS_HTML_VIEW_CONFIG_PATH'] = 'invalid/path/to/config.json'
@attr('shard_1')
class ExampleCertificateTest(TestCase):
"""Tests for the ExampleCertificate model. """
......@@ -80,6 +82,7 @@ class ExampleCertificateTest(TestCase):
self.assertIs(result, None)
@attr('shard_1')
class CertificateHtmlViewConfigurationTest(TestCase):
"""
Test the CertificateHtmlViewConfiguration model.
......
......@@ -3,6 +3,7 @@
from contextlib import contextmanager
import json
from mock import patch, Mock
from nose.plugins.attrib import attr
from django.test import TestCase
from django.test.utils import override_settings
......@@ -24,6 +25,7 @@ from certificates.queue import XQueueCertInterface
from certificates.models import ExampleCertificateSet, ExampleCertificate
@attr('shard_1')
@override_settings(CERT_QUEUE='certificates')
class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase):
"""Test the "add to queue" operation of the XQueue interface. """
......@@ -53,6 +55,7 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase):
self.assertIn('https://edx.org/update_certificate?key=', actual_header['lms_callback_url'])
@attr('shard_1')
@override_settings(CERT_QUEUE='certificates')
class XQueueCertInterfaceExampleCertificateTest(TestCase):
"""Tests for the XQueue interface for certificate generation. """
......
"""Tests for the resubmit_error_certificates management command. """
import ddt
from django.core.management.base import CommandError
from nose.plugins.attrib import attr
from opaque_keys.edx.locator import CourseLocator
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
......@@ -10,6 +11,7 @@ from certificates.management.commands import resubmit_error_certificates
from certificates.models import GeneratedCertificate, CertificateStatuses
@attr('shard_1')
@ddt.ddt
class ResubmitErrorCertificatesTest(ModuleStoreTestCase):
"""Tests for the resubmit_error_certificates management command. """
......
......@@ -3,6 +3,7 @@
import json
import ddt
from uuid import uuid4
from nose.plugins.attrib import attr
from django.conf import settings
from django.core.cache import cache
......@@ -26,6 +27,7 @@ FEATURES_WITH_CERTS_DISABLED = settings.FEATURES.copy()
FEATURES_WITH_CERTS_DISABLED['CERTIFICATES_HTML_VIEW'] = False
@attr('shard_1')
@ddt.ddt
class UpdateExampleCertificateViewTest(TestCase):
"""Tests for the XQueue callback that updates example certificates. """
......@@ -167,6 +169,7 @@ class UpdateExampleCertificateViewTest(TestCase):
self.assertEqual(content['return_code'], 0)
@attr('shard_1')
class CertificatesViewsTests(ModuleStoreTestCase):
"""
Tests for the manual refund page
......
......@@ -4,6 +4,7 @@ Tests for the certificates models.
from ddt import ddt, data, unpack
from mock import patch
from django.conf import settings
from nose.plugins.attrib import attr
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
......@@ -24,6 +25,7 @@ from util.milestones_helpers import (
)
@attr('shard_1')
@ddt
class CertificatesModelTest(ModuleStoreTestCase):
"""
......
......@@ -7,6 +7,7 @@ import json
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
from mock import patch
from nose.plugins.attrib import attr
from capa.tests.response_xml_factory import StringResponseXMLFactory
from courseware.tests.factories import StudentModuleFactory
......@@ -26,6 +27,7 @@ from class_dashboard.views import has_instructor_access_for_class
USER_COUNT = 11
@attr('shard_1')
class TestGetProblemGradeDistribution(ModuleStoreTestCase):
"""
Tests related to class_dashboard/dashboard_data.py
......
......@@ -5,6 +5,7 @@ import json
from django.test.client import RequestFactory
from mock import patch
from nose.plugins.attrib import attr
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
......@@ -12,6 +13,7 @@ from class_dashboard import views
from student.tests.factories import AdminFactory
@attr('shard_1')
class TestViews(ModuleStoreTestCase):
"""
Tests related to class_dashboard/views.py
......
......@@ -2,6 +2,7 @@
import json
from uuid import uuid4
from nose.plugins.attrib import attr
from ddt import ddt, data
from django.core.urlresolvers import reverse
......@@ -33,6 +34,7 @@ class UserMixin(object):
self.client.login(username=self.user.username, password='test')
@attr('shard_1')
@ddt
@override_settings(ECOMMERCE_API_URL=TEST_API_URL, ECOMMERCE_API_SIGNING_KEY=TEST_API_SIGNING_KEY)
class BasketsViewTests(EnrollmentEventTestMixin, UserMixin, ModuleStoreTestCase):
......@@ -303,6 +305,7 @@ class OrdersViewTests(BasketsViewTests):
self.url = reverse('commerce:orders')
@attr('shard_1')
@override_settings(ECOMMERCE_API_URL=TEST_API_URL, ECOMMERCE_API_SIGNING_KEY=TEST_API_SIGNING_KEY)
class BasketOrderViewTests(UserMixin, TestCase):
""" Tests for the basket order view. """
......@@ -337,6 +340,7 @@ class BasketOrderViewTests(UserMixin, TestCase):
self.assertEqual(response.status_code, 403)
@attr('shard_1')
class ReceiptViewTests(TestCase):
""" Tests for the receipt view. """
......
......@@ -3,6 +3,7 @@ Tests for wiki permissions
"""
from django.contrib.auth.models import Group
from nose.plugins.attrib import attr
from student.tests.factories import UserFactory
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
......@@ -51,6 +52,7 @@ class TestWikiAccessBase(ModuleStoreTestCase):
]
@attr('shard_1')
class TestWikiAccess(TestWikiAccessBase):
"""Test wiki access for course staff."""
def setUp(self):
......@@ -111,6 +113,7 @@ class TestWikiAccess(TestWikiAccessBase):
self.assertFalse(user_is_article_course_staff(course_staff, self.wiki_310b.article))
@attr('shard_1')
class TestWikiAccessForStudent(TestWikiAccessBase):
"""Test access for students."""
def setUp(self):
......@@ -126,6 +129,7 @@ class TestWikiAccessForStudent(TestWikiAccessBase):
self.assertFalse(user_is_article_course_staff(self.student, page.article))
@attr('shard_1')
class TestWikiAccessForNumericalCourseNumber(TestWikiAccessBase):
"""Test staff has access if course number is numerical and wiki slug has an underscore appended."""
def setUp(self):
......@@ -145,6 +149,7 @@ class TestWikiAccessForNumericalCourseNumber(TestWikiAccessBase):
self.assertTrue(user_is_article_course_staff(course_staff, page.article))
@attr('shard_1')
class TestWikiAccessForOldFormatCourseStaffGroups(TestWikiAccessBase):
"""Test staff has access if course group has old format."""
def setUp(self):
......
......@@ -3,6 +3,7 @@ Tests for wiki middleware.
"""
from django.test.client import Client
from nose.plugins.attrib import attr
from wiki.models import URLPath
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
......@@ -12,6 +13,7 @@ from courseware.tests.factories import InstructorFactory
from course_wiki.views import get_or_create_root
@attr('shard_1')
class TestWikiAccessMiddleware(ModuleStoreTestCase):
"""Tests for WikiAccessMiddleware."""
......
from django.core.urlresolvers import reverse
from nose.plugins.attrib import attr
from courseware.tests.tests import LoginEnrollmentTestCase
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
......@@ -7,6 +8,7 @@ from xmodule.modulestore.tests.factories import CourseFactory
from mock import patch
@attr('shard_1')
class WikiRedirectTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Tests for wiki course redirection.
......
......@@ -2,6 +2,7 @@
import fnmatch
from mock import Mock
from nose.plugins.attrib import attr
import os.path
import textwrap
......@@ -138,6 +139,7 @@ class HistoryCleanerTest(TransactionTestCase):
self.assertEqual(self.parse_rows(rows), self.read_history())
@attr('shard_1')
class HistoryCleanerNoDbTest(HistoryCleanerTest):
"""Tests of StudentModuleHistoryCleaner with db access mocked."""
......@@ -208,6 +210,7 @@ class HistoryCleanerNoDbTest(HistoryCleanerTest):
smhc.delete_history.assert_called_once_with([42, 23, 15, 8])
@attr('shard_1')
class HistoryCleanerWitDbTest(HistoryCleanerTest):
"""Tests of StudentModuleHistoryCleaner with a real db."""
......@@ -394,6 +397,7 @@ class SmhcForTestingMain(SmhcSayStubbed):
self.say("(not really committing)")
@attr('shard_1')
class HistoryCleanerMainTest(HistoryCleanerTest):
"""Tests of StudentModuleHistoryCleaner.main(), using SmhcForTestingMain."""
......
......@@ -3,6 +3,7 @@
"""Tests for Django management commands"""
import json
from nose.plugins.attrib import attr
from path import path
import shutil
from StringIO import StringIO
......@@ -35,6 +36,7 @@ TEST_DATA_MIXED_XML_MODULESTORE = mixed_store_config(
)
@attr('shard_1')
class CommandsTestBase(ModuleStoreTestCase):
"""
Base class for testing different django commands.
......
......@@ -8,6 +8,7 @@ from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from mock import patch
from nose.plugins.attrib import attr
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from course_modes.models import CourseMode
......@@ -32,6 +33,7 @@ REG_STR = "<form id=\"class_enroll_form\" method=\"post\" data-remote=\"true\" a
SHIB_ERROR_STR = "The currently logged-in user account does not have permission to enroll in this course."
@attr('shard_1')
class AboutTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Tests about xblock.
......@@ -180,6 +182,7 @@ class AboutTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
self.assertEqual(resp.status_code, 200)
@attr('shard_1')
class AboutTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Tests for the course about page
......@@ -211,6 +214,7 @@ class AboutTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase):
self.assertIn(self.xml_data, resp.content)
@attr('shard_1')
class AboutWithCappedEnrollmentsTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
This test case will check the About page when a course has a capped enrollment
......@@ -261,6 +265,7 @@ class AboutWithCappedEnrollmentsTestCase(LoginEnrollmentTestCase, ModuleStoreTes
self.assertNotIn(REG_STR, resp.content)
@attr('shard_1')
class AboutWithInvitationOnly(ModuleStoreTestCase):
"""
This test case will check the About page when a course is invitation only.
......@@ -307,6 +312,7 @@ class AboutWithInvitationOnly(ModuleStoreTestCase):
self.assertIn(REG_STR, resp.content)
@attr('shard_1')
@patch.dict(settings.FEATURES, {'RESTRICT_ENROLL_BY_REG_METHOD': True})
class AboutTestCaseShibCourse(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
......@@ -347,6 +353,7 @@ class AboutTestCaseShibCourse(LoginEnrollmentTestCase, ModuleStoreTestCase):
self.assertIn(REG_STR, resp.content)
@attr('shard_1')
class AboutWithClosedEnrollment(ModuleStoreTestCase):
"""
This test case will check the About page for a course that has enrollment start/end
......@@ -390,6 +397,7 @@ class AboutWithClosedEnrollment(ModuleStoreTestCase):
self.assertNotIn('<span class="important-dates-item-text">$10</span>', resp.content)
@attr('shard_1')
@patch.dict(settings.FEATURES, {'ENABLE_SHOPPING_CART': True})
@patch.dict(settings.FEATURES, {'ENABLE_PAID_COURSE_REGISTRATION': True})
class AboutPurchaseCourseTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
......
......@@ -4,6 +4,7 @@ import pytz
from django.test import TestCase
from django.core.urlresolvers import reverse
from mock import Mock, patch
from nose.plugins.attrib import attr
from opaque_keys.edx.locations import SlashSeparatedCourseKey
import courseware.access as access
......@@ -28,6 +29,7 @@ from util.milestones_helpers import (
# pylint: disable=protected-access
@attr('shard_1')
class AccessTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Tests for the various access controls on the student dashboard
......@@ -368,6 +370,7 @@ class AccessTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
self.assertEqual(response.status_code, 200)
@attr('shard_1')
class UserRoleTestCase(TestCase):
"""
Tests for user roles.
......
......@@ -2,6 +2,7 @@
Test the course_info xblock
"""
import mock
from nose.plugins.attrib import attr
from django.core.urlresolvers import reverse
from opaque_keys.edx.locations import SlashSeparatedCourseKey
......@@ -14,6 +15,7 @@ from student.models import CourseEnrollment
from .helpers import LoginEnrollmentTestCase
@attr('shard_1')
class CourseInfoTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Tests for the Course Info page
......@@ -61,6 +63,7 @@ class CourseInfoTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
self.assertFalse(enrollment_exists)
@attr('shard_1')
class CourseInfoTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Tests for the Course Info page for an XML course
......
......@@ -3,6 +3,7 @@ Python tests for the Survey workflows
"""
from collections import OrderedDict
from nose.plugins.attrib import attr
from django.core.urlresolvers import reverse
......@@ -13,6 +14,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from courseware.tests.helpers import LoginEnrollmentTestCase
@attr('shard_1')
class SurveyViewsTests(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
All tests for the views.py file
......
......@@ -5,6 +5,7 @@ Tests for course access
import ddt
import itertools
import mock
from nose.plugins.attrib import attr
from django.conf import settings
from django.test.utils import override_settings
......@@ -34,6 +35,7 @@ CMS_BASE_TEST = 'testcms'
TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT
@attr('shard_1')
class CoursesTest(ModuleStoreTestCase):
"""Test methods related to fetching courses."""
......@@ -52,6 +54,7 @@ class CoursesTest(ModuleStoreTestCase):
self.assertEqual(cms_url, get_cms_block_link(self.course, 'course'))
@attr('shard_1')
class ModuleStoreBranchSettingTest(ModuleStoreTestCase):
"""Test methods related to the modulestore branch setting."""
@mock.patch(
......@@ -77,6 +80,7 @@ class ModuleStoreBranchSettingTest(ModuleStoreTestCase):
self.assertEqual(_get_modulestore_branch_setting(), 'fake_default_branch')
@attr('shard_1')
@override_settings(CMS_BASE=CMS_BASE_TEST)
class MongoCourseImageTestCase(ModuleStoreTestCase):
"""Tests for course image URLs when using a mongo modulestore."""
......@@ -132,6 +136,7 @@ class MongoCourseImageTestCase(ModuleStoreTestCase):
)
@attr('shard_1')
class XmlCourseImageTestCase(XModuleXmlImportTest):
"""Tests for course image URLs when using an xml modulestore."""
......@@ -149,6 +154,7 @@ class XmlCourseImageTestCase(XModuleXmlImportTest):
self.assertEquals(course_image_url(course), u'/static/xml_test_course/before after.jpg')
@attr('shard_1')
class CoursesRenderTest(ModuleStoreTestCase):
"""Test methods related to rendering courses content."""
......@@ -196,6 +202,7 @@ class CoursesRenderTest(ModuleStoreTestCase):
self.assertIn("this module is temporarily unavailable", course_about)
@attr('shard_1')
class XmlCoursesRenderTest(ModuleStoreTestCase):
"""Test methods related to rendering courses content for an XML course."""
MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE
......@@ -219,6 +226,7 @@ class XmlCoursesRenderTest(ModuleStoreTestCase):
self.assertIn("this module is temporarily unavailable", course_info)
@attr('shard_1')
@ddt.ddt
class CourseInstantiationTests(ModuleStoreTestCase):
"""
......
from django.test import TestCase
from nose.plugins.attrib import attr
from xmodule.modulestore.django import modulestore
from opaque_keys.edx.locations import SlashSeparatedCourseKey
@attr('shard_1')
class TestDraftModuleStore(TestCase):
"""
Test the draft modulestore
......
......@@ -4,6 +4,7 @@ Tests use cases related to LMS Entrance Exam behavior, such as gated content acc
from django.conf import settings
from django.test.client import RequestFactory
from django.core.urlresolvers import reverse
from nose.plugins.attrib import attr
from courseware.model_data import FieldDataCache
from courseware.module_render import get_module, toc_for_course
......@@ -34,6 +35,7 @@ from mock import patch, Mock
import mock
@attr('shard_1')
class EntranceExamTestCases(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Check that content is properly gated. Create a test course from scratch to mess with.
......
......@@ -5,10 +5,12 @@ from django.test import TestCase
from django.test.utils import override_settings
from mock import patch
from nose.plugins.attrib import attr
import sys
@attr('shard_1')
class FaviconTestCase(TestCase):
def setUp(self):
......
......@@ -2,6 +2,7 @@
Tests for `field_overrides` module.
"""
import unittest
from nose.plugins.attrib import attr
from django.test import TestCase
from django.test.utils import override_settings
......@@ -18,6 +19,7 @@ from ..field_overrides import (
TESTUSER = "testuser"
@attr('shard_1')
@override_settings(FIELD_OVERRIDE_PROVIDERS=(
'courseware.tests.test_field_overrides.TestOverrideProvider',))
class OverrideFieldDataTests(TestCase):
......@@ -89,6 +91,7 @@ class OverrideFieldDataTests(TestCase):
self.assertIsInstance(data, DictFieldData)
@attr('shard_1')
class ResolveDottedTests(unittest.TestCase):
"""
Tests for `resolve_dotted`.
......
......@@ -4,12 +4,14 @@ edx.org uses an edx footer but other instances use an Open edX footer.
"""
from mock import patch
from nose.plugins.attrib import attr
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
@attr('shard_1')
class TestFooter(TestCase):
SOCIAL_MEDIA_URLS = {
......
......@@ -3,6 +3,7 @@ Test grade calculation.
"""
from django.http import Http404
from mock import patch
from nose.plugins.attrib import attr
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from courseware.grades import grade, iterate_grades_for
......@@ -25,6 +26,7 @@ def _grade_with_errors(student, request, course, keep_raw_scores=False):
return grade(student, request, course, keep_raw_scores=keep_raw_scores)
@attr('shard_1')
class TestGradeIteration(ModuleStoreTestCase):
"""
Test iteration through student gradesets.
......
......@@ -4,6 +4,7 @@ access control rules.
"""
import ddt
from nose.plugins.attrib import attr
from stevedore.extension import Extension, ExtensionManager
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
......@@ -50,6 +51,7 @@ def resolve_attrs(test_method):
return _wrapper
@attr('shard_1')
@ddt.ddt
class GroupAccessTestCase(ModuleStoreTestCase):
"""
......
......@@ -2,11 +2,13 @@
Tests i18n in courseware
"""
import re
from nose.plugins.attrib import attr
from django.test import TestCase
from django.test.utils import override_settings
@attr('shard_1')
@override_settings(LANGUAGES=(('eo', 'Esperanto'),))
class I18nTestCase(TestCase):
"""
......
......@@ -3,6 +3,7 @@
from collections import OrderedDict
import json
import mock
from nose.plugins.attrib import attr
import oauthlib
import urllib
......@@ -17,6 +18,7 @@ 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.
......@@ -122,6 +124,7 @@ class TestLTI(BaseTestXmodule):
self.assertEqual(generated_content, expected_content)
@attr('shard_1')
class TestLTIModuleListing(ModuleStoreTestCase):
"""
a test for the rest endpoint that lists LTI modules in a course
......
......@@ -3,6 +3,7 @@ Unit tests for masquerade.
"""
import json
from mock import patch
from nose.plugins.attrib import attr
from datetime import datetime
from django.core.urlresolvers import reverse
......@@ -121,6 +122,7 @@ class MasqueradeTestCase(ModuleStoreTestCase, LoginEnrollmentTestCase):
self.assertEqual(show_answer_expected, "Show Answer" in problem_html)
@attr('shard_1')
class NormalStudentVisibilityTest(MasqueradeTestCase):
"""
Verify the course displays as expected for a "normal" student (to ensure test setup is correct).
......@@ -175,6 +177,7 @@ class StaffMasqueradeTestCase(MasqueradeTestCase):
return response
@attr('shard_1')
class TestStaffMasqueradeAsStudent(StaffMasqueradeTestCase):
"""
Check for staff being able to masquerade as student.
......@@ -212,6 +215,7 @@ class TestStaffMasqueradeAsStudent(StaffMasqueradeTestCase):
self.verify_show_answer_present(True)
@attr('shard_1')
class TestGetMasqueradingGroupId(StaffMasqueradeTestCase):
"""
Check for staff being able to masquerade as belonging to a group.
......
......@@ -4,6 +4,7 @@ Tests related to the Microsites feature
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from nose.plugins.attrib import attr
from courseware.tests.helpers import LoginEnrollmentTestCase
from course_modes.models import CourseMode
......@@ -13,6 +14,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
@attr('shard_1')
class TestMicrosites(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
This is testing of the Microsite feature
......
......@@ -6,6 +6,7 @@ from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
from django.http import Http404
from mock import patch
from nose.plugins.attrib import attr
import courseware.courses as courses
from courseware.middleware import RedirectUnenrolledMiddleware
......@@ -13,6 +14,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@attr('shard_1')
class CoursewareMiddlewareTestCase(ModuleStoreTestCase):
"""Tests that courseware middleware is correctly redirected"""
......
......@@ -3,6 +3,7 @@ Test for lms courseware app, module data (runtime data storage for XBlocks)
"""
import json
from mock import Mock, patch
from nose.plugins.attrib import attr
from functools import partial
from courseware.model_data import DjangoKeyValueStore
......@@ -52,6 +53,7 @@ class StudentModuleFactory(cmfStudentModuleFactory):
course_id = course_id
@attr('shard_1')
class TestInvalidScopes(TestCase):
def setUp(self):
super(TestInvalidScopes, self).setUp()
......@@ -72,6 +74,7 @@ class TestInvalidScopes(TestCase):
self.assertRaises(InvalidScopeError, self.kvs.set_many, {key: 'value'})
@attr('shard_1')
class OtherUserFailureTestMixin(object):
"""
Mixin class to add test cases for failures when a user trying to use the kvs is not
......@@ -96,6 +99,7 @@ class OtherUserFailureTestMixin(object):
self.kvs.set(self.other_key_factory(self.existing_field_name), "new_value")
@attr('shard_1')
class TestStudentModuleStorage(OtherUserFailureTestMixin, TestCase):
"""Tests for user_state storage via StudentModule"""
other_key_factory = partial(DjangoKeyValueStore.Key, Scope.user_state, 2, location('usage_id')) # user_id=2, not 1
......@@ -206,6 +210,7 @@ class TestStudentModuleStorage(OtherUserFailureTestMixin, TestCase):
self.assertEquals(len(exception_context.exception.saved_field_names), 0)
@attr('shard_1')
class TestMissingStudentModule(TestCase):
def setUp(self):
super(TestMissingStudentModule, self).setUp()
......@@ -253,6 +258,7 @@ class TestMissingStudentModule(TestCase):
self.assertFalse(self.kvs.has(user_state_key('a_field')))
@attr('shard_1')
class StorageTestBase(object):
"""
A base class for that gets subclassed when testing each of the scopes.
......
......@@ -5,6 +5,7 @@ Test for lms courseware app, module render unit
import ddt
import itertools
import json
from nose.plugins.attrib import attr
from functools import partial
from bson import ObjectId
......@@ -74,6 +75,7 @@ class EmptyXModuleDescriptor(XModuleDescriptor): # pylint: disable=abstract-met
module_class = EmptyXModule
@attr('shard_1')
@ddt.ddt
class ModuleRenderTestCase(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
......@@ -258,6 +260,7 @@ class ModuleRenderTestCase(ModuleStoreTestCase, LoginEnrollmentTestCase):
self.assertEqual(hash_resource(resources), 'a76e27c8e80ca3efd7ce743093aa59e0')
@attr('shard_1')
class TestHandleXBlockCallback(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Test the handle_xblock_callback function
......@@ -435,6 +438,7 @@ class TestHandleXBlockCallback(ModuleStoreTestCase, LoginEnrollmentTestCase):
self.assertEquals(len(doc('div.xblock-student_view-videosequence')), 1)
@attr('shard_1')
@ddt.ddt
class TestTOC(ModuleStoreTestCase):
"""Check the Table of Contents for a course"""
......@@ -531,6 +535,7 @@ class TestTOC(ModuleStoreTestCase):
self.assertIn(toc_section, actual)
@attr('shard_1')
@ddt.ddt
class TestHtmlModifiers(ModuleStoreTestCase):
"""
......@@ -692,6 +697,7 @@ class XBlockWithJsonInitData(XBlock):
return frag
@attr('shard_1')
@ddt.ddt
class JsonInitDataTest(ModuleStoreTestCase):
"""Tests for JSON data injected into the JS init function."""
......@@ -785,6 +791,7 @@ class ViewInStudioTest(ModuleStoreTestCase):
self.module = self._get_module(course_key, descriptor, location)
@attr('shard_1')
class MongoViewInStudioTest(ViewInStudioTest):
"""Test the 'View in Studio' link visibility in a mongo backed course."""
......@@ -813,6 +820,7 @@ class MongoViewInStudioTest(ViewInStudioTest):
self.assertNotIn('View Unit in Studio', result_fragment.content)
@attr('shard_1')
class MixedViewInStudioTest(ViewInStudioTest):
"""Test the 'View in Studio' link visibility in a mixed mongo backed course."""
......@@ -837,6 +845,7 @@ class MixedViewInStudioTest(ViewInStudioTest):
self.assertNotIn('View Unit in Studio', result_fragment.content)
@attr('shard_1')
class XmlViewInStudioTest(ViewInStudioTest):
"""Test the 'View in Studio' link visibility in an xml backed course."""
MODULESTORE = TEST_DATA_XML_MODULESTORE
......@@ -848,6 +857,7 @@ class XmlViewInStudioTest(ViewInStudioTest):
self.assertNotIn('View Unit in Studio', result_fragment.content)
@attr('shard_1')
@patch.dict('django.conf.settings.FEATURES', {'DISPLAY_DEBUG_INFO_TO_STAFF': True, 'DISPLAY_HISTOGRAMS_TO_STAFF': True})
@patch('courseware.module_render.has_access', Mock(return_value=True))
class TestStaffDebugInfo(ModuleStoreTestCase):
......@@ -968,6 +978,7 @@ PER_STUDENT_ANONYMIZED_DESCRIPTORS = set(
)
@attr('shard_1')
@ddt.ddt
class TestAnonymousStudentId(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
......@@ -1043,6 +1054,7 @@ class TestAnonymousStudentId(ModuleStoreTestCase, LoginEnrollmentTestCase):
)
@attr('shard_1')
@patch('track.views.tracker')
class TestModuleTrackingContext(ModuleStoreTestCase):
"""
......@@ -1121,6 +1133,7 @@ class TestModuleTrackingContext(ModuleStoreTestCase):
self.assertEqual(module_info['original_usage_version'], unicode(original_usage_version))
@attr('shard_1')
class TestXmoduleRuntimeEvent(TestSubmittingProblems):
"""
Inherit from TestSubmittingProblems to get functionality that set up a course and problems structure
......@@ -1169,6 +1182,7 @@ class TestXmoduleRuntimeEvent(TestSubmittingProblems):
self.assertIsNone(student_module.max_grade)
@attr('shard_1')
class TestRebindModule(TestSubmittingProblems):
"""
Tests to verify the functionality of rebinding a module.
......@@ -1235,6 +1249,7 @@ class TestRebindModule(TestSubmittingProblems):
self.assertFalse(psycho_handler.called)
@attr('shard_1')
@ddt.ddt
class TestEventPublishing(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
......@@ -1273,6 +1288,7 @@ class TestEventPublishing(ModuleStoreTestCase, LoginEnrollmentTestCase):
mock_track_function.return_value.assert_called_once_with(event_type, event)
@attr('shard_1')
@ddt.ddt
class LMSXBlockServiceBindingTest(ModuleStoreTestCase):
"""
......@@ -1355,6 +1371,7 @@ BLOCK_TYPES = ['xblock', 'xmodule']
USER_NUMBERS = range(2)
@attr('shard_1')
@ddt.ddt
class TestFilteredChildren(ModuleStoreTestCase):
"""
......
......@@ -2,6 +2,7 @@
This test file will run through some LMS test scenarios regarding access and navigation of the LMS
"""
import time
from nose.plugins.attrib import attr
from django.conf import settings
from django.core.urlresolvers import reverse
......@@ -13,6 +14,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
@attr('shard_1')
class TestNavigation(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Check that navigation state is saved properly.
......
......@@ -4,6 +4,7 @@ This file will test through the LMS some of the PasswordHistory features
import json
from mock import patch
from uuid import uuid4
from nose.plugins.attrib import attr
from django.contrib.auth.models import User
from django.utils import timezone
......@@ -20,6 +21,7 @@ from student.models import PasswordHistory
from courseware.tests.helpers import LoginEnrollmentTestCase
@attr('shard_1')
@patch.dict("django.conf.settings.FEATURES", {'ADVANCED_SECURITY': True})
class TestPasswordHistory(LoginEnrollmentTestCase):
"""
......
......@@ -7,6 +7,7 @@ import itertools
import StringIO
from ddt import ddt, data
from copy import deepcopy
from nose.plugins.attrib import attr
from django.core.urlresolvers import reverse
......@@ -183,6 +184,7 @@ class TestRecommender(ModuleStoreTestCase, LoginEnrollmentTestCase):
self.assert_request_status_code(200, self.course_url)
@attr('shard_1')
class TestRecommenderCreateFromEmpty(TestRecommender):
"""
Check whether we can add resources to an empty database correctly
......@@ -209,6 +211,7 @@ class TestRecommenderCreateFromEmpty(TestRecommender):
self.assert_request_status_code(200, self.course_url)
@attr('shard_1')
class TestRecommenderWithResources(TestRecommender):
"""
Check whether we can add/edit/flag/export resources correctly
......@@ -403,6 +406,7 @@ class TestRecommenderWithResources(TestRecommender):
self.assert_request_status_code(200, self.course_url)
@attr('shard_1')
@ddt
class TestRecommenderVoteWithResources(TestRecommenderWithResources):
"""
......@@ -520,6 +524,7 @@ class TestRecommenderVoteWithResources(TestRecommenderWithResources):
self.check_event_response_by_key('handle_vote', resource, 'newVotes', test_case['new_votes'])
@attr('shard_1')
@ddt
class TestRecommenderStaffFeedbackWithResources(TestRecommenderWithResources):
"""
......@@ -618,6 +623,7 @@ class TestRecommenderStaffFeedbackWithResources(TestRecommenderWithResources):
self.check_event_response_by_http_status(test_case['handler'], resource, test_case['status'])
@attr('shard_1')
@ddt
class TestRecommenderFileUploading(TestRecommender):
"""
......
......@@ -3,6 +3,7 @@ Test for split test XModule
"""
from django.core.urlresolvers import reverse
from mock import MagicMock
from nose.plugins.attrib import attr
from courseware.module_render import get_module_for_descriptor
from courseware.model_data import FieldDataCache
......@@ -13,6 +14,7 @@ from xmodule.partitions.partitions import Group, UserPartition
from openedx.core.djangoapps.user_api.tests.factories import UserCourseTagFactory
@attr('shard_1')
class SplitTestBase(ModuleStoreTestCase):
"""
Sets up a basic course and user for split test testing.
......@@ -268,6 +270,7 @@ class TestSplitTestVert(SplitTestBase):
html1 = self._html(cond1vert, 1)
@attr('shard_1')
class SplitTestPosition(ModuleStoreTestCase):
"""
Check that we can change positions in a course with partitions defined
......
......@@ -11,6 +11,7 @@ from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
from mock import patch
from nose.plugins.attrib import attr
from capa.tests.response_xml_factory import (
OptionResponseXMLFactory, CustomResponseXMLFactory, SchematicResponseXMLFactory,
......@@ -293,6 +294,7 @@ class TestSubmittingProblems(ModuleStoreTestCase, LoginEnrollmentTestCase):
return [s.earned for s in hw_section['scores']]
@attr('shard_1')
class TestCourseGrader(TestSubmittingProblems):
"""
Suite of tests for the course grader.
......@@ -593,6 +595,7 @@ class TestCourseGrader(TestSubmittingProblems):
self.assertEqual(self.score_for_hw('homework3'), [1.0, 1.0])
@attr('shard_1')
class ProblemWithUploadedFilesTest(TestSubmittingProblems):
"""Tests of problems with uploaded files."""
......@@ -645,6 +648,7 @@ class ProblemWithUploadedFilesTest(TestSubmittingProblems):
self.assertItemsEqual(kwargs['files'].keys(), filenames.split())
@attr('shard_1')
class TestPythonGradedResponse(TestSubmittingProblems):
"""
Check that we can submit a schematic and custom response, and it answers properly.
......@@ -893,6 +897,7 @@ class TestPythonGradedResponse(TestSubmittingProblems):
self._check_ireset(name)
@attr('shard_1')
class TestAnswerDistributions(TestSubmittingProblems):
"""Check that we can pull answer distributions for problems."""
......@@ -1048,6 +1053,7 @@ class TestAnswerDistributions(TestSubmittingProblems):
)
@attr('shard_1')
class TestConditionalContent(TestSubmittingProblems):
"""
Check that conditional content works correctly with grading.
......
......@@ -6,6 +6,7 @@ from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import Http404
from mock import MagicMock, Mock, patch
from nose.plugins.attrib import attr
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from courseware.courses import get_course_by_id
......@@ -24,6 +25,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
@attr('shard_1')
class StaticTabDateTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""Test cases for Static Tab Dates."""
......@@ -75,6 +77,7 @@ class StaticTabDateTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
self.assertIn("this module is temporarily unavailable", static_tab)
@attr('shard_1')
class StaticTabDateTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Tests for the static tab dates of an XML course
......@@ -108,6 +111,7 @@ class StaticTabDateTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase):
self.assertIn(self.xml_data, resp.content)
@attr('shard_1')
class EntranceExamsTabsTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Validate tab behavior when dealing with Entrance Exams
......@@ -214,6 +218,7 @@ class EntranceExamsTabsTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
self.assertEqual(len(course_tab_list), 5)
@attr('shard_1')
class TextBookTabsTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Validate tab behavior when dealing with textbooks.
......
......@@ -2,6 +2,7 @@
"""Video xmodule tests in mongo."""
from mock import patch
from nose.plugins.attrib import attr
import os
import tempfile
import textwrap
......@@ -103,6 +104,7 @@ def _upload_file(subs_file, location, filename):
del_cached_content(content.location)
@attr('shard_1')
class TestVideo(BaseTestXmodule):
"""Integration tests: web client + mongo."""
CATEGORY = "video"
......@@ -157,6 +159,7 @@ class TestVideo(BaseTestXmodule):
super(TestVideo, self).tearDown()
@attr('shard_1')
class TestTranscriptAvailableTranslationsDispatch(TestVideo):
"""
Test video handler that provide available translations info.
......@@ -216,6 +219,7 @@ class TestTranscriptAvailableTranslationsDispatch(TestVideo):
self.assertEqual(json.loads(response.body), ['en', 'uk'])
@attr('shard_1')
class TestTranscriptDownloadDispatch(TestVideo):
"""
Test video handler that provide translation transcripts.
......@@ -280,6 +284,7 @@ class TestTranscriptDownloadDispatch(TestVideo):
self.assertEqual(response.headers['Content-Disposition'], 'attachment; filename="塞.srt"')
@attr('shard_1')
class TestTranscriptTranslationGetDispatch(TestVideo):
"""
Test video handler that provide translation transcripts.
......@@ -485,6 +490,7 @@ class TestTranscriptTranslationGetDispatch(TestVideo):
self.assertEqual(response.status, '404 Not Found')
@attr('shard_1')
class TestStudioTranscriptTranslationGetDispatch(TestVideo):
"""
Test Studio video handler that provide translation transcripts.
......@@ -542,6 +548,7 @@ class TestStudioTranscriptTranslationGetDispatch(TestVideo):
self.assertEqual(response.headers['Content-Language'], 'zh')
@attr('shard_1')
class TestStudioTranscriptTranslationPostDispatch(TestVideo):
"""
Test Studio video handler that provide translation transcripts.
......@@ -602,6 +609,7 @@ class TestStudioTranscriptTranslationPostDispatch(TestVideo):
self.assertTrue(_check_asset(self.item_descriptor.location, u'filename.srt'))
@attr('shard_1')
class TestGetTranscript(TestVideo):
"""
Make sure that `get_transcript` method works correctly
......
......@@ -5,6 +5,7 @@ from collections import OrderedDict
from lxml import etree
from mock import patch, MagicMock, Mock
from nose.plugins.attrib import attr
from django.conf import settings
from django.test import TestCase
......@@ -23,6 +24,7 @@ from .test_video_xml import SOURCE_XML
from .test_video_handlers import TestVideo
@attr('shard_1')
class TestVideoYouTube(TestVideo):
METADATA = {}
......@@ -73,6 +75,7 @@ class TestVideoYouTube(TestVideo):
)
@attr('shard_1')
class TestVideoNonYouTube(TestVideo):
"""Integration tests: web client + mongo."""
DATA = """
......@@ -140,6 +143,7 @@ class TestVideoNonYouTube(TestVideo):
)
@attr('shard_1')
class TestGetHtmlMethod(BaseTestXmodule):
'''
Make sure that `get_html` works correctly.
......@@ -759,6 +763,7 @@ class TestGetHtmlMethod(BaseTestXmodule):
)
@attr('shard_1')
class TestVideoDescriptorInitialization(BaseTestXmodule):
"""
Make sure that module initialization works correctly.
......@@ -829,6 +834,7 @@ class TestVideoDescriptorInitialization(BaseTestXmodule):
self.assertFalse(self.item_descriptor.download_video)
@attr('shard_1')
class VideoDescriptorTest(TestCase, VideoDescriptorTestBase):
"""
Tests for video descriptor that requires access to django settings.
......
......@@ -14,6 +14,7 @@ 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.video_module import VideoDescriptor
from xmodule.tests import LogicTest
......@@ -34,6 +35,7 @@ SOURCE_XML = """
"""
@attr('shard_1')
class VideoModuleLogicTest(LogicTest):
"""Tests for logic of Video Xmodule."""
......
......@@ -3,6 +3,7 @@ import pytz
from django.core.urlresolvers import reverse
from mock import patch
from nose.plugins.attrib import attr
from courseware.access import has_access
from courseware.tests.helpers import LoginEnrollmentTestCase
......@@ -20,6 +21,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from student.tests.factories import UserFactory, CourseEnrollmentFactory
@attr('shard_1')
class TestViewAuth(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Check that view authentication works properly.
......@@ -386,6 +388,7 @@ class TestViewAuth(ModuleStoreTestCase, LoginEnrollmentTestCase):
self.assertTrue(self.enroll(self.course))
@attr('shard_1')
class TestBetatesterAccess(ModuleStoreTestCase):
"""
Tests for the beta tester feature
......
......@@ -7,6 +7,7 @@ import ddt
import json
import unittest
from datetime import datetime
from nose.plugins.attrib import attr
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
......@@ -42,6 +43,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
@attr('shard_1')
class TestJumpTo(ModuleStoreTestCase):
"""
Check the jumpto link for a course.
......@@ -162,6 +164,7 @@ class TestJumpTo(ModuleStoreTestCase):
self.assertEqual(response.status_code, 404)
@attr('shard_1')
@ddt.ddt
class ViewsTestCase(ModuleStoreTestCase):
"""
......@@ -555,6 +558,7 @@ class ViewsTestCase(ModuleStoreTestCase):
self.assertNotContains(response, checkbox_html, html=True)
@attr('shard_1')
# setting TIME_ZONE_DISPLAYED_FOR_DEADLINES explicitly
@override_settings(TIME_ZONE_DISPLAYED_FOR_DEADLINES="UTC")
class BaseDueDateTests(ModuleStoreTestCase):
......@@ -672,6 +676,7 @@ class TestAccordionDueDate(BaseDueDateTests):
)
@attr('shard_1')
class StartDateTests(ModuleStoreTestCase):
"""
Test that start dates are properly localized and displayed on the student
......@@ -727,6 +732,7 @@ class StartDateTests(ModuleStoreTestCase):
self.assertIn("2015-JULY-17", text)
@attr('shard_1')
@ddt.ddt
class ProgressPageTests(ModuleStoreTestCase):
"""
......@@ -808,6 +814,7 @@ class ProgressPageTests(ModuleStoreTestCase):
self.assertNotContains(resp, 'Request Certificate')
@attr('shard_1')
class VerifyCourseKeyDecoratorTests(TestCase):
"""
Tests for the ensure_valid_course_key decorator.
......@@ -833,6 +840,7 @@ class VerifyCourseKeyDecoratorTests(TestCase):
self.assertFalse(mocked_view.called)
@attr('shard_1')
class IsCoursePassedTests(ModuleStoreTestCase):
"""
Tests for the is_course_passed helper function
......@@ -867,6 +875,7 @@ class IsCoursePassedTests(ModuleStoreTestCase):
self.assertFalse(views.is_course_passed(self.course, None, self.student, self.request))
@attr('shard_1')
class GenerateUserCertTests(ModuleStoreTestCase):
"""
Tests for the view function Generated User Certs
......@@ -1022,6 +1031,7 @@ class ViewCheckerBlock(XBlock):
return result
@attr('shard_1')
@ddt.ddt
class TestIndexView(ModuleStoreTestCase):
"""
......
......@@ -3,11 +3,13 @@
import json
from operator import itemgetter
from nose.plugins.attrib import attr
from . import BaseTestXmodule
from xmodule.x_module import STUDENT_VIEW
@attr('shard_1')
class TestWordCloud(BaseTestXmodule):
"""Integration test for word cloud xmodule."""
CATEGORY = "word_cloud"
......
......@@ -6,6 +6,7 @@ from unittest import TestCase
from django.core.urlresolvers import reverse
import mock
from nose.plugins.attrib import attr
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from courseware.tests.helpers import LoginEnrollmentTestCase
......@@ -17,6 +18,7 @@ from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
@attr('shard_1')
class ActivateLoginTest(LoginEnrollmentTestCase):
"""
Test logging in and logging out.
......@@ -112,6 +114,7 @@ class PageLoaderTestCase(LoginEnrollmentTestCase):
self.assertNotIsInstance(descriptor, ErrorDescriptor)
@attr('shard_1')
class TestXmlCoursesLoad(ModuleStoreTestCase, PageLoaderTestCase):
"""
Check that all pages in test courses load properly from XML.
......@@ -129,6 +132,7 @@ class TestXmlCoursesLoad(ModuleStoreTestCase, PageLoaderTestCase):
self.check_all_pages_load(SlashSeparatedCourseKey('edX', 'toy', '2012_Fall'))
@attr('shard_1')
class TestMongoCoursesLoad(ModuleStoreTestCase, PageLoaderTestCase):
"""
Check that all pages in test courses load properly from Mongo.
......@@ -152,6 +156,7 @@ class TestMongoCoursesLoad(ModuleStoreTestCase, PageLoaderTestCase):
self.assertGreater(len(course.textbooks), 0)
@attr('shard_1')
class TestDraftModuleStore(ModuleStoreTestCase):
def test_get_items_with_course_items(self):
store = modulestore()
......@@ -164,6 +169,7 @@ class TestDraftModuleStore(ModuleStoreTestCase):
# not allowed to be passed in (i.e. was throwing exception)
@attr('shard_1')
class TestLmsFieldData(TestCase):
"""
Tests of the LmsFieldData class
......
......@@ -5,6 +5,7 @@ import datetime
from django.contrib.auth.models import Permission
from django.test.client import Client
from nose.plugins.attrib import attr
from course_modes.models import CourseMode
from shoppingcart.models import CertificateItem, Order
......@@ -14,6 +15,7 @@ from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
@attr('shard_1')
class RefundTests(ModuleStoreTestCase):
"""
Tests for the manual refund page
......
......@@ -7,6 +7,7 @@ import re
import shutil
import unittest
from util.date_utils import get_time_display, DEFAULT_DATE_TIME_FORMAT
from nose.plugins.attrib import attr
from django.conf import settings
from django.contrib.auth.hashers import check_password
......@@ -115,6 +116,7 @@ class SysadminBaseTestCase(ModuleStoreTestCase):
self.addCleanup(shutil.rmtree, path)
@attr('shard_1')
@unittest.skipUnless(settings.FEATURES.get('ENABLE_SYSADMIN_DASHBOARD'),
"ENABLE_SYSADMIN_DASHBOARD not set")
@override_settings(GIT_IMPORT_WITH_XMLMODULESTORE=True)
......@@ -404,6 +406,7 @@ class TestSysadmin(SysadminBaseTestCase):
self._rm_edx4edx()
@attr('shard_1')
@override_settings(MONGODB_LOG=TEST_MONGODB_LOG)
@unittest.skipUnless(settings.FEATURES.get('ENABLE_SYSADMIN_DASHBOARD'),
"ENABLE_SYSADMIN_DASHBOARD not set")
......
import django.http
from django.test import TestCase
from nose.plugins.attrib import attr
import json
import lms.lib.comment_client
import django_comment_client.middleware as middleware
@attr('shard_1')
class AjaxExceptionTestCase(TestCase):
def setUp(self):
super(AjaxExceptionTestCase, self).setUp()
......
......@@ -2,6 +2,7 @@
Tests for the django comment client integration models
"""
from django.test.testcases import TestCase
from nose.plugins.attrib import attr
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_TOY_MODULESTORE
......@@ -9,6 +10,7 @@ import django_comment_common.models as models
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
@attr('shard_1')
class RoleClassTestCase(ModuleStoreTestCase):
"""
Tests for roles of the comment client service integration
......@@ -50,6 +52,7 @@ class RoleClassTestCase(ModuleStoreTestCase):
self.TA_role_2.inherit_permissions(self.TA_role)
@attr('shard_1')
class PermissionClassTestCase(TestCase):
"""
Tests for permissions of the comment client service integration
......
......@@ -2,6 +2,7 @@
import datetime
import json
import mock
from nose.plugins.attrib import attr
from pytz import UTC
from django.utils.timezone import UTC as django_utc
......@@ -24,6 +25,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
@attr('shard_1')
class DictionaryTestCase(TestCase):
def test_extract(self):
d = {'cats': 'meow', 'dogs': 'woof'}
......@@ -48,6 +50,7 @@ class DictionaryTestCase(TestCase):
self.assertEqual(utils.merge_dict(d1, d2), expected)
@attr('shard_1')
class AccessUtilsTestCase(ModuleStoreTestCase):
"""
Base testcase class for access and roles for the
......@@ -90,6 +93,7 @@ class AccessUtilsTestCase(ModuleStoreTestCase):
self.assertFalse(ret)
@attr('shard_1')
class CoursewareContextTestCase(ModuleStoreTestCase):
"""
Base testcase class for courseware context for the
......@@ -168,6 +172,7 @@ class CategoryMapTestMixin(object):
)
@attr('shard_1')
class CategoryMapTestCase(CategoryMapTestMixin, ModuleStoreTestCase):
"""
Base testcase class for discussion categories for the
......@@ -759,6 +764,7 @@ class CategoryMapTestCase(CategoryMapTestMixin, ModuleStoreTestCase):
)
@attr('shard_1')
class ContentGroupCategoryMapTestCase(CategoryMapTestMixin, ContentGroupTestCase):
"""
Tests `get_discussion_category_map` on discussion modules which are
......@@ -932,6 +938,7 @@ class JsonResponseTestCase(TestCase, UnicodeTestMixin):
self.assertEqual(reparsed, text)
@attr('shard_1')
class RenderMustacheTests(TestCase):
"""
Test the `render_mustache` utility function.
......
......@@ -3,6 +3,7 @@ Test instructor.access
"""
from nose.tools import raises
from nose.plugins.attrib import attr
from student.tests.factories import UserFactory
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
......@@ -17,6 +18,7 @@ from instructor.access import (allow_access,
update_forum_role)
@attr('shard_1')
class TestInstructorAccessList(ModuleStoreTestCase):
""" Test access listings. """
def setUp(self):
......@@ -40,6 +42,7 @@ class TestInstructorAccessList(ModuleStoreTestCase):
self.assertEqual(set(beta_testers), set(self.beta_testers))
@attr('shard_1')
class TestInstructorAccessAllow(ModuleStoreTestCase):
""" Test access allow. """
def setUp(self):
......@@ -75,6 +78,7 @@ class TestInstructorAccessAllow(ModuleStoreTestCase):
allow_access(self.course, user, 'staff')
@attr('shard_1')
class TestInstructorAccessRevoke(ModuleStoreTestCase):
""" Test access revoke. """
def setUp(self):
......@@ -110,6 +114,7 @@ class TestInstructorAccessRevoke(ModuleStoreTestCase):
revoke_access(self.course, user, 'robot-not-a-level')
@attr('shard_1')
class TestInstructorAccessForum(ModuleStoreTestCase):
"""
Test forum access control.
......
......@@ -27,6 +27,7 @@ from django.utils.translation import ugettext as _
from mock import Mock, patch
from nose.tools import raises
from nose.plugins.attrib import attr
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from course_modes.models import CourseMode
......@@ -107,6 +108,7 @@ def view_alreadyrunningerror(request): # pylint: disable=unused-argument
raise AlreadyRunningError()
@attr('shard_1')
class TestCommonExceptions400(TestCase):
"""
Testing the common_exceptions_400 decorator.
......@@ -148,6 +150,7 @@ class TestCommonExceptions400(TestCase):
self.assertIn("Task is already running", result["error"])
@attr('shard_1')
@patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message'))
@patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False})
class TestInstructorAPIDenyLevels(ModuleStoreTestCase, LoginEnrollmentTestCase):
......@@ -304,6 +307,7 @@ class TestInstructorAPIDenyLevels(ModuleStoreTestCase, LoginEnrollmentTestCase):
)
@attr('shard_1')
@patch.dict(settings.FEATURES, {'ALLOW_AUTOMATED_SIGNUPS': True})
class TestInstructorAPIBulkAccountCreationAndEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
......@@ -560,6 +564,7 @@ class TestInstructorAPIBulkAccountCreationAndEnrollment(ModuleStoreTestCase, Log
self.assertEquals(response.status_code, 403)
@attr('shard_1')
@ddt.ddt
class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
......@@ -1141,6 +1146,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
return response
@attr('shard_1')
@ddt.ddt
class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
......@@ -1456,6 +1462,7 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe
)
@attr('shard_1')
class TestInstructorAPILevelsAccess(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Test endpoints whereby instructors can change permissions
......@@ -1694,6 +1701,7 @@ class TestInstructorAPILevelsAccess(ModuleStoreTestCase, LoginEnrollmentTestCase
self.assertNotIn(rolename, user_roles)
@attr('shard_1')
@ddt.ddt
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_PAID_COURSE_REGISTRATION': True})
class TestInstructorAPILevelsDataDump(ModuleStoreTestCase, LoginEnrollmentTestCase):
......@@ -2156,6 +2164,7 @@ class TestInstructorAPILevelsDataDump(ModuleStoreTestCase, LoginEnrollmentTestCa
self.assertEqual(response.status_code, 400)
@attr('shard_1')
class TestInstructorAPIRegradeTask(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Test endpoints whereby instructors can change student grades.
......@@ -2317,6 +2326,7 @@ class TestInstructorAPIRegradeTask(ModuleStoreTestCase, LoginEnrollmentTestCase)
self.assertEqual(response.status_code, 400)
@attr('shard_1')
@patch.dict(settings.FEATURES, {'ENTRANCE_EXAMS': True})
class TestEntranceExamInstructorAPIRegradeTask(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
......@@ -2561,6 +2571,7 @@ class TestEntranceExamInstructorAPIRegradeTask(ModuleStoreTestCase, LoginEnrollm
self.assertContains(response, message)
@attr('shard_1')
@patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message'))
@patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False})
class TestInstructorSendEmail(ModuleStoreTestCase, LoginEnrollmentTestCase):
......@@ -2645,6 +2656,7 @@ class MockCompletionInfo(object):
return False, 'Task Errored In Some Way'
@attr('shard_1')
class TestInstructorAPITaskLists(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Test instructor task list endpoint.
......@@ -2803,6 +2815,7 @@ class TestInstructorAPITaskLists(ModuleStoreTestCase, LoginEnrollmentTestCase):
self.assertEqual(actual_tasks, expected_tasks)
@attr('shard_1')
@patch.object(instructor_task.api, 'get_instructor_task_history')
class TestInstructorEmailContentList(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
......@@ -2933,6 +2946,7 @@ class TestInstructorEmailContentList(ModuleStoreTestCase, LoginEnrollmentTestCas
self.assertDictEqual(expected_info, returned_info)
@attr('shard_1')
@ddt.ddt
@override_settings(ANALYTICS_SERVER_URL="http://robotanalyticsserver.netbot:900/")
@override_settings(ANALYTICS_API_KEY="robot_api_key")
......@@ -3081,6 +3095,7 @@ class TestInstructorAPIAnalyticsProxy(ModuleStoreTestCase, LoginEnrollmentTestCa
self.assertFalse(act.called)
@attr('shard_1')
class TestInstructorAPIHelpers(TestCase):
""" Test helpers for instructor.api """
......@@ -3134,6 +3149,7 @@ def get_extended_due(course, unit, user):
return None
@attr('shard_1')
class TestDueDateExtensions(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Test data dumps for reporting.
......@@ -3322,6 +3338,7 @@ class TestDueDateExtensions(ModuleStoreTestCase, LoginEnrollmentTestCase):
self.user1.profile.name, self.user1.username)})
@attr('shard_1')
@override_settings(REGISTRATION_CODE_LENGTH=8)
class TestCourseRegistrationCodes(ModuleStoreTestCase):
"""
......@@ -3773,6 +3790,7 @@ class TestCourseRegistrationCodes(ModuleStoreTestCase):
self.assertTrue(body.startswith(EXPECTED_COUPON_CSV_HEADER))
@attr('shard_1')
class TestBulkCohorting(ModuleStoreTestCase):
"""
Test adding users to cohorts in bulk via CSV upload.
......
......@@ -5,6 +5,7 @@ Unit tests for the localization of emails sent by instructor.api methods.
from django.core import mail
from django.core.urlresolvers import reverse
from nose.plugins.attrib import attr
from courseware.tests.factories import InstructorFactory
from lang_pref import LANGUAGE_KEY
......@@ -15,6 +16,7 @@ from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
@attr('shard_1')
class TestInstructorAPIEnrollmentEmailLocalization(ModuleStoreTestCase):
"""
Test whether the enroll, unenroll and beta role emails are sent in the
......
......@@ -2,6 +2,7 @@
import contextlib
import ddt
import mock
from nose.plugins.attrib import attr
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
......@@ -12,6 +13,7 @@ from certificates.models import CertificateGenerationConfiguration
from certificates import api as certs_api
@attr('shard_1')
@ddt.ddt
class CertificatesInstructorDashTest(ModuleStoreTestCase):
"""Tests for the certificate panel of the instructor dash. """
......@@ -148,6 +150,7 @@ class CertificatesInstructorDashTest(ModuleStoreTestCase):
self.assertContains(response, expected_html)
@attr('shard_1')
@override_settings(CERT_QUEUE='certificates')
@ddt.ddt
class CertificatesInstructorApiTest(ModuleStoreTestCase):
......
......@@ -7,6 +7,7 @@ import datetime
import pytz
from django.core.urlresolvers import reverse
from nose.plugins.attrib import attr
from course_modes.models import CourseMode
from student.roles import CourseFinanceAdminRole
......@@ -16,6 +17,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@attr('shard_1')
class TestECommerceDashboardViews(ModuleStoreTestCase):
"""
Check for E-commerce view on the new instructor dashboard
......
......@@ -7,6 +7,7 @@ that the view is conditionally available when Course Auth is turned on.
from django.conf import settings
from django.core.urlresolvers import reverse
from mock import patch
from nose.plugins.attrib import attr
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from bulk_email.models import CourseAuthorization
......@@ -15,6 +16,7 @@ from student.tests.factories import AdminFactory
from xmodule.modulestore.tests.factories import CourseFactory
@attr('shard_1')
class TestNewInstructorDashboardEmailViewMongoBacked(ModuleStoreTestCase):
"""
Check for email view on the new instructor dashboard
......@@ -98,6 +100,7 @@ class TestNewInstructorDashboardEmailViewMongoBacked(ModuleStoreTestCase):
self.assertFalse(self.email_link in response.content)
@attr('shard_1')
class TestNewInstructorDashboardEmailViewXMLBacked(ModuleStoreTestCase):
"""
Check for email view on the new instructor dashboard
......
......@@ -11,6 +11,7 @@ from django.conf import settings
from django.test import TestCase
from django.utils.translation import get_language
from django.utils.translation import override as override_language
from nose.plugins.attrib import attr
from student.tests.factories import UserFactory
from xmodule.modulestore.tests.factories import CourseFactory
......@@ -31,6 +32,7 @@ from student.models import anonymous_id_for_user
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
@attr('shard_1')
class TestSettableEnrollmentState(TestCase):
""" Test the basis class for enrollment tests. """
def setUp(self):
......@@ -94,6 +96,7 @@ class TestEnrollmentChangeBase(TestCase):
self.assertEqual(after, after_ideal)
@attr('shard_1')
class TestInstructorEnrollDB(TestEnrollmentChangeBase):
""" Test instructor.enrollment.enroll_email """
def test_enroll(self):
......@@ -211,6 +214,7 @@ class TestInstructorEnrollDB(TestEnrollmentChangeBase):
return self._run_state_change_test(before_ideal, after_ideal, action)
@attr('shard_1')
class TestInstructorUnenrollDB(TestEnrollmentChangeBase):
""" Test instructor.enrollment.unenroll_email """
def test_unenroll(self):
......@@ -290,6 +294,7 @@ class TestInstructorUnenrollDB(TestEnrollmentChangeBase):
return self._run_state_change_test(before_ideal, after_ideal, action)
@attr('shard_1')
class TestInstructorEnrollmentStudentModule(TestCase):
""" Test student module manipulations. """
def setUp(self):
......@@ -419,6 +424,7 @@ class SettableEnrollmentState(EmailEnrollmentState):
return EnrollmentObjects(email, None, None, None)
@attr('shard_1')
class TestSendBetaRoleEmail(TestCase):
"""
Test edge cases for `send_beta_role_email`
......@@ -436,6 +442,7 @@ class TestSendBetaRoleEmail(TestCase):
send_beta_role_email(bad_action, self.user, self.email_params)
@attr('shard_1')
class TestGetEmailParams(ModuleStoreTestCase):
"""
Test what URLs the function get_email_params returns under different
......@@ -480,6 +487,7 @@ class TestGetEmailParams(ModuleStoreTestCase):
self.assertEqual(result['course_url'], self.course_url)
@attr('shard_1')
class TestRenderMessageToString(ModuleStoreTestCase):
"""
Test that email templates can be rendered in a language chosen manually.
......
......@@ -2,6 +2,7 @@ import json
from django.test.client import Client, RequestFactory
from mock import patch, MagicMock
from nose.plugins.attrib import attr
from courseware.models import XModuleUserStateSummaryField
from courseware.tests.factories import UserStateSummaryFactory
......@@ -13,6 +14,7 @@ from xmodule.modulestore.tests.factories import CourseFactory
# pylint: disable=missing-docstring
@attr('shard_1')
class HintManagerTest(ModuleStoreTestCase):
def setUp(self):
......
......@@ -5,6 +5,7 @@ Unit tests for enrollment methods in views.py
import ddt
from mock import patch
from nose.plugins.attrib import attr
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
......@@ -19,6 +20,7 @@ from django.core import mail
USER_COUNT = 4
@attr('shard_1')
@ddt.ddt
class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
......
......@@ -5,11 +5,13 @@ Create course and answer a problem to test raw grade CSV
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from nose.plugins.attrib import attr
from courseware.tests.test_submitting_problems import TestSubmittingProblems
from student.roles import CourseStaffRole
@attr('shard_1')
class TestRawGradeCSV(TestSubmittingProblems):
"""
Tests around the instructor dashboard raw grade CSV
......
......@@ -5,6 +5,7 @@ Tests of various instructor dashboard features that include lists of students
from django.conf import settings
from django.test.client import RequestFactory
from markupsafe import escape
from nose.plugins.attrib import attr
from student.tests.factories import UserFactory, CourseEnrollmentFactory
from edxmako.tests import mako_middleware_process_request
......@@ -16,6 +17,7 @@ from instructor.views import legacy
# pylint: disable=missing-docstring
@attr('shard_1')
class TestXss(ModuleStoreTestCase):
def setUp(self):
super(TestXss, self).setUp()
......
......@@ -3,6 +3,7 @@ Tests of the instructor dashboard spoc gradebook
"""
from django.core.urlresolvers import reverse
from nose.plugins.attrib import attr
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from student.tests.factories import UserFactory, CourseEnrollmentFactory, AdminFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
......@@ -14,6 +15,7 @@ from xmodule.modulestore.django import modulestore
USER_COUNT = 11
@attr('shard_1')
class TestGradebook(ModuleStoreTestCase):
"""
Test functionality of the spoc gradebook. Sets up a course with assignments and
......@@ -79,6 +81,7 @@ class TestGradebook(ModuleStoreTestCase):
self.assertEquals(self.response.status_code, 200)
@attr('shard_1')
class TestDefaultGradingPolicy(TestGradebook):
"""
Tests that the grading policy is properly applied for all users in the course
......@@ -104,6 +107,7 @@ class TestDefaultGradingPolicy(TestGradebook):
self.assertEquals(293, self.response.content.count('grade_None'))
@attr('shard_1')
class TestLetterCutoffPolicy(TestGradebook):
"""
Tests advanced grading policy (with letter grade cutoffs). Includes tests of
......
......@@ -9,6 +9,7 @@ import unittest
from django.utils.timezone import utc
from django.test.utils import override_settings
from nose.plugins.attrib import attr
from courseware.field_overrides import OverrideFieldData # pylint: disable=import-error
from student.tests.factories import UserFactory # pylint: disable=import-error
......@@ -22,6 +23,7 @@ from ..views import tools
DATE_FIELD = Date()
@attr('shard_1')
class TestDashboardError(unittest.TestCase):
"""
Test DashboardError exceptions.
......@@ -32,6 +34,7 @@ class TestDashboardError(unittest.TestCase):
self.assertEqual(response, {'error': 'Oh noes!'})
@attr('shard_1')
class TestHandleDashboardError(unittest.TestCase):
"""
Test handle_dashboard_error decorator.
......@@ -60,6 +63,7 @@ class TestHandleDashboardError(unittest.TestCase):
self.assertEqual(view(None, None), "Oh yes!")
@attr('shard_1')
class TestRequireStudentIdentifier(unittest.TestCase):
"""
Test require_student_from_identifier()
......@@ -82,6 +86,7 @@ class TestRequireStudentIdentifier(unittest.TestCase):
tools.require_student_from_identifier("invalid")
@attr('shard_1')
class TestParseDatetime(unittest.TestCase):
"""
Test date parsing.
......@@ -96,6 +101,7 @@ class TestParseDatetime(unittest.TestCase):
tools.parse_datetime('foo')
@attr('shard_1')
class TestFindUnit(ModuleStoreTestCase):
"""
Test the find_unit function.
......@@ -131,6 +137,7 @@ class TestFindUnit(ModuleStoreTestCase):
tools.find_unit(self.course, url)
@attr('shard_1')
class TestGetUnitsWithDueDate(ModuleStoreTestCase):
"""
Test the get_units_with_due_date function.
......@@ -166,6 +173,7 @@ class TestGetUnitsWithDueDate(ModuleStoreTestCase):
urls((self.week1, self.week2)))
@attr('shard_1')
class TestTitleOrUrl(unittest.TestCase):
"""
Test the title_or_url funciton.
......@@ -180,6 +188,7 @@ class TestTitleOrUrl(unittest.TestCase):
self.assertEquals(tools.title_or_url(unit), 'test:hello')
@attr('shard_1')
@override_settings(
FIELD_OVERRIDE_PROVIDERS=(
'courseware.student_field_overrides.IndividualStudentOverrideProvider',),
......@@ -265,6 +274,7 @@ class TestSetDueDateExtension(ModuleStoreTestCase):
self.assertEqual(self.week1.due, self.due)
@attr('shard_1')
class TestDataDumps(ModuleStoreTestCase):
"""
Test data dumps for reporting.
......
......@@ -95,6 +95,10 @@ END
exit $EXIT
;;
# TODO: Remove the "unit" TEST_SUITE in favor of "lms-unit", etc.
# For now it is left in here so that there is not a time limit on how fast
# we need to update the groovy script in the jenkins config after merging
# the changes needed to shard out the unit tests.
"unit")
case "$SHARD" in
"lms")
......@@ -110,7 +114,32 @@ END
paver coverage
;;
esac
exit $EXIT
;;
"lms-unit")
case "$SHARD" in
"1")
paver test_system -s lms --extra_args="--attr='shard_1' --with-flaky" --cov_args="-p" || { EXIT=1; }
;;
"2")
paver test_system -s lms --extra_args="--attr='shard_1=False' --with-flaky" --cov_args="-p" || { EXIT=1; }
;;
*)
paver test_system -s lms --extra_args="--with-flaky" --cov_args="-p" || { EXIT=1; }
;;
esac
exit $EXIT
;;
"cms-unit")
paver test_system -s cms --extra_args="--with-flaky" --cov_args="-p" || { EXIT=1; }
exit $EXIT
;;
"commonlib-js-unit")
paver test_js --coverage --skip_clean || { EXIT=1; }
paver test_lib --skip_clean --extra_args="--with-flaky" --cov_args="-p" || { EXIT=1; }
exit $EXIT
;;
......
......@@ -5,7 +5,10 @@ source scripts/jenkins-common.sh
paver combine_jenkins_coverage
# Get the diff coverage and html reports for unit tests
paver coverage
NO_PREREQ_INSTALL=true paver coverage
# Get coverage reports for bok choy
# paver bokchoy_coverage
# JUnit test reporter will fail the build
# if it thinks test results are old
......
[paths]
source =
build_jenkins_source =
/home/jenkins/workspace/edx-platform-unit-coverage
/home/jenkins/workspace/edx-platform-test-subset
test_jenkins_source =
/home/jenkins/workspace/test-edx-platform-unit-coverage
/home/jenkins/workspace/*test-edx-platform-test-subset
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment