Пример #1
0
def upvoter(message_id, votes):
    """Helps upvote a Yak with a multitude of users"""
    princeton = Location(42.3744, -71.1169)
    user = User(princeton)
    for i in range(1, votes + 1):
        user = User(princeton)
        print "Created user %d" % i
        threading.Timer(80, upvoter_helper, [i, user, message_id]).start()
Пример #2
0
def cdownvoter(comment_id, message_id, votes):
    """Downvotes a comment with a multitude of users"""
    princeton = Location(42.3744, -71.1169)
    user = User(princeton)
    for i in range(1, votes + 1):
        user = User(princeton)
        print "Created user %d" % i
        args = [i, user, comment_id, message_id]
        threading.Timer(10, cdownvoter_helper, args).start()
Пример #3
0
def upvote_timeout():
    """Find the approximate time to wait to upvote a Yak after creating user"""
    # Initialize
    user = User(TESTING_GROUNDS)
    user.post_yak("Test yak")
    yak = user.get_yaks()[0]

    # Wait for upvote to be processed
    print("Started timer")
    start_time = time.time()
    while yak.likes == 0:
        user.upvote_yak(yak)
        yak = user.get_yaks()[0]
        print(yak)
    end_time = time.time()

    # Print elapsed time
    elapsed_time = end_time - start_time
    print("Elapsed time: %f" % elapsed_time)
Пример #4
0
def upvote_timeout():
    """Find the approximate time to wait to upvote a Yak after creating user"""
    # Initialize
    user = User(TESTING_GROUNDS)
    user.post_yak("Test yak")
    yak = user.get_yaks()[0]

    # Wait for upvote to be processed
    print("Started timer")
    start_time = time.time()
    while yak.likes == 0:
        user.upvote_yak(yak)
        yak = user.get_yaks()[0]
        print(yak)
    end_time = time.time()

    # Print elapsed time
    elapsed_time = end_time - start_time
    print("Elapsed time: %f" % elapsed_time)
Пример #5
0
def cupvote_timeout():
    """Find the approximate time to wait to upvote a comment after creating
    user"""
    # Initialize
    user = User(TESTING_GROUNDS)
    user.post_yak("Test yak")
    yak = user.get_yaks()[0]
    while not yak.loaded:
        yak = user.get_yaks()[0]
    user.post_comment("Test comment", yak)
    comment = user.get_comments(yak)[0]

    # Wait for upvote to be processed
    print "Started timer"
    start_time = time.time()
    while comment.likes == 0:
        user.upvote_comment(yak)
        yak = user.get_yaks()[0]
        print yak
    end_time = time.time()

    # Print elapsed time
    elapsed_time = end_time - start_time
    print "Elapsed time: %f" % elapsed_time