コード例 #1
0
def create_random_userwine(connection, user, winery_id, wine_id):
    data = {
        'drink_after': get_random_date(past=False),
        'drink_before': get_random_date(past=False),
        'tags': json.dumps([random_name.adjective() for x in range(0, 4)])
    }
    userwine = POST(connection, "/winery/%d/wine/%d/userwine" % (winery_id, wine_id), data, user)
    userwine['user'] = user
    return userwine
コード例 #2
0
ファイル: testdata.py プロジェクト: classam/threepanel
def create_images(comics):
    for comic in comics:
        i = Image(comic=comic,
                  title=random_name.thing().title(),
                  image_url="http://curtis.lassam.net/comics/cube_drone/{}.gif".format(random.choice(range(0, 140))),
                  secret_text=random_name.thing(),
                  alt_text=random_name.adjective())
        i.save()
        print("Creating {}".format(i))
コード例 #3
0
def create_random_userwine(connection, user, winery_id, wine_id):
    data = {
        'drink_after': get_random_date(past=False),
        'drink_before': get_random_date(past=False),
        'tags': json.dumps([random_name.adjective() for x in range(0, 4)])
    }
    userwine = POST(connection,
                    "/winery/%d/wine/%d/userwine" % (winery_id, wine_id), data,
                    user)
    userwine['user'] = user
    return userwine
コード例 #4
0
def create_random_tasting(connection, user, winery_id, wine_id, userwine_id):
    data = {
        'consumption_type': random.choice(['tasting', 'bottle']),
        'consumption_location': random.choice(['home', 'winery', 'restaurant']),
        'date': get_random_date(past=True),
        'rating': random.randint(50, 99),
        'flawed': 'false',
        'note': random_name.adjective()
    }
    tasting = POST(connection,
                   "/winery/%d/wine/%d/userwine/%d/tasting" % (winery_id, wine_id, userwine_id), data)
    tasting['user'] = user
    return tasting
コード例 #5
0
def create_random_tasting(connection, user, winery_id, wine_id, userwine_id):
    data = {
        'consumption_type': random.choice(['tasting', 'bottle']),
        'consumption_location': random.choice(['home', 'winery',
                                               'restaurant']),
        'date': get_random_date(past=True),
        'rating': random.randint(50, 99),
        'flawed': 'false',
        'note': random_name.adjective()
    }
    tasting = POST(
        connection, "/winery/%d/wine/%d/userwine/%d/tasting" %
        (winery_id, wine_id, userwine_id), data)
    tasting['user'] = user
    return tasting
コード例 #6
0
ファイル: testdata.py プロジェクト: classam/threepanel
def random_comic(posted):
    words = random_name.special_thing()

    c = Comic(title=words,
              image_url="http://curtis.lassam.net/comics/cube_drone/{}.gif".format(random.choice(range(0, 140))),
              promo_text= "Promo text for {}".format(words)[:79],
              posted=posted,
              secret_text = "Secret text for {}".format(words),
              alt_text = "Alt text for {}".format(words),
              tags = [random_name.thing(), random_name.adjective(), random_name.noun()])
    if random.choice([False, False, False, True]):
        c.title = "Hidden {}".format(c.title)
        c.hidden = True
    c.save()
    print("Creating {}".format(c))
    return c
コード例 #7
0
def get_random_name():
    return random_name.adjective().capitalize() + " " + random_name.noun().capitalize()
コード例 #8
0
def get_random_name():
    return random_name.adjective().capitalize() + " " + random_name.noun(
    ).capitalize()