From 276ea2fe84da522d37a986cbd206b7764ff28871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s=20Rocha?= Date: Tue, 16 Sep 2014 14:25:25 -0400 Subject: [PATCH] Fix tests not using ModuleStoreTestCase Some tests test were using `CourseFactory` buy not deriving from `ModuleStoreTestCase`, introducing a course leaks that broke other unrelated tests. --- lms/djangoapps/certificates/tests/tests.py | 3 ++- lms/djangoapps/instructor_analytics/tests/test_basic.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lms/djangoapps/certificates/tests/tests.py b/lms/djangoapps/certificates/tests/tests.py index 619d458912..52d73f42e9 100644 --- a/lms/djangoapps/certificates/tests/tests.py +++ b/lms/djangoapps/certificates/tests/tests.py @@ -5,12 +5,13 @@ Tests for the certificates models. from django.test import TestCase from xmodule.modulestore.tests.factories import CourseFactory +from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from student.tests.factories import UserFactory from certificates.models import CertificateStatuses, GeneratedCertificate, certificate_status_for_student -class CertificatesModelTest(TestCase): +class CertificatesModelTest(ModuleStoreTestCase): """ Tests for the GeneratedCertificate model """ diff --git a/lms/djangoapps/instructor_analytics/tests/test_basic.py b/lms/djangoapps/instructor_analytics/tests/test_basic.py index 591abc1d77..1274f1ef24 100644 --- a/lms/djangoapps/instructor_analytics/tests/test_basic.py +++ b/lms/djangoapps/instructor_analytics/tests/test_basic.py @@ -15,6 +15,7 @@ from instructor_analytics.basic import ( ) from courseware.tests.factories import InstructorFactory from xmodule.modulestore.tests.factories import CourseFactory +from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase class TestAnalyticsBasic(TestCase): @@ -52,7 +53,7 @@ class TestAnalyticsBasic(TestCase): self.assertEqual(set(AVAILABLE_FEATURES), set(STUDENT_FEATURES + PROFILE_FEATURES)) -class TestCourseSaleRecordsAnalyticsBasic(TestCase): +class TestCourseSaleRecordsAnalyticsBasic(ModuleStoreTestCase): """ Test basic course sale records analytics functions. """ def setUp(self): """ @@ -100,7 +101,7 @@ class TestCourseSaleRecordsAnalyticsBasic(TestCase): self.assertEqual(sale_record['total_codes'], 5) -class TestCourseRegistrationCodeAnalyticsBasic(TestCase): +class TestCourseRegistrationCodeAnalyticsBasic(ModuleStoreTestCase): """ Test basic course registration codes analytics functions. """ def setUp(self): """