Ejemplo n.º 1
0
def make_post():
    comments = [make_comment() for _ in range(2)]
    author = make_author()
    return Post(id=fake.random_int(),
                title=fake.catch_phrase(),
                author=author,
                comments=comments)
Ejemplo n.º 2
0
def make_post(with_comments=True, with_author=True):
    comments = [make_comment() for _ in range(2)] if with_comments else []
    author = make_author() if with_author else None
    return Post(id=fake.random_int(),
                title=fake.catch_phrase(),
                author=author,
                comments=comments)
Ejemplo n.º 3
0
def make_author():
    return Author(
        id=fake.random_int(),
        first_name=fake.first_name(),
        last_name=fake.last_name(),
        twitter=fake.domain_word(),
    )
Ejemplo n.º 4
0
def make_post():
    comments = [make_comment() for _ in range(2)]
    author = make_author()
    return Post(
        id=fake.random_int(),
        title=fake.catch_phrase(),
        author=author,
        comments=comments)
Ejemplo n.º 5
0
def make_post(with_comments=True, with_author=True, with_keywords=True):
    comments = [make_comment() for _ in range(2)] if with_comments else []
    keywords = [make_keyword() for _ in range(3)] if with_keywords else []
    author = make_author() if with_author else None
    return Post(
        id=fake.random_int(),
        title=fake.catch_phrase(),
        author=author,
        author_id=author.id if with_author else None,
        comments=comments,
        keywords=keywords,
    )
Ejemplo n.º 6
0
def make_comment():
    return Comment(id=fake.random_int(), body=fake.bs())
Ejemplo n.º 7
0
def make_comment(with_author=True):
    author = make_author() if with_author else None
    return Comment(id=fake.random_int(), body=fake.bs(), author=author)
Ejemplo n.º 8
0
def make_author():
    return Author(id=fake.random_int(), first_name=fake.first_name(),
                    last_name=fake.last_name(), twitter=fake.domain_word())
Ejemplo n.º 9
0
def make_comment():
    return Comment(id=fake.random_int(), body=fake.bs())