Skip to content
Snippets Groups Projects
Commit 5f510a8d authored by Christopher Pappas's avatar Christopher Pappas
Browse files

Updating course overview serializer to return string data for has_ended and...

Updating course overview serializer to return string data for has_ended and has_started, and not a bound method

Oops meant this to be a bool and not a string type

Had to add a start and end date for the course overview test fixture for tests to pass
parent 1c4a645d
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,7 @@ class CourseOverviewBaseSerializer(serializers.ModelSerializer):
def to_representation(self, instance):
representation = super(CourseOverviewBaseSerializer, self).to_representation(instance)
representation['display_name_with_default'] = instance.display_name_with_default
representation['has_started'] = instance.has_started
representation['has_ended'] = instance.has_ended
representation['has_started'] = instance.has_started()
representation['has_ended'] = instance.has_ended()
representation['pacing'] = instance.pacing
return representation
from __future__ import absolute_import
from datetime import datetime, timedelta
import json
import factory
......@@ -35,3 +36,11 @@ class CourseOverviewFactory(DjangoModelFactory):
@factory.lazy_attribute
def display_name(self):
return "{} Course".format(self.id)
@factory.lazy_attribute
def start(self):
return datetime.now()
@factory.lazy_attribute
def end(self):
return datetime.now() + timedelta(30)
......@@ -35,3 +35,6 @@ class TestCourseOverviewSerializer(TestCase):
]
for field in fields:
assert field in data
assert isinstance(data['has_started'], bool)
assert isinstance(data['has_ended'], bool)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment