Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
0
def carriers_get(version=DEFAULT_API_VERSION, slug=None):
    return factory.carrier(slug=slug)
Ejemplo n.º 6
0
 def gen():
     return [factory.carrier(id=i, name=CARRIERS[slug], slug=slug)
             for i, slug in enumerate(CARRIERS)]
Ejemplo n.º 7
0
def carriers_get(version=DEFAULT_API_VERSION, slug=None):
    return factory.carrier(slug=slug)
Ejemplo n.º 8
0
 def gen():
     return [
         factory.carrier(id=i, name=CARRIERS[slug], slug=slug)
         for i, slug in enumerate(CARRIERS)
     ]