From f9c1c0b38b1ef6b77486a883be76b5570603b06d Mon Sep 17 00:00:00 2001 From: cahrens Date: Tue, 4 Feb 2014 15:55:32 -0500 Subject: [PATCH 1/4] Move tests related to views files into views/tests. --- cms/djangoapps/contentstore/{ => views}/tests/test_access.py | 0 cms/djangoapps/contentstore/{ => views}/tests/test_assets.py | 2 +- .../contentstore/{ => views}/tests/test_checklists.py | 2 +- .../contentstore/{ => views}/tests/test_course_index.py | 0 .../contentstore/{ => views}/tests/test_course_updates.py | 0 .../contentstore/{ => views}/tests/test_import_export.py | 2 +- cms/djangoapps/contentstore/{ => views}/tests/test_item.py | 0 cms/djangoapps/contentstore/{ => views}/tests/test_tabs.py | 0 .../contentstore/{ => views}/tests/test_textbooks.py | 3 +-- .../contentstore/{ => views}/tests/test_transcripts.py | 0 .../{tests/test_users.py => views/tests/test_user.py} | 2 +- 11 files changed, 5 insertions(+), 6 deletions(-) rename cms/djangoapps/contentstore/{ => views}/tests/test_access.py (100%) rename cms/djangoapps/contentstore/{ => views}/tests/test_assets.py (99%) rename cms/djangoapps/contentstore/{ => views}/tests/test_checklists.py (99%) rename cms/djangoapps/contentstore/{ => views}/tests/test_course_index.py (100%) rename cms/djangoapps/contentstore/{ => views}/tests/test_course_updates.py (100%) rename cms/djangoapps/contentstore/{ => views}/tests/test_import_export.py (99%) rename cms/djangoapps/contentstore/{ => views}/tests/test_item.py (100%) rename cms/djangoapps/contentstore/{ => views}/tests/test_tabs.py (100%) rename cms/djangoapps/contentstore/{ => views}/tests/test_textbooks.py (99%) rename cms/djangoapps/contentstore/{ => views}/tests/test_transcripts.py (100%) rename cms/djangoapps/contentstore/{tests/test_users.py => views/tests/test_user.py} (99%) diff --git a/cms/djangoapps/contentstore/tests/test_access.py b/cms/djangoapps/contentstore/views/tests/test_access.py similarity index 100% rename from cms/djangoapps/contentstore/tests/test_access.py rename to cms/djangoapps/contentstore/views/tests/test_access.py diff --git a/cms/djangoapps/contentstore/tests/test_assets.py b/cms/djangoapps/contentstore/views/tests/test_assets.py similarity index 99% rename from cms/djangoapps/contentstore/tests/test_assets.py rename to cms/djangoapps/contentstore/views/tests/test_assets.py index f5a204504d58..71e8d2e79eb7 100644 --- a/cms/djangoapps/contentstore/tests/test_assets.py +++ b/cms/djangoapps/contentstore/views/tests/test_assets.py @@ -10,7 +10,7 @@ from io import BytesIO from pytz import UTC import json -from .utils import CourseTestCase +from contentstore.tests.utils import CourseTestCase from contentstore.views import assets from xmodule.contentstore.content import StaticContent from xmodule.modulestore import Location diff --git a/cms/djangoapps/contentstore/tests/test_checklists.py b/cms/djangoapps/contentstore/views/tests/test_checklists.py similarity index 99% rename from cms/djangoapps/contentstore/tests/test_checklists.py rename to cms/djangoapps/contentstore/views/tests/test_checklists.py index 90dd40a8b7bf..327254564d3c 100644 --- a/cms/djangoapps/contentstore/tests/test_checklists.py +++ b/cms/djangoapps/contentstore/views/tests/test_checklists.py @@ -6,7 +6,7 @@ from xmodule.modulestore.django import loc_mapper import json -from .utils import CourseTestCase +from contentstore.tests.utils import CourseTestCase class ChecklistTestCase(CourseTestCase): diff --git a/cms/djangoapps/contentstore/tests/test_course_index.py b/cms/djangoapps/contentstore/views/tests/test_course_index.py similarity index 100% rename from cms/djangoapps/contentstore/tests/test_course_index.py rename to cms/djangoapps/contentstore/views/tests/test_course_index.py diff --git a/cms/djangoapps/contentstore/tests/test_course_updates.py b/cms/djangoapps/contentstore/views/tests/test_course_updates.py similarity index 100% rename from cms/djangoapps/contentstore/tests/test_course_updates.py rename to cms/djangoapps/contentstore/views/tests/test_course_updates.py diff --git a/cms/djangoapps/contentstore/tests/test_import_export.py b/cms/djangoapps/contentstore/views/tests/test_import_export.py similarity index 99% rename from cms/djangoapps/contentstore/tests/test_import_export.py rename to cms/djangoapps/contentstore/views/tests/test_import_export.py index 85df894cd414..74e1cbd691d3 100644 --- a/cms/djangoapps/contentstore/tests/test_import_export.py +++ b/cms/djangoapps/contentstore/views/tests/test_import_export.py @@ -12,7 +12,7 @@ from uuid import uuid4 from pymongo import MongoClient -from .utils import CourseTestCase +from contentstore.tests.utils import CourseTestCase from django.test.utils import override_settings from django.conf import settings from xmodule.modulestore.django import loc_mapper diff --git a/cms/djangoapps/contentstore/tests/test_item.py b/cms/djangoapps/contentstore/views/tests/test_item.py similarity index 100% rename from cms/djangoapps/contentstore/tests/test_item.py rename to cms/djangoapps/contentstore/views/tests/test_item.py diff --git a/cms/djangoapps/contentstore/tests/test_tabs.py b/cms/djangoapps/contentstore/views/tests/test_tabs.py similarity index 100% rename from cms/djangoapps/contentstore/tests/test_tabs.py rename to cms/djangoapps/contentstore/views/tests/test_tabs.py diff --git a/cms/djangoapps/contentstore/tests/test_textbooks.py b/cms/djangoapps/contentstore/views/tests/test_textbooks.py similarity index 99% rename from cms/djangoapps/contentstore/tests/test_textbooks.py rename to cms/djangoapps/contentstore/views/tests/test_textbooks.py index 7296ab851a07..89ace34a7f0d 100644 --- a/cms/djangoapps/contentstore/tests/test_textbooks.py +++ b/cms/djangoapps/contentstore/views/tests/test_textbooks.py @@ -1,7 +1,6 @@ import json from unittest import TestCase -from .utils import CourseTestCase -from django.core.urlresolvers import reverse +from contentstore.tests.utils import CourseTestCase from contentstore.utils import get_modulestore from xmodule.modulestore.inheritance import own_metadata diff --git a/cms/djangoapps/contentstore/tests/test_transcripts.py b/cms/djangoapps/contentstore/views/tests/test_transcripts.py similarity index 100% rename from cms/djangoapps/contentstore/tests/test_transcripts.py rename to cms/djangoapps/contentstore/views/tests/test_transcripts.py diff --git a/cms/djangoapps/contentstore/tests/test_users.py b/cms/djangoapps/contentstore/views/tests/test_user.py similarity index 99% rename from cms/djangoapps/contentstore/tests/test_users.py rename to cms/djangoapps/contentstore/views/tests/test_user.py index 27b87fe19193..8c48b0e8bff2 100644 --- a/cms/djangoapps/contentstore/tests/test_users.py +++ b/cms/djangoapps/contentstore/views/tests/test_user.py @@ -2,7 +2,7 @@ Tests for contentstore/views/user.py. """ import json -from .utils import CourseTestCase +from contentstore.tests.utils import CourseTestCase from django.contrib.auth.models import User, Group from student.models import CourseEnrollment from xmodule.modulestore.django import loc_mapper From 5dfe9d705231e50a0ca8dd9c69cbedc1c171286c Mon Sep 17 00:00:00 2001 From: cahrens Date: Tue, 4 Feb 2014 16:33:44 -0500 Subject: [PATCH 2/4] Remove unused methods. --- .../views/tests/test_transcripts.py | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/cms/djangoapps/contentstore/views/tests/test_transcripts.py b/cms/djangoapps/contentstore/views/tests/test_transcripts.py index 138b60b51322..f92e8e7f216f 100644 --- a/cms/djangoapps/contentstore/views/tests/test_transcripts.py +++ b/cms/djangoapps/contentstore/views/tests/test_transcripts.py @@ -333,17 +333,6 @@ def save_subs_to_store(self, subs, subs_id): del_cached_content(content_location) return content_location - def remove_subs_from_store(self, subs_id): - """Remove from store, if transcripts content exists.""" - filename = 'subs_{0}.srt.sjson'.format(subs_id) - content_location = StaticContent.compute_location( - self.org, self.number, filename) - try: - content = contentstore().find(content_location) - contentstore().delete(content.get_id()) - except NotFoundError: - pass - def test_success_download_youtube(self): self.item.data = '