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
90bef354
Commit
90bef354
authored
Aug 07, 2016
by
Clinton Blackburn
Committed by
GitHub
Aug 07, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #216 from edx/clintonb/minor-updates
Minor Updates
parents
8613cac2
e6144f12
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
21 deletions
+2
-21
course_discovery/apps/course_metadata/admin.py
+1
-1
course_discovery/apps/course_metadata/models.py
+1
-1
course_discovery/apps/course_metadata/tests/test_models.py
+0
-19
No files found.
course_discovery/apps/course_metadata/admin.py
View file @
90bef354
...
@@ -35,7 +35,7 @@ class CourseRunAdmin(admin.ModelAdmin):
...
@@ -35,7 +35,7 @@ class CourseRunAdmin(admin.ModelAdmin):
@admin.register
(
Program
)
@admin.register
(
Program
)
class
ProgramAdmin
(
admin
.
ModelAdmin
):
class
ProgramAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'uuid'
,
'title'
,)
list_display
=
(
'uuid'
,
'title'
,
'marketing_slug'
,
)
list_filter
=
(
'partner'
,)
list_filter
=
(
'partner'
,)
ordering
=
(
'uuid'
,
'title'
,)
ordering
=
(
'uuid'
,
'title'
,)
readonly_fields
=
(
'uuid'
,)
readonly_fields
=
(
'uuid'
,)
...
...
course_discovery/apps/course_metadata/models.py
View file @
90bef354
...
@@ -362,7 +362,7 @@ class CourseRun(TimeStampedModel):
...
@@ -362,7 +362,7 @@ class CourseRun(TimeStampedModel):
if
matching_seat_types
&
seat_types
:
if
matching_seat_types
&
seat_types
:
return
course_run_type
return
course_run_type
logger
.
warnin
g
(
'Unable to determine type for course run [
%
s]. Seat types are [
%
s]'
,
self
.
key
,
seat_types
)
logger
.
debu
g
(
'Unable to determine type for course run [
%
s]. Seat types are [
%
s]'
,
self
.
key
,
seat_types
)
return
None
return
None
@property
@property
...
...
course_discovery/apps/course_metadata/tests/test_models.py
View file @
90bef354
...
@@ -3,7 +3,6 @@ import itertools
...
@@ -3,7 +3,6 @@ import itertools
from
decimal
import
Decimal
from
decimal
import
Decimal
import
ddt
import
ddt
import
mock
import
pytz
import
pytz
from
dateutil.parser
import
parse
from
dateutil.parser
import
parse
from
django.db
import
IntegrityError
from
django.db
import
IntegrityError
...
@@ -166,24 +165,6 @@ class CourseRunTests(TestCase):
...
@@ -166,24 +165,6 @@ class CourseRunTests(TestCase):
factories
.
SeatFactory
(
course_run
=
self
.
course_run
,
type
=
seat_type
)
factories
.
SeatFactory
(
course_run
=
self
.
course_run
,
type
=
seat_type
)
self
.
assertEqual
(
self
.
course_run
.
type
,
expected_course_run_type
)
self
.
assertEqual
(
self
.
course_run
.
type
,
expected_course_run_type
)
def
assert_course_run_has_no_type
(
self
,
course_run
,
expected_seats
):
""" Asserts the given CourseRun has no type value, and a message is logged to that effect. """
with
mock
.
patch
(
'course_discovery.apps.course_metadata.models.logger'
)
as
mock_logger
:
self
.
assertEqual
(
course_run
.
type
,
None
)
mock_logger
.
warning
.
assert_called_with
(
'Unable to determine type for course run [
%
s]. Seat types are [
%
s]'
,
course_run
.
key
,
expected_seats
)
def
test_type_with_unknown_seat_type
(
self
):
""" Verify the property logs a warning if the CourseRun has no Seats or the Seats have an unknown seat type. """
self
.
assert_course_run_has_no_type
(
self
.
course_run
,
set
())
seat_type
=
'super-wrong'
factories
.
SeatFactory
(
course_run
=
self
.
course_run
,
type
=
seat_type
)
self
.
assert_course_run_has_no_type
(
self
.
course_run
,
set
([
seat_type
]))
def
test_level_type
(
self
):
def
test_level_type
(
self
):
""" Verify the property returns the associated Course's level type. """
""" Verify the property returns the associated Course's level type. """
self
.
assertEqual
(
self
.
course_run
.
level_type
,
self
.
course_run
.
course
.
level_type
)
self
.
assertEqual
(
self
.
course_run
.
level_type
,
self
.
course_run
.
course
.
level_type
)
...
...
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