Commit ed6fdabc by Clinton Blackburn

Decreased log level of CourseRun seat type property

This is quite noisy, and we aren't doing anything with this information.

ECOM-5099
parent 8613cac2
...@@ -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.warning('Unable to determine type for course run [%s]. Seat types are [%s]', self.key, seat_types) logger.debug('Unable to determine type for course run [%s]. Seat types are [%s]', self.key, seat_types)
return None return None
@property @property
......
...@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment