Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
8c920b46
Commit
8c920b46
authored
Mar 11, 2015
by
Jonathan Piacenti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace broken logic in import template with working logic in view.
parent
b4c6211e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
8 deletions
+54
-8
cms/djangoapps/contentstore/views/import_export.py
+1
-0
cms/templates/import.html
+0
-4
common/test/acceptance/pages/studio/import_export.py
+17
-4
common/test/acceptance/tests/studio/test_import_export.py
+36
-0
No files found.
cms/djangoapps/contentstore/views/import_export.py
View file @
8c920b46
...
...
@@ -304,6 +304,7 @@ def _import_handler(request, courselike_key, root_name, successful_url, context_
context_name
:
courselike_module
,
'successful_import_redirect_url'
:
successful_url
,
'import_status_url'
:
status_url
,
'library'
:
isinstance
(
courselike_key
,
LibraryLocator
)
})
else
:
return
HttpResponseNotFound
()
...
...
cms/templates/import.html
View file @
8c920b46
...
...
@@ -4,10 +4,6 @@
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
import
json
try:
library =
True
except
NameError:
library =
False
%
>
<
%
block
name=
"title"
>
%if library:
...
...
common/test/acceptance/pages/studio/import_export.py
View file @
8c920b46
...
...
@@ -10,6 +10,19 @@ from .course_page import CoursePage
from
.
import
BASE_URL
class
TemplateCheckMixin
(
object
):
"""
Mixin for verifying that a template is loading the correct text.
"""
@property
def
header_text
(
self
):
"""
Get the header text of the page.
"""
# There are prefixes like 'Tools' and '>', but the text itself is not in a span.
return
self
.
q
(
css
=
'h1.page-header'
)[
0
]
.
text
.
split
(
'
\n
'
)[
-
1
]
class
ExportMixin
(
object
):
"""
Export page Mixin.
...
...
@@ -86,13 +99,13 @@ class LibraryLoader(object):
return
"/"
.
join
([
BASE_URL
,
self
.
url_path
,
unicode
(
self
.
locator
)])
class
ExportCoursePage
(
ExportMixin
,
CoursePage
):
class
ExportCoursePage
(
ExportMixin
,
TemplateCheckMixin
,
CoursePage
):
"""
Export page for Courses
"""
class
ExportLibraryPage
(
ExportMixin
,
LibraryLoader
,
LibraryPage
):
class
ExportLibraryPage
(
ExportMixin
,
TemplateCheckMixin
,
LibraryLoader
,
LibraryPage
):
"""
Export page for Libraries
"""
...
...
@@ -226,13 +239,13 @@ class ImportMixin(object):
return
self
.
q
(
css
=
'.action.action-primary'
)[
0
]
.
get_attribute
(
'href'
)
class
ImportCoursePage
(
ImportMixin
,
CoursePage
):
class
ImportCoursePage
(
ImportMixin
,
TemplateCheckMixin
,
CoursePage
):
"""
Import page for Courses
"""
class
ImportLibraryPage
(
ImportMixin
,
LibraryLoader
,
LibraryPage
):
class
ImportLibraryPage
(
ImportMixin
,
TemplateCheckMixin
,
LibraryLoader
,
LibraryPage
):
"""
Import page for Libraries
"""
common/test/acceptance/tests/studio/test_import_export.py
View file @
8c920b46
...
...
@@ -41,6 +41,15 @@ class TestCourseExport(ExportTestMixin, StudioCourseTest):
)
self
.
export_page
.
visit
()
def
test_header
(
self
):
"""
Scenario: I should see the correct text when exporting a course.
Given that I have a course to export from
When I visit the export page
The correct header should be shown
"""
self
.
assertEqual
(
self
.
export_page
.
header_text
,
'Course Export'
)
class
TestLibraryExport
(
ExportTestMixin
,
StudioLibraryTest
):
"""
...
...
@@ -54,6 +63,15 @@ class TestLibraryExport(ExportTestMixin, StudioLibraryTest):
self
.
export_page
=
ExportLibraryPage
(
self
.
browser
,
self
.
library_key
)
self
.
export_page
.
visit
()
def
test_header
(
self
):
"""
Scenario: I should see the correct text when exporting a library.
Given that I have a library to export from
When I visit the export page
The correct header should be shown
"""
self
.
assertEqual
(
self
.
export_page
.
header_text
,
'Library Export'
)
# pylint: disable=no-member
class
BadExportMixin
(
object
):
...
...
@@ -243,6 +261,15 @@ class TestCourseImport(ImportTestMixin, StudioCourseTest):
# There's a section named 'Section' in the tarball.
self
.
landing_page
.
section
(
"Section"
)
def
test_header
(
self
):
"""
Scenario: I should see the correct text when importing a course.
Given that I have a course to import to
When I visit the import page
The correct header should be shown
"""
self
.
assertEqual
(
self
.
import_page
.
header_text
,
'Course Import'
)
class
TestLibraryImport
(
ImportTestMixin
,
StudioLibraryTest
):
"""
...
...
@@ -276,3 +303,12 @@ class TestLibraryImport(ImportTestMixin, StudioLibraryTest):
self
.
landing_page
.
wait_until_ready
()
# There are three blocks in the tarball.
self
.
assertEqual
(
len
(
self
.
landing_page
.
xblocks
),
3
)
def
test_header
(
self
):
"""
Scenario: I should see the correct text when importing a library.
Given that I have a library to import to
When I visit the import page
The correct header should be shown
"""
self
.
assertEqual
(
self
.
import_page
.
header_text
,
'Library Import'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment