def shelf(**kw): global counter counter += 1 _carrier = carrier()['slug'] app_count = kw.get('app_count', 6) data = { 'apps': [app() for i in xrange(app_count)], 'app_count': app_count, 'background_image': SAMPLE_BG, 'background_image_landing': SAMPLE_BG, 'carrier': _carrier, 'description': '', 'id': counter, 'name': '%s Op Shelf' % _carrier.replace('_', ' ').capitalize(), 'region': 'restofworld', 'slug': 'shelf-%d' % counter, 'url': '/api/v2/feed/shelves/%d/' % counter } data = dict(data, **kw) if data['slug'] == 'shelf': data.update({ 'name': 'Shelf' }) elif data['slug'] == 'shelf-desc': data.update({ 'description': rand_text(), 'name': 'Shelf Description' }) return data
def feed_item(**kw): global counter counter += 1 return dict({ 'app': feed_app(), 'brand': brand(), 'carrier': carrier()['slug'], 'collection': collection(), 'id': counter, 'item_type': random.choice(['app', 'collection', 'brand']), 'url': '/api/v2/feed/items/%d/' % counter, 'region': region()['slug'], 'shelf': shelf() }, **kw)
def carriers_get(version=DEFAULT_API_VERSION, slug=None): return factory.carrier(slug=slug)
def gen(): return [factory.carrier(id=i, name=CARRIERS[slug], slug=slug) for i, slug in enumerate(CARRIERS)]
def gen(): return [ factory.carrier(id=i, name=CARRIERS[slug], slug=slug) for i, slug in enumerate(CARRIERS) ]