示例#1
0
 def test_edit_non_existant_thread_message(self):
     # Assert unable to edit non existant thread message
     with self.assertRaises(http_exceptions.NotFound):
         ThreadActions(actor=self.actor1).edit_thread_message(
             thread_id=self.thread_model.id,
             message_id=generate_random_string(5, 10),
             message=generate_random_words(5, 15))
示例#2
0
 def test_edit_thread_message_as_unauthorized_user(self):
     # Assert unable to edit thread message as unauthorized user
     with self.assertRaises(http_exceptions.Unauthorized):
         ThreadActions(actor=Actor()).edit_thread_message(
             thread_id=self.thread_model.id,
             message_id=self.thread_message_model.id,
             message=generate_random_string(5, 15))
示例#3
0
 def test_delete_non_existant_thread_message(self):
     # Assert unable to delete non existant thread message
     with self.assertRaises(http_exceptions.NotFound):
         ThreadActions(actor=self.actor1).remove_thread_message(
             thread_id=self.thread_model.id,
             message_id=generate_random_string(5, 10)
         )
示例#4
0
    def __init__(self):
        self.session = session()

        # Generate actor details
        self.firstname = generate_random_words()
        self.lastname = generate_random_words()
        self.username = generate_random_name()
        self.password = generate_random_string(5, 15)
 def test_get_non_existant_sent_application(self):
     # Assert unable to get non existant sent application
     with self.assertRaises(http_exceptions.NotFound):
         ThreadActions(actor=self.actor2).get_sent_thread_application(
             application_id=generate_random_string(5, 15))
示例#6
0
 def test_apply_to_non_existant_thread(self):
     # Assert unable to apply to non existant thread
     with self.assertRaises(http_exceptions.NotFound):
         ThreadActions(actor=self.actor2).apply_to_thread(thread_id=generate_random_string(5, 10))
 def test_accept_non_existant_received_invitation(self):
     # Assert unable to accept non existant invitation
     with self.assertRaises(http_exceptions.NotFound):
         ThreadActions(
             actor=self.actor2).accept_or_reject_thread_invitation(
                 invitation_id=generate_random_string(5, 15), accept=True)
 def test_create_thread_no_private_param(self):
     #  Assert unable to create thread without sending the private param
     with self.assertRaises(http_exceptions.BadRequest):
         ThreadsHandler(actor=self.actor).post(name=generate_random_string(10, 20), private=None)
 def test_create_thread_not_reaching_min_name(self):
     # Assert unable to create thread not reaching min name characters limit
     with self.assertRaises(http_exceptions.UnprocessableEntity):
         ThreadActions(actor=self.actor).create_thread(name=generate_random_string(1, 1))
 def test_create_thread_exceeding_max_name(self):
     # Assert unable to create thread exceeding max name characters limit
     with self.assertRaises(http_exceptions.UnprocessableEntity):
         ThreadActions(actor=self.actor).create_thread(name=generate_random_string(51, 51))
示例#11
0
 def test_signup_username_below_min_length(self):
     # Assert unable to signup with username below minimum length
     with self.assertRaises(http_exceptions.UnprocessableEntity):
         UserActions(actor=self.actor).signup(
             username=generate_random_string(1, 1))
示例#12
0
 def test_signup_lastname_over_max_length(self):
     # Assert unable to signup with lastname over maximum length
     with self.assertRaises(http_exceptions.UnprocessableEntity):
         UserActions(actor=self.actor).signup(
             lastname=generate_random_string(51, 51))
示例#13
0
 def test_signup_password_over_max_length(self):
     # Assert unable to signup with password over maximum length
     with self.assertRaises(http_exceptions.UnprocessableEntity):
         UserActions(actor=self.actor).signup(
             password=generate_random_string(21, 21))
示例#14
0
 def test_signup_password_below_min_length(self):
     # Assert unable to signup with password below minimum length
     with self.assertRaises(http_exceptions.UnprocessableEntity):
         UserActions(actor=self.actor).signup(
             password=generate_random_string(3, 3))
 def test_send_message_in_non_existant_thread(self):
     # Assert unable to send message in non existant thread
     with self.assertRaises(http_exceptions.NotFound):
         ThreadActions(actor=self.actor1).send_message_in_thread(
             thread_id=generate_random_string(5, 10))
 def test_get_thread_messages_of_non_existant_thread(self):
     # Assert unable to get non existant thread messages
     with self.assertRaises(http_exceptions.NotFound):
         ThreadActions(actor=self.actor1).get_thread_messages(
             thread_id=generate_random_string(10, 10))