Beispiel #1
0
 def test_read_date_is_not_reset(self):
     """testing message read_date is not reset when unread label is removed again"""
     self.populate_database(1)
     with self.engine.connect() as con:
         query = 'SELECT msg_id FROM secure_message LIMIT 1'
         query_x = con.execute(query)
         names = []
         for row in query_x:
             names.append(row[0])
     with app.app_context():
         with current_app.test_request_context():
             msg_id = str(names[0])
             message_service = Retriever()
             modifier = Modifier()
             message = message_service.retrieve_message(
                 msg_id, 'internal.21345')
             modifier.del_unread(message, 'internal.21345')
             message = message_service.retrieve_message(
                 msg_id, 'internal.21345')
             read_date_set = message['read_date']
             modifier.add_unread(message, 'internal.21345')
             modifier.del_unread(message, 'internal.21345')
             message = message_service.retrieve_message(
                 msg_id, 'internal.21345')
             self.assertEqual(message['read_date'], read_date_set)
Beispiel #2
0
 def test_unread_label_is_removed_from_message(self):
     """testing message is added to database with archived label removed and inbox and read is added instead"""
     self.populate_database(1)
     with self.engine.connect() as con:
         query = 'SELECT msg_id FROM secure_message LIMIT 1'
         query_x = con.execute(query)
         names = []
         for row in query_x:
             names.append(row[0])
     with app.app_context():
         with current_app.test_request_context():
             msg_id = str(names[0])
             message_service = Retriever()
             message = message_service.retrieve_message(
                 msg_id, 'internal.21345')
             modifier = Modifier()
             modifier.del_unread(message, 'internal.21345')
             message = message_service.retrieve_message(
                 msg_id, 'internal.21345')
             self.assertCountEqual(message['labels'], ['INBOX'])
Beispiel #3
0
 def modify_unread(action, message, user_urn):
     if action == 'add':
         return Modifier.add_unread(message, user_urn)
     return Modifier.del_unread(message, user_urn)