'Verifies that get_bookmarks returns data as expected.'

@ddt.data(1, 10, 20)
def test_get_bookmarks(self, count):

    (course, __, bookmarks) = self.create_course_with_bookmarks_count(count)
    with self.assertNumQueries(1):
        bookmarks_data = api.get_bookmarks(user=self.user)
        self.assertEqual(len(bookmarks_data), (count + 3))
    self.assert_bookmark_data_is_valid(bookmarks[(-1)], bookmarks_data[0])
    self.assert_bookmark_data_is_valid(self.bookmark_1, bookmarks_data[(-1)])
    self.assert_bookmark_data_is_valid(self.bookmark_2, bookmarks_data[(-2)])
    with self.assertNumQueries(1):
        bookmarks_data = api.get_bookmarks(user=self.user, fields=self.ALL_FIELDS)
        self.assertEqual(len(bookmarks_data), (count + 3))
    self.assert_bookmark_data_is_valid(bookmarks[(-1)], bookmarks_data[0])
    self.assert_bookmark_data_is_valid(self.bookmark_1, bookmarks_data[(-1)])
    with self.assertNumQueries(1):
        bookmarks_data = api.get_bookmarks(user=self.user, course_key=course.id)
        self.assertEqual(len(bookmarks_data), count)
    self.assert_bookmark_data_is_valid(bookmarks[(-1)], bookmarks_data[0])
    self.assert_bookmark_data_is_valid(bookmarks[0], bookmarks_data[(-1)])
    with self.assertNumQueries(1):
        bookmarks_data = api.get_bookmarks(user=self.user, course_key=course.id, fields=self.ALL_FIELDS)
        self.assertEqual(len(bookmarks_data), count)
    self.assert_bookmark_data_is_valid(bookmarks[(-1)], bookmarks_data[0])
    self.assert_bookmark_data_is_valid(bookmarks[0], bookmarks_data[(-1)])
    with self.assertNumQueries(1):
        bookmarks = api.get_bookmarks(user=self.user, course_key=course.id, serialized=False)
        self.assertEqual(len(bookmarks), count)
    self.assertIs(bookmarks.model, Bookmark)
