Added undeleteMessage function in helper_inbox & respective method in api.py and separated inbox & trash testcases
This commit is contained in:
parent
16175278a8
commit
5771f21cfb
|
@ -1459,6 +1459,13 @@ class BMRPCDispatcher(object):
|
|||
return None
|
||||
return data
|
||||
|
||||
@testmode('undeleteMessage')
|
||||
def HandleUndeleteMessage(self, msgid):
|
||||
"""Undelete message"""
|
||||
msgid = self._decode(msgid, "hex")
|
||||
helper_inbox.undeleteMessage(msgid)
|
||||
return "Undeleted message"
|
||||
|
||||
@command('deleteAndVacuum')
|
||||
def HandleDeleteAndVacuum(self):
|
||||
"""Cleanup trashes and vacuum messages database"""
|
||||
|
|
|
@ -18,6 +18,11 @@ def trash(msgid):
|
|||
queues.UISignalQueue.put(('removeInboxRowByMsgid', msgid))
|
||||
|
||||
|
||||
def undeleteMessage(msgid):
|
||||
"""Undelte the message"""
|
||||
sqlExecute('''UPDATE inbox SET folder='inbox' WHERE msgid=?''', msgid)
|
||||
|
||||
|
||||
def isMessageAlreadyInInbox(sigHash):
|
||||
"""Check for previous instances of this message"""
|
||||
queryReturn = sqlQuery(
|
||||
|
|
|
@ -97,9 +97,8 @@ class TestAPI(TestAPIProto):
|
|||
sample_statusbar_msg
|
||||
)
|
||||
|
||||
def test_message_inbox_and_trash(self):
|
||||
def test_message_inbox(self):
|
||||
"""Test message inbox methods"""
|
||||
# Inbox function related tests
|
||||
self.assertEqual(
|
||||
len(json.loads(
|
||||
self.api.getAllInboxMessages())["inboxMessages"]),
|
||||
|
@ -122,7 +121,9 @@ class TestAPI(TestAPIProto):
|
|||
4
|
||||
)
|
||||
|
||||
# Trash function related tests
|
||||
def test_message_trash(self):
|
||||
"""Test message inbox methods"""
|
||||
|
||||
messages_before_delete = len(json.loads(self.api.getAllInboxMessageIds())["inboxMessageIds"])
|
||||
self.assertEqual(
|
||||
self.api.trashMessage(hexlify(sample_inbox_msg_ids[0])),
|
||||
|
@ -136,6 +137,18 @@ class TestAPI(TestAPIProto):
|
|||
len(json.loads(self.api.getAllInboxMessageIds())["inboxMessageIds"]),
|
||||
messages_before_delete - 2
|
||||
)
|
||||
self.assertEqual(
|
||||
self.api.undeleteMessage(hexlify(sample_inbox_msg_ids[0])),
|
||||
'Undeleted message'
|
||||
)
|
||||
self.assertEqual(
|
||||
self.api.undeleteMessage(hexlify(sample_inbox_msg_ids[1])),
|
||||
'Undeleted message'
|
||||
)
|
||||
self.assertEqual(
|
||||
len(json.loads(self.api.getAllInboxMessageIds())["inboxMessageIds"]),
|
||||
messages_before_delete
|
||||
)
|
||||
|
||||
def test_clientstatus_consistency(self):
|
||||
"""If networkStatus is notConnected networkConnections should be 0"""
|
||||
|
|
Reference in New Issue
Block a user