'Tests updates endpoint with /static in the content.
Tests both new updates format (using "items") and old format (using "data").'

@ddt.data(True, False)
def test_updates(self, new_format):

    self.login_and_enroll()
    updates_usage_key = self.course.id.make_usage_key('course_info', 'updates')
    course_updates = modulestore().create_item(self.user.id, updates_usage_key.course_key, updates_usage_key.block_type, block_id=updates_usage_key.block_id)
    num_updates = 3
    if new_format:
        for num in range(1, (num_updates + 1)):
            course_updates.items.append({'id': num, 'date': ('Date' + str(num)), 'content': (('<a    href="/static/">Update' + str(num)) + '</a>'), 'status': CourseInfoModule.STATUS_VISIBLE})
    else:
        update_data = ''
        for num in range(num_updates, 0, (-1)):
            update_data += (((('<li><h2>Date' + str(num)) + '</h2><a    href="/static/">Update') + str(num)) + '</a></li>')
        course_updates.data = ((u'<ol>' + update_data) + '</ol>')
    modulestore().update_item(course_updates, self.user.id)
    response = self.api_response()
    self.assertNotIn('"/static/', response.content)
    underlying_updates = modulestore().get_item(updates_usage_key)
    underlying_content = (underlying_updates.items[0]['content'] if new_format else underlying_updates.data)
    self.assertIn('"/static/', underlying_content)
    for num in range(1, (num_updates + 1)):
        update_data = response.data[(num_updates - num)]
        self.assertEquals(num, update_data['id'])
        self.assertEquals(('Date' + str(num)), update_data['date'])
        self.assertIn(('Update' + str(num)), update_data['content'])
