@slow('Loads home page data several times testing different cases')
def test_multiple_user_soft_deactivations(self) -> None:
    long_term_idle_user = self.example_user('hamlet')
    self.send_test_message('Testing', sender_name='hamlet')
    do_soft_deactivate_users([long_term_idle_user])
    message = 'Test Message 1'
    self.send_test_message(message)
    self.login(long_term_idle_user.email)
    with queries_captured() as queries:
        self.assertEqual(self.soft_activate_and_get_unread_count(), 2)
    query_count = len(queries)
    long_term_idle_user.refresh_from_db()
    self.assertFalse(long_term_idle_user.long_term_idle)
    idle_user_msg_list = get_user_messages(long_term_idle_user)
    self.assertEqual(idle_user_msg_list[(- 1)].content, message)
    message = 'Test Message 2'
    self.send_test_message(message)
    with queries_captured() as queries:
        self.assertEqual(self.soft_activate_and_get_unread_count(), 3)
    self.assertGreaterEqual((query_count - len(queries)), 5)
    idle_user_msg_list = get_user_messages(long_term_idle_user)
    self.assertEqual(idle_user_msg_list[(- 1)].content, message)
    self.logout()
    do_soft_deactivate_users([long_term_idle_user])
    message = 'Test Message 3'
    self.send_test_message(message)
    self.login(long_term_idle_user.email)
    with queries_captured() as queries:
        self.assertEqual(self.soft_activate_and_get_unread_count(), 4)
    query_count = len(queries)
    long_term_idle_user.refresh_from_db()
    self.assertFalse(long_term_idle_user.long_term_idle)
    idle_user_msg_list = get_user_messages(long_term_idle_user)
    self.assertEqual(idle_user_msg_list[(- 1)].content, message)
    message = 'Test Message 4'
    self.send_test_message(message)
    with queries_captured() as queries:
        self.assertEqual(self.soft_activate_and_get_unread_count(), 5)
    self.assertGreaterEqual((query_count - len(queries)), 5)
    idle_user_msg_list = get_user_messages(long_term_idle_user)
    self.assertEqual(idle_user_msg_list[(- 1)].content, message)
    self.logout()
@slow('Loads home page data several times testing different cases')
def test_multiple_user_soft_deactivations(self) -> None:
    long_term_idle_user = self.example_user('hamlet')
    self.send_test_message('Testing', sender_name='hamlet')
    do_soft_deactivate_users([long_term_idle_user])
    message = 'Test Message 1'
    self.send_test_message(message)
    self.login(long_term_idle_user.email)
    with queries_captured() as queries:
        self.assertEqual(self.soft_activate_and_get_unread_count(), 2)
    query_count = len(queries)
    long_term_idle_user.refresh_from_db()
    self.assertFalse(long_term_idle_user.long_term_idle)
    idle_user_msg_list = get_user_messages(long_term_idle_user)
    self.assertEqual(idle_user_msg_list[(- 1)].content, message)
    message = 'Test Message 2'
    self.send_test_message(message)
    with queries_captured() as queries:
        self.assertEqual(self.soft_activate_and_get_unread_count(), 3)
    self.assertGreaterEqual((query_count - len(queries)), 5)
    idle_user_msg_list = get_user_messages(long_term_idle_user)
    self.assertEqual(idle_user_msg_list[(- 1)].content, message)
    self.logout()
    do_soft_deactivate_users([long_term_idle_user])
    message = 'Test Message 3'
    self.send_test_message(message)
    self.login(long_term_idle_user.email)
    with queries_captured() as queries:
        self.assertEqual(self.soft_activate_and_get_unread_count(), 4)
    query_count = len(queries)
    long_term_idle_user.refresh_from_db()
    self.assertFalse(long_term_idle_user.long_term_idle)
    idle_user_msg_list = get_user_messages(long_term_idle_user)
    self.assertEqual(idle_user_msg_list[(- 1)].content, message)
    message = 'Test Message 4'
    self.send_test_message(message)
    with queries_captured() as queries:
        self.assertEqual(self.soft_activate_and_get_unread_count(), 5)
    self.assertGreaterEqual((query_count - len(queries)), 5)
    idle_user_msg_list = get_user_messages(long_term_idle_user)
    self.assertEqual(idle_user_msg_list[(- 1)].content, message)
    self.logout()