@set_database
def setup_content_paths(context, db):
 context.unavailable_content_path = 'khan/foo/bar/unavail'
 context.available_content_path = get_random_content(kinds=['Exercise'], available=True)[0]['path']
 def iterator_content_items(ids=None, channel='khan', language='en'):
  return [(context.available_content_path, {'available': True})]
 annotate_content_models(db=db, iterator_content_items=iterator_content_items)
 with Using(db, [Item], with_transaction=False):
  context._unavailable_item = Item.create(title='Unavailable item', description='baz', available=False, kind='Video', id='3', slug='unavail', path=context.unavailable_content_path)

@ set_database def setup_content_paths ( context , db ) : context . unavailable_content_path = 'khan/foo/bar/unavail' context . available_content_path = get_random_content ( kinds = [ 'Exercise' ] , available = True ) [ 0 ] [ 'path' ] def iterator_content_items ( ids = None , channel = 'khan' , language = 'en' ) : return [ ( context . available_content_path , { 'available' : True } ) ] annotate_content_models ( db = db , iterator_content_items = iterator_content_items ) with Using ( db , [ Item ] , with_transaction = False ) : context . _unavailable_item = Item . create ( title = 'Unavailable item' , description = 'baz' , available = False , kind = 'Video' , id = '3' , slug = 'unavail' , path = context . unavailable_content_path )
creaters available content items and adds their urls to the context object .