Beispiel #1
0
 def setUp(self):
     self._owner = NormalUser("test_user", "test_pass")
     self._comment = "this is my comment"
     self._create_comment_cmd = load_command("create_comment")
     self._create_comment_cmd.execute(owner=self._owner,
                                      comment=self._comment)
     self._command = load_command("view_own_comments")
 def setUp(self):
     self._normal_user = NormalUser("test_normal_user", "test_pass")
     self._comment = "this is my comment from a normal user"
     self._create_comment = load_command("create_comment")
     self._create_comment.execute(owner=self._normal_user,
                                  comment=self._comment)
     self._edit_comment_command = load_command("edit_comment")
Beispiel #3
0
 def setUp(self):
     self._username = "******"
     self._password = "******"
     self._login_cmd = load_command("login")
     self._create_user_cmd = load_command("create_user")
     self._create_user_cmd.execute(username=self._username,
                                   password=self._password,
                                   role="admin")
 def _add_a_comment(self):
     clear_screen()
     echo("Comments > New comment")  # bread crumbs
     print_separator()
     comment = prompt("Enter your comment", type=str)
     command = load_command("create_comment")
     command.execute(comment=comment, owner=self._user)
     self.comment_menu(error=command.message)
 def _view_own_comments(self):
     command = load_command("view_own_comments")
     command.execute(owner=self._user)
     clear_screen()
     echo("Comments > Your comment(s)")  # bread crumbs
     print_separator()
     if len(command.comments) > 0:
         count = 1
         for comment in command.comments:
             echo("-> {}. {}".format(count, comment))
             count += 1
         try:
             comment_id = prompt("\nEnter an option to edit", type=int)
             self._edit_own_comments(comment=command.comments[comment_id -
                                                              1])
         except Abort:
             self.comment_menu(error="")
     else:
         self.comment_menu(error=command.message)
 def setUp(self):
     self._owner = AdminUser("test_user", "test_pass")
     self._comment = "this is my comment"
     self._command = load_command("create_comment")
Beispiel #7
0
 def setUp(self):
     self._command = load_command("exit")
 def setUp(self):
     self._username = "******"
     self._password = "******"
     self._role = "admin"
     self._command = load_command("create_user")