diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2014-04-26 22:05:15 -0300 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2014-04-26 22:05:15 -0300 |
commit | be8a4c9be188adbf6093be3913ecd9ab034e875b (patch) | |
tree | 2abfe6d38f8af5120db0f6aff5c4a1916f1a5ec1 | |
parent | 2468eacd4e2c3c02ae4db3621f3c4f7b021738df (diff) | |
download | askbot-be8a4c9be188adbf6093be3913ecd9ab034e875b.tar.gz askbot-be8a4c9be188adbf6093be3913ecd9ab034e875b.tar.bz2 askbot-be8a4c9be188adbf6093be3913ecd9ab034e875b.zip |
some changes in the "add test content" command and in the console util library
-rw-r--r-- | askbot/management/commands/askbot_add_test_content.py | 21 | ||||
-rw-r--r-- | askbot/utils/console.py | 2 |
2 files changed, 18 insertions, 5 deletions
diff --git a/askbot/management/commands/askbot_add_test_content.py b/askbot/management/commands/askbot_add_test_content.py index a09fb086..8eb1909f 100644 --- a/askbot/management/commands/askbot_add_test_content.py +++ b/askbot/management/commands/askbot_add_test_content.py @@ -121,7 +121,7 @@ class Command(NoArgsCommand): last_vote = False # Each user posts a question for i in range(NUM_QUESTIONS): - user = users[i] + user = users[i % len(users)]#allows to post many questions all by less users # Downvote/upvote the questions - It's reproducible, yet # gives good randomized data if not active_question is None: @@ -164,7 +164,8 @@ class Command(NoArgsCommand): active_answer = None last_vote = False # Now, fill the last added question with answers - for user in users[:NUM_ANSWERS]: + for i in range(NUM_ANSWERS): + user = users[i % len(users)] # We don't need to test for data validation, so ONLY users # that aren't authors can post answer to the question if not active_question.author is user: @@ -213,7 +214,8 @@ class Command(NoArgsCommand): active_question_comment = None active_answer_comment = None - for user in users[:NUM_COMMENTS]: + for i in range(NUM_COMMENTS): + user = users[i % len(users)] active_question_comment = user.post_comment( parent_post = active_question, body_text = COMMENT_TEMPLATE @@ -256,9 +258,20 @@ class Command(NoArgsCommand): # Create Users users = self.create_users() - # Create Questions, vote for questions + # Create a bunch of questions and answers by a single user + # to test pagination in the user profile + active_question = self.create_questions(users[0:1]) + + # Create Questions, vote for questions by all other users active_question = self.create_questions(users) + # post a bunch of answers by admin now - that active_question is + # posted by someone else + setting = askbot_settings.LIMIT_ONE_ANSWER_PER_USER + askbot_settings.update('LIMIT_ONE_ANSWER_PER_USER', False) + active_answer = self.create_answers(users[0:1], active_question) + askbot_settings.update('LIMIT_ONE_ANSWER_PER_USER', setting) + # Create Answers, vote for the answers, vote for the active question # vote for the active answer active_answer = self.create_answers(users, active_question) diff --git a/askbot/utils/console.py b/askbot/utils/console.py index ef318580..b955168c 100644 --- a/askbot/utils/console.py +++ b/askbot/utils/console.py @@ -25,7 +25,7 @@ def choice_dialog(prompt_phrase, choices = None, invalid_phrase = None): assert(not isinstance(choices, basestring)) while 1: response = raw_input( - '\n%s (type %s)\n> ' % (prompt_phrase, '/'.join(choices)) + '\n%s\ntype %s: ' % (prompt_phrase, '/'.join(choices)) ) if response in choices: return response |