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
b67c7629
Commit
b67c7629
authored
Feb 22, 2018
by
attiyaishaque
Committed by
Attiya Ishaque
Feb 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix that Enrollment track mandatory.
parent
111a501f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
4 deletions
+17
-4
course_discovery/apps/publisher/forms.py
+1
-1
course_discovery/apps/publisher/tests/test_forms.py
+11
-0
course_discovery/apps/publisher/tests/test_views.py
+5
-3
No files found.
course_discovery/apps/publisher/forms.py
View file @
b67c7629
...
@@ -384,7 +384,7 @@ class SeatForm(BaseForm):
...
@@ -384,7 +384,7 @@ class SeatForm(BaseForm):
(
Seat
.
CREDIT
,
_
(
'Credit'
)),
(
Seat
.
CREDIT
,
_
(
'Credit'
)),
]
]
type
=
forms
.
ChoiceField
(
choices
=
TYPE_CHOICES
,
required
=
Fals
e
,
label
=
_
(
'Enrollment Track'
))
type
=
forms
.
ChoiceField
(
choices
=
TYPE_CHOICES
,
required
=
Tru
e
,
label
=
_
(
'Enrollment Track'
))
price
=
forms
.
DecimalField
(
max_digits
=
6
,
decimal_places
=
2
,
required
=
False
,
initial
=
0.00
)
price
=
forms
.
DecimalField
(
max_digits
=
6
,
decimal_places
=
2
,
required
=
False
,
initial
=
0.00
)
credit_price
=
forms
.
DecimalField
(
max_digits
=
6
,
decimal_places
=
2
,
required
=
False
,
initial
=
0.00
)
credit_price
=
forms
.
DecimalField
(
max_digits
=
6
,
decimal_places
=
2
,
required
=
False
,
initial
=
0.00
)
...
...
course_discovery/apps/publisher/tests/test_forms.py
View file @
b67c7629
...
@@ -484,3 +484,14 @@ class SeatFormTests(TestCase):
...
@@ -484,3 +484,14 @@ class SeatFormTests(TestCase):
seat_form
=
SeatForm
(
data
=
form_data
)
seat_form
=
SeatForm
(
data
=
form_data
)
self
.
assertFalse
(
seat_form
.
is_valid
())
self
.
assertFalse
(
seat_form
.
is_valid
())
self
.
assertEqual
(
seat_form
.
errors
,
{
'price'
:
[
'Price must be greater than or equal to 0.01'
]})
self
.
assertEqual
(
seat_form
.
errors
,
{
'price'
:
[
'Price must be greater than or equal to 0.01'
]})
def
test_type_is_required
(
self
):
"""
Verify that form raises an error when type is not given
"""
seat_form
=
SeatForm
(
data
=
{})
self
.
assertFalse
(
seat_form
.
is_valid
())
self
.
assertEqual
(
seat_form
.
errors
,
{
'type'
:
[
'This field is required.'
]})
seat_form_with_type
=
SeatForm
(
data
=
{
'type'
:
Seat
.
AUDIT
})
self
.
assertTrue
(
seat_form_with_type
.
is_valid
())
course_discovery/apps/publisher/tests/test_views.py
View file @
b67c7629
...
@@ -3090,7 +3090,7 @@ class CourseRunEditViewTests(SiteMixin, TestCase):
...
@@ -3090,7 +3090,7 @@ class CourseRunEditViewTests(SiteMixin, TestCase):
# Update the data for course
# Update the data for course
data
=
{
'full_description'
:
'This is testing description.'
,
'image'
:
''
}
data
=
{
'full_description'
:
'This is testing description.'
,
'image'
:
''
}
self
.
updated_dict
=
self
.
_post_data
(
data
,
self
.
new_course
,
self
.
new_course_run
)
self
.
updated_dict
=
self
.
_post_data
(
data
,
self
.
new_course
,
self
.
new_course_run
,
self
.
seat
)
# Update the data for course-run
# Update the data for course-run
self
.
updated_dict
[
'is_xseries'
]
=
True
self
.
updated_dict
[
'is_xseries'
]
=
True
...
@@ -3158,7 +3158,7 @@ class CourseRunEditViewTests(SiteMixin, TestCase):
...
@@ -3158,7 +3158,7 @@ class CourseRunEditViewTests(SiteMixin, TestCase):
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
context
[
'organizations_ids'
],
[])
self
.
assertEqual
(
response
.
context
[
'organizations_ids'
],
[])
def
_post_data
(
self
,
data
,
course
,
course_run
):
def
_post_data
(
self
,
data
,
course
,
course_run
,
seat
=
None
):
course_dict
=
model_to_dict
(
course
)
course_dict
=
model_to_dict
(
course
)
course_dict
.
update
(
**
data
)
course_dict
.
update
(
**
data
)
course_dict
[
'team_admin'
]
=
self
.
user
.
id
course_dict
[
'team_admin'
]
=
self
.
user
.
id
...
@@ -3171,6 +3171,8 @@ class CourseRunEditViewTests(SiteMixin, TestCase):
...
@@ -3171,6 +3171,8 @@ class CourseRunEditViewTests(SiteMixin, TestCase):
course_dict
[
'start'
]
=
self
.
start_date_time
course_dict
[
'start'
]
=
self
.
start_date_time
course_dict
[
'end'
]
=
self
.
end_date_time
course_dict
[
'end'
]
=
self
.
end_date_time
course_dict
[
'organization'
]
=
self
.
organization_extension
.
organization
.
id
course_dict
[
'organization'
]
=
self
.
organization_extension
.
organization
.
id
if
seat
:
course_dict
.
update
(
**
model_to_dict
(
seat
))
course_dict
.
pop
(
'id'
)
course_dict
.
pop
(
'id'
)
return
course_dict
return
course_dict
...
@@ -3633,7 +3635,7 @@ class CourseRunEditViewTests(SiteMixin, TestCase):
...
@@ -3633,7 +3635,7 @@ class CourseRunEditViewTests(SiteMixin, TestCase):
user
=
self
.
new_course
.
course_team_admin
user
=
self
.
new_course
.
course_team_admin
self
.
client
.
login
(
username
=
user
.
username
,
password
=
USER_PASSWORD
)
self
.
client
.
login
(
username
=
user
.
username
,
password
=
USER_PASSWORD
)
post_data
=
self
.
_post_data
({
'image'
:
''
},
self
.
new_course
,
self
.
new_course_run
)
post_data
=
self
.
_post_data
({
'image'
:
''
},
self
.
new_course
,
self
.
new_course_run
,
self
.
seat
)
lms_course_id
=
'course-v1:edX+DemoX+Demo_Course'
lms_course_id
=
'course-v1:edX+DemoX+Demo_Course'
self
.
new_course_run
.
lms_course_id
=
lms_course_id
self
.
new_course_run
.
lms_course_id
=
lms_course_id
self
.
new_course_run
.
save
()
self
.
new_course_run
.
save
()
...
...
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