def user_delete_before(self):
     """The user is deleted before the start of the verification.
     """
     if delete_user_from_database(telegramm_user_id):
         print("User for testing deleted")
     else:
         print("Error")
 def user_delete_after(self):
     """The user is deleted after the verification.
     """
     yield
     if delete_user_from_database(telegramm_user_id):
         print("User for testing deleted")
     else:
         print("Error")
Example #3
0
def unjoin_user(bot: Bot, update: Update, user_data: dict) -> Message:
    """The function is removing user from the database.
    :param bot: Bot
    :param update: Update
    :param user_data: User data
    :return: If the user is in the database, the function delete
             user from database and sends a message to the user.
             If an error occurs during deletion, an error message 
             is sent to the user. 
    """
    if delete_user_from_database(update.effective_user.id):
        text_message = settings.REMOVE_USER
    else:
        text_message = settings.ADD_ERROR

    update.message.reply_text(text_message, reply_markup=starting_keyboard())
 def test_delete_user_from_database(self, user_add_before):
     """Testing deleting a user from the database. 
        If the user is deleted without errors, the function returns True.
     """
     assert delete_user_from_database(telegramm_user_id) == True
Example #5
0
 def tearDownClass(cls):
    if delete_user_from_database(1111):
         print("User for testing deleted")
Example #6
0
 def test_delete_user_from_database(self):
     self.assertTrue(delete_user_from_database(1111))
Example #7
0
 def tearDownClass(cls):
     print(get_information_about_user(1111))
     if delete_user_from_database(1111):
         print("User for testing is delete")
     else:
         print("Error")