Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
course-discovery
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
course-discovery
Commits
e4ad2a6d
Commit
e4ad2a6d
authored
Feb 13, 2017
by
Awais
Committed by
Awais Qureshi
Feb 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
After course-creation redirect towards course-detail page.
ECOM-7142
parent
15bd7d7f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
course_discovery/apps/publisher/tests/test_views.py
+9
-4
course_discovery/apps/publisher/views.py
+2
-2
No files found.
course_discovery/apps/publisher/tests/test_views.py
View file @
e4ad2a6d
...
...
@@ -199,9 +199,15 @@ class CreateCourseViewTests(TestCase):
course_dict
=
self
.
_post_data
(
data
,
self
.
course
,
self
.
course_run
,
self
.
seat
)
course_dict
[
'price'
]
=
0
course_dict
[
'type'
]
=
Seat
.
AUDIT
response
=
self
.
client
.
post
(
reverse
(
'publisher:publisher_courses_new'
),
course_dict
,
files
=
data
[
'image'
])
response
=
self
.
client
.
post
(
reverse
(
'publisher:publisher_courses_new'
),
course_dict
,
files
=
data
[
'image'
],
follow
=
True
)
course
=
Course
.
objects
.
get
(
number
=
data
[
'number'
])
self
.
_assert_test_data
(
response
,
course
,
Seat
.
AUDIT
,
0
)
self
.
assertIn
(
'You have successfully created a course. You can edit the course information'
,
response
.
content
.
decode
(
'UTF-8'
)
)
def
test_create_form_with_single_organization
(
self
):
"""Verify that if there is only one organization then that organization will be shown as text. """
...
...
@@ -304,15 +310,14 @@ class CreateCourseViewTests(TestCase):
def
_assert_test_data
(
self
,
response
,
course
,
expected_type
,
expected_price
):
course_run
=
course
.
publisher_course_runs
.
get
()
run_detail_path
=
reverse
(
'publisher:publisher_course_run_detail'
,
kwargs
=
{
'pk'
:
course_run
.
id
})
course_detail_path
=
reverse
(
'publisher:publisher_course_detail'
,
kwargs
=
{
'pk'
:
course
.
id
})
self
.
assertRedirects
(
response
,
expected_url
=
run
_detail_path
,
expected_url
=
course
_detail_path
,
status_code
=
302
,
target_status_code
=
200
)
self
.
assertEqual
(
course
.
organizations
.
first
(),
self
.
organization_extension
.
organization
)
self
.
assertEqual
(
len
(
course
.
course_user_roles
.
all
()),
3
)
self
.
assertEqual
(
course
.
course_user_roles
.
filter
(
role
=
PublisherUserRole
.
CourseTeam
)
.
count
(),
1
)
...
...
course_discovery/apps/publisher/views.py
View file @
e4ad2a6d
...
...
@@ -182,7 +182,7 @@ class CreateCourseView(mixins.LoginRequiredMixin, mixins.PublisherUserRequiredMi
run_form
=
CustomCourseRunForm
seat_form
=
CustomSeatForm
template_name
=
'publisher/add_update_course_form.html'
success_url
=
'publisher:publisher_course_
run_
detail'
success_url
=
'publisher:publisher_course_detail'
def
get_success_url
(
self
,
course_id
):
# pylint: disable=arguments-differ
return
reverse
(
self
.
success_url
,
kwargs
=
{
'pk'
:
course_id
})
...
...
@@ -266,7 +266,7 @@ class CreateCourseView(mixins.LoginRequiredMixin, mixins.PublisherUserRequiredMi
# sending email for notifying new course is created.
emails
.
send_email_for_course_creation
(
course
,
run_course
)
return
HttpResponseRedirect
(
self
.
get_success_url
(
run_
course
.
id
))
return
HttpResponseRedirect
(
self
.
get_success_url
(
course
.
id
))
except
Exception
as
e
:
# pylint: disable=broad-except
# pylint: disable=no-member
error_message
=
_
(
'An error occurred while saving your changes. {error}'
)
.
format
(
error
=
str
(
e
))
...
...
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