Added type field to bookmark resource.
This commit is contained in:
committed by
muzaffaryousaf
parent
1616de5051
commit
cfd1fabb67
@@ -6,6 +6,7 @@ DEFAULT_FIELDS = [
|
||||
'id',
|
||||
'course_id',
|
||||
'usage_id',
|
||||
'block_type',
|
||||
'created',
|
||||
]
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ class BookmarkSerializer(serializers.ModelSerializer):
|
||||
id = serializers.SerializerMethodField('resource_id') # pylint: disable=invalid-name
|
||||
course_id = serializers.Field(source='course_key')
|
||||
usage_id = serializers.Field(source='usage_key')
|
||||
block_type = serializers.Field(source='usage_key.block_type')
|
||||
path = serializers.Field(source='path')
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@@ -38,6 +39,7 @@ class BookmarkSerializer(serializers.ModelSerializer):
|
||||
'id',
|
||||
'course_id',
|
||||
'usage_id',
|
||||
'block_type',
|
||||
'display_name',
|
||||
'path',
|
||||
'created',
|
||||
|
||||
@@ -75,6 +75,7 @@ class BookmarksAPITests(ModuleStoreTestCase):
|
||||
self.assertEqual(response_data['id'], '%s,%s' % (self.user.username, unicode(bookmark.usage_key)))
|
||||
self.assertEqual(response_data['course_id'], unicode(bookmark.course_key))
|
||||
self.assertEqual(response_data['usage_id'], unicode(bookmark.usage_key))
|
||||
self.assertEqual(response_data['block_type'], unicode(bookmark.usage_key.block_type))
|
||||
self.assertIsNotNone(response_data['created'])
|
||||
|
||||
if optional_fields:
|
||||
|
||||
@@ -54,6 +54,7 @@ class BookmarksAPITests(ModuleStoreTestCase):
|
||||
self.assertEqual(response_data['id'], '%s,%s' % (self.user.username, unicode(bookmark.usage_key)))
|
||||
self.assertEqual(response_data['course_id'], unicode(bookmark.course_key))
|
||||
self.assertEqual(response_data['usage_id'], unicode(bookmark.usage_key))
|
||||
self.assertEqual(response_data['block_type'], unicode(bookmark.usage_key.block_type))
|
||||
self.assertIsNotNone(response_data['created'])
|
||||
|
||||
self.assertEqual(response_data['display_name'], bookmark.display_name)
|
||||
|
||||
@@ -108,6 +108,7 @@ class BookmarksViewTestsMixin(ModuleStoreTestCase):
|
||||
self.assertEqual(response_data['id'], '%s,%s' % (self.user.username, unicode(bookmark.usage_key)))
|
||||
self.assertEqual(response_data['course_id'], unicode(bookmark.course_key))
|
||||
self.assertEqual(response_data['usage_id'], unicode(bookmark.usage_key))
|
||||
self.assertEqual(response_data['block_type'], unicode(bookmark.usage_key.block_type))
|
||||
self.assertIsNotNone(response_data['created'])
|
||||
|
||||
if optional_fields:
|
||||
|
||||
Reference in New Issue
Block a user