Exemplo n.º 1
0
def cleanup(email):
    """Delete all the shitty presentations."""
    for j in storage.search_json(email):
        p = json.loads(j)
        if ('author' not in p or 'title' not in p or 'slides' not in p
                or not p['slides'] or not isinstance(p['slides'], list)):
            storage.delete(email, p['id'])
Exemplo n.º 2
0
def cleanup(email):
    """Delete all the shitty presentations."""
    for j in storage.search_json(email):
        p = json.loads(j)
        if ('author' not in p or 'title' not in p or 'slides' not in p
            or not p['slides'] or not isinstance(p['slides'], list)):
            storage.delete(email, p['id'])
Exemplo n.º 3
0
def test_search(email, presentation):
    pres = storage.store_presentation(email, presentation)
    new_presentation = deepcopy(presentation)
    del new_presentation['id']
    new_presentation['slides'] += new_presentation['slides']
    new_pres = storage.store_presentation(email, new_presentation)
    jsons = storage.search_json(email)
    presentations = map(json.loads, jsons)
    assert presentations in ([pres, new_pres], [new_pres, pres])
    pres_dict = dict((p['id'], p) for p in presentations)
    metas = storage.search_meta(email)
    for meta in metas:
        pres = pres_dict[meta['id']]
        for field in META_FIELDS:
            assert pres[field] == meta[field]