'Verifies that delete_bookmark removes bookmark as expected.'

@patch('openedx.core.djangoapps.bookmarks.api.tracker.emit')
def test_delete_bookmark(self, mock_tracker):

    self.assertEqual(len(api.get_bookmarks(user=self.user)), 3)
    with self.assertNumQueries(3):
        api.delete_bookmark(user=self.user, usage_key=self.sequential_1.location)
    self.assert_bookmark_event_emitted(mock_tracker, event_name='edx.bookmark.removed', course_id=unicode(self.course_id), bookmark_id=self.bookmark_1.resource_id, component_type=self.sequential_1.location.block_type, component_usage_id=unicode(self.sequential_1.location))
    bookmarks_data = api.get_bookmarks(user=self.user)
    self.assertEqual(len(bookmarks_data), 2)
    self.assertNotEqual(unicode(self.sequential_1.location), bookmarks_data[0]['usage_id'])
    self.assertNotEqual(unicode(self.sequential_1.location), bookmarks_data[1]['usage_id'])
