Example #1
0
def populate_db():
    db_create()
    ucontr = UserController()
    ccontr = CategoryController()
    fcontr = FeedController()
    acontr = ArticleController()
    ccontr = CategoryController()
    user1, user2 = [
        ucontr.create(login=name, email="*****@*****.**" % name, password=name)
        for name in ["user1", "user2"]
    ]

    article_total = 0
    for user in (user1, user2):
        for i in range(3):
            cat_id = None
            if i:
                cat_id = ccontr.create(user_id=user.id,
                                       name="category%d" % i).id
            feed = fcontr.create(link="feed%d" % i,
                                 user_id=user.id,
                                 category_id=cat_id,
                                 title="%s feed%d" % (user.login, i))
            for j in range(3):
                entry = "%s %s article%d" % (user.login, feed.title, j)
                article_total += 1
                acontr.create(entry_id=entry,
                              link='http://test.te/%d' % article_total,
                              feed_id=feed.id,
                              user_id=user.id,
                              category_id=cat_id,
                              title=entry,
                              content="content %d" % article_total)
Example #2
0
def bootstrap_database(args, creds):
    if not args.no_database and not args.test:
        print("bootstraping databases...")
        import manager

        manager.db_empty()
        manager.db_create(creds["login"], creds["password"])
Example #3
0
def populate_db():
    db_create()
    ucontr = UserController()
    ccontr = CategoryController()
    fcontr = FeedController()
    acontr = ArticleController()
    ccontr = CategoryController()
    user1, user2 = [ucontr.create(login=name, email="*****@*****.**" % name,
                                  password=name)
                    for name in ["user1", "user2"]]

    article_total = 0
    for user in (user1, user2):
        for i in range(3):
            cat_id = None
            if i:
                cat_id = ccontr.create(user_id=user.id,
                                       name="category%d" % i).id
            feed = fcontr.create(link="feed%d" % i, user_id=user.id,
                                    category_id=cat_id,
                                    title="%s feed%d" % (user.login, i))
            for j in range(3):
                entry = "%s %s article%d" % (user.login, feed.title, j)
                article_total += 1
                acontr.create(entry_id=entry,
                        link='http://test.te/%d' % article_total,
                        feed_id=feed.id, user_id=user.id, category_id=cat_id,
                        title=entry, content="content %d" % article_total)
Example #4
0
def bootstrap_database(args, creds):
    if not args.no_database and not args.test:
        print('bootstraping databases...')
        import manager
        manager.db_empty()
        manager.db_create(creds['login'], creds['password'])