Added testmode check for HandleclearUISignalQueue & HandleGetStatusBar functions, replaced sample_inbox_msg_receiver_address by sample_deterministic_addr4

This commit is contained in:
kuldeep.k@cisinlabs.com 2021-11-18 21:24:05 +05:30
parent 9a194f0bae
commit 21cb4e516d
No known key found for this signature in database
GPG Key ID: AF4FB299BF7C7C2A
4 changed files with 16 additions and 14 deletions

View File

@ -310,6 +310,9 @@ class command(object): # pylint: disable=too-few-public-methods
self.aliases = aliases
def __call__(self, func):
if func.__name__ in ["HandleclearUISignalQueue", "HandleGetStatusBar"] \
and not state.testmode:
return None
if BMConfigParser().safeGet(
'bitmessagesettings', 'apivariant') == 'legacy':
def wrapper(*args):
@ -1428,6 +1431,7 @@ class BMRPCDispatcher(object):
def HandleclearUISignalQueue(self):
"""clear UISignalQueue"""
queues.UISignalQueue.queue.clear()
return "success"
@command('statusBar')
def HandleStatusBar(self, message):

View File

@ -4,8 +4,8 @@ import uuid
import helper_inbox
import helper_sql
# from .tests.samples import sample_inbox_msg_ids, sample_inbox_msg_receiver_address
sample_inbox_msg_receiver_address = 'BM-2cWzSnwjJ7yRP3nLEWUV5LisTZyREWSzUK'
# from .tests.samples import sample_inbox_msg_ids, sample_deterministic_addr4
sample_deterministic_addr4 = 'BM-2cWzSnwjJ7yRP3nLEWUV5LisTZyREWSzUK'
sample_inbox_msg_ids = ['27e644765a3e4b2e973ee7ccf958ea20', '51fc5531-3989-4d69-bbb5-68d64b756f5b',
'2c975c515f8b414db5eea60ba57ba455', 'bc1f2d8a-681c-4cc0-9a12-6067c7e1ac24']
@ -15,23 +15,23 @@ def populate_api_test_data():
helper_sql.sql_ready.wait()
test1 = (
sample_inbox_msg_ids[0], sample_inbox_msg_receiver_address,
sample_inbox_msg_receiver_address, 'Test1 subject', int(time.time()),
sample_inbox_msg_ids[0], sample_deterministic_addr4,
sample_deterministic_addr4, 'Test1 subject', int(time.time()),
'Test1 body', 'inbox', 2, 0, uuid.uuid4().bytes
)
test2 = (
sample_inbox_msg_ids[1], sample_inbox_msg_receiver_address,
sample_inbox_msg_receiver_address, 'Test2 subject', int(time.time()),
sample_inbox_msg_ids[1], sample_deterministic_addr4,
sample_deterministic_addr4, 'Test2 subject', int(time.time()),
'Test2 body', 'inbox', 2, 0, uuid.uuid4().bytes
)
test3 = (
sample_inbox_msg_ids[2], sample_inbox_msg_receiver_address,
sample_inbox_msg_receiver_address, 'Test3 subject', int(time.time()),
sample_inbox_msg_ids[2], sample_deterministic_addr4,
sample_deterministic_addr4, 'Test3 subject', int(time.time()),
'Test3 body', 'inbox', 2, 0, uuid.uuid4().bytes
)
test4 = (
sample_inbox_msg_ids[3], sample_inbox_msg_receiver_address,
sample_inbox_msg_receiver_address, 'Test4 subject', int(time.time()),
sample_inbox_msg_ids[3], sample_deterministic_addr4,
sample_deterministic_addr4, 'Test4 subject', int(time.time()),
'Test4 body', 'inbox', 2, 0, uuid.uuid4().bytes
)
helper_inbox.insert(test1)

View File

@ -37,7 +37,6 @@ sample_daddr3_512 = 18875720106589866286514488037355423395410802084648916523381
sample_daddr4_512 = 25152821841976547050350277460563089811513157529113201589004
sample_statusbar_msg = "new status bar message"
sample_inbox_msg_receiver_address = 'BM-2cWzSnwjJ7yRP3nLEWUV5LisTZyREWSzUK'
sample_inbox_msg_ids = ['27e644765a3e4b2e973ee7ccf958ea20', '51fc5531-3989-4d69-bbb5-68d64b756f5b',
'2c975c515f8b414db5eea60ba57ba455', 'bc1f2d8a-681c-4cc0-9a12-6067c7e1ac24']
sample_test_subscription_address = ['BM-2cWQLCBGorT9pUGkYSuGGVr9LzE4mRnQaq', 'BM-GtovgYdgs7qXPkoYaRgrLFuFKz1SFpsw']

View File

@ -13,8 +13,7 @@ import psutil
from .samples import (
sample_seed, sample_deterministic_addr3, sample_deterministic_addr4, sample_statusbar_msg,
sample_inbox_msg_receiver_address, sample_inbox_msg_ids, sample_test_subscription_address,
sample_subscription_name)
sample_inbox_msg_ids, sample_test_subscription_address, sample_subscription_name)
from .test_process import TestProcessProto
@ -114,7 +113,7 @@ class TestAPI(TestAPIProto):
)
self.assertTrue(
len(json.loads(
self.api.getInboxMessagesByReceiver(sample_inbox_msg_receiver_address))["inboxMessages"]) == 2
self.api.getInboxMessagesByReceiver(sample_deterministic_addr4))["inboxMessages"]) == 2
)
def test_delete_message(self):