コード例 #1
0
def test3():
    print "TEST: dropping all DBs"
    db.remove_all()

    print "TEST: adding users"
    NUM_USERS = 10
    users = [str(i) for i in range(NUM_USERS)]
    add_user_result = reduce(
        lambda x, y: x and y,
        [db.add_user(i, "asdasdas", "some name" + str(i), []) for i in users])
    if not add_user_result:
        print "TEST: FAIL: ADD USERS"

    print "TEST: adding blogs"
    blogs = [
        "http://thissongissick.com", "http://eqmusicblog.com",
        'http://gorillavsbear.net', 'http://potholesinmyblog.com',
        'http://prettymuchamazing.com', 'http://disconaivete.com',
        'http://doandroidsdance.com', 'http://www.npr.org/blogs/allsongs/',
        'http://blogs.kcrw.com/musicnews/', "http://www.edmsauce.com"
    ]

    # add sources
    for i in range(len(blogs)):
        if not add_blog_source(blogs[i], users[i]):
            print "TEST: FAIL: ADDING SOURCE TO USER"

    # add same sources to different users a bunch of times
    for j in range(7):
        random.shuffle(users)
        random.shuffle(blogs)
        for i in range(len(blogs)):
            if not add_blog_source(blogs[i], users[i]):
                print "TEST: FAIL: ADDING SOURCE TO USER"

    print "TEST: adding new user to test for no sources"
    db.add_user("some_person", "asdasdas", "some name", [])

    print "TEST: getting recommendations"
    if not build_recommendations():
        print "TEST: FAIL: Could not build recommendations"
        return "test3 failed"
    return "test3 passed"
コード例 #2
0
def test3():
    print "TEST: dropping all DBs"
    db.remove_all()

    print "TEST: adding users"
    NUM_USERS = 10
    users = [str(i) for i in range(NUM_USERS)]
    add_user_result = reduce(lambda x,y: x and y, [db.add_user(i,"asdasdas","some name"+str(i),[]) for i in users])
    if not add_user_result:
        print "TEST: FAIL: ADD USERS"

    print "TEST: adding blogs"
    blogs = ["http://thissongissick.com",
        "http://eqmusicblog.com",'http://gorillavsbear.net',
        'http://potholesinmyblog.com', 'http://prettymuchamazing.com',
        'http://disconaivete.com', 'http://doandroidsdance.com',
        'http://www.npr.org/blogs/allsongs/','http://blogs.kcrw.com/musicnews/',
        "http://www.edmsauce.com"]

    # add sources
    for i in range(len(blogs)):
        if not add_blog_source(blogs[i],users[i]):
            print "TEST: FAIL: ADDING SOURCE TO USER"


    # add same sources to different users a bunch of times
    for j in range(7):
        random.shuffle(users)
        random.shuffle(blogs)
        for i in range(len(blogs)):
            if not add_blog_source(blogs[i],users[i]):
                print "TEST: FAIL: ADDING SOURCE TO USER"


    print "TEST: adding new user to test for no sources"
    db.add_user("some_person","asdasdas","some name",[])

    print "TEST: getting recommendations"
    if not build_recommendations():
        print "TEST: FAIL: Could not build recommendations"
        return "test3 failed"
    return "test3 passed"
コード例 #3
0
ファイル: play.py プロジェクト: Naveengnn/VoiceChatPyroBot
def clear_playlist(client, message):
    if db.remove_all():
        message.reply_text(_("playlist_10"))
    else:
        message.reply_text(_("playlist_1"))
コード例 #4
0
ファイル: cronapp.py プロジェクト: dlebech/Text-Universes
	def GET(self):
		return db.remove_all()