Added testmode check for HandleclearUISignalQueue & HandleGetStatusBar functions, replaced sample_inbox_msg_receiver_address by sample_deterministic_addr4
This commit is contained in:
parent
9a194f0bae
commit
21cb4e516d
|
@ -310,6 +310,9 @@ class command(object): # pylint: disable=too-few-public-methods
|
||||||
self.aliases = aliases
|
self.aliases = aliases
|
||||||
|
|
||||||
def __call__(self, func):
|
def __call__(self, func):
|
||||||
|
if func.__name__ in ["HandleclearUISignalQueue", "HandleGetStatusBar"] \
|
||||||
|
and not state.testmode:
|
||||||
|
return None
|
||||||
if BMConfigParser().safeGet(
|
if BMConfigParser().safeGet(
|
||||||
'bitmessagesettings', 'apivariant') == 'legacy':
|
'bitmessagesettings', 'apivariant') == 'legacy':
|
||||||
def wrapper(*args):
|
def wrapper(*args):
|
||||||
|
@ -1428,6 +1431,7 @@ class BMRPCDispatcher(object):
|
||||||
def HandleclearUISignalQueue(self):
|
def HandleclearUISignalQueue(self):
|
||||||
"""clear UISignalQueue"""
|
"""clear UISignalQueue"""
|
||||||
queues.UISignalQueue.queue.clear()
|
queues.UISignalQueue.queue.clear()
|
||||||
|
return "success"
|
||||||
|
|
||||||
@command('statusBar')
|
@command('statusBar')
|
||||||
def HandleStatusBar(self, message):
|
def HandleStatusBar(self, message):
|
||||||
|
|
|
@ -4,8 +4,8 @@ import uuid
|
||||||
import helper_inbox
|
import helper_inbox
|
||||||
import helper_sql
|
import helper_sql
|
||||||
|
|
||||||
# from .tests.samples import sample_inbox_msg_ids, sample_inbox_msg_receiver_address
|
# from .tests.samples import sample_inbox_msg_ids, sample_deterministic_addr4
|
||||||
sample_inbox_msg_receiver_address = 'BM-2cWzSnwjJ7yRP3nLEWUV5LisTZyREWSzUK'
|
sample_deterministic_addr4 = 'BM-2cWzSnwjJ7yRP3nLEWUV5LisTZyREWSzUK'
|
||||||
sample_inbox_msg_ids = ['27e644765a3e4b2e973ee7ccf958ea20', '51fc5531-3989-4d69-bbb5-68d64b756f5b',
|
sample_inbox_msg_ids = ['27e644765a3e4b2e973ee7ccf958ea20', '51fc5531-3989-4d69-bbb5-68d64b756f5b',
|
||||||
'2c975c515f8b414db5eea60ba57ba455', 'bc1f2d8a-681c-4cc0-9a12-6067c7e1ac24']
|
'2c975c515f8b414db5eea60ba57ba455', 'bc1f2d8a-681c-4cc0-9a12-6067c7e1ac24']
|
||||||
|
|
||||||
|
@ -15,23 +15,23 @@ def populate_api_test_data():
|
||||||
helper_sql.sql_ready.wait()
|
helper_sql.sql_ready.wait()
|
||||||
|
|
||||||
test1 = (
|
test1 = (
|
||||||
sample_inbox_msg_ids[0], sample_inbox_msg_receiver_address,
|
sample_inbox_msg_ids[0], sample_deterministic_addr4,
|
||||||
sample_inbox_msg_receiver_address, 'Test1 subject', int(time.time()),
|
sample_deterministic_addr4, 'Test1 subject', int(time.time()),
|
||||||
'Test1 body', 'inbox', 2, 0, uuid.uuid4().bytes
|
'Test1 body', 'inbox', 2, 0, uuid.uuid4().bytes
|
||||||
)
|
)
|
||||||
test2 = (
|
test2 = (
|
||||||
sample_inbox_msg_ids[1], sample_inbox_msg_receiver_address,
|
sample_inbox_msg_ids[1], sample_deterministic_addr4,
|
||||||
sample_inbox_msg_receiver_address, 'Test2 subject', int(time.time()),
|
sample_deterministic_addr4, 'Test2 subject', int(time.time()),
|
||||||
'Test2 body', 'inbox', 2, 0, uuid.uuid4().bytes
|
'Test2 body', 'inbox', 2, 0, uuid.uuid4().bytes
|
||||||
)
|
)
|
||||||
test3 = (
|
test3 = (
|
||||||
sample_inbox_msg_ids[2], sample_inbox_msg_receiver_address,
|
sample_inbox_msg_ids[2], sample_deterministic_addr4,
|
||||||
sample_inbox_msg_receiver_address, 'Test3 subject', int(time.time()),
|
sample_deterministic_addr4, 'Test3 subject', int(time.time()),
|
||||||
'Test3 body', 'inbox', 2, 0, uuid.uuid4().bytes
|
'Test3 body', 'inbox', 2, 0, uuid.uuid4().bytes
|
||||||
)
|
)
|
||||||
test4 = (
|
test4 = (
|
||||||
sample_inbox_msg_ids[3], sample_inbox_msg_receiver_address,
|
sample_inbox_msg_ids[3], sample_deterministic_addr4,
|
||||||
sample_inbox_msg_receiver_address, 'Test4 subject', int(time.time()),
|
sample_deterministic_addr4, 'Test4 subject', int(time.time()),
|
||||||
'Test4 body', 'inbox', 2, 0, uuid.uuid4().bytes
|
'Test4 body', 'inbox', 2, 0, uuid.uuid4().bytes
|
||||||
)
|
)
|
||||||
helper_inbox.insert(test1)
|
helper_inbox.insert(test1)
|
||||||
|
|
|
@ -37,7 +37,6 @@ sample_daddr3_512 = 18875720106589866286514488037355423395410802084648916523381
|
||||||
sample_daddr4_512 = 25152821841976547050350277460563089811513157529113201589004
|
sample_daddr4_512 = 25152821841976547050350277460563089811513157529113201589004
|
||||||
|
|
||||||
sample_statusbar_msg = "new status bar message"
|
sample_statusbar_msg = "new status bar message"
|
||||||
sample_inbox_msg_receiver_address = 'BM-2cWzSnwjJ7yRP3nLEWUV5LisTZyREWSzUK'
|
|
||||||
sample_inbox_msg_ids = ['27e644765a3e4b2e973ee7ccf958ea20', '51fc5531-3989-4d69-bbb5-68d64b756f5b',
|
sample_inbox_msg_ids = ['27e644765a3e4b2e973ee7ccf958ea20', '51fc5531-3989-4d69-bbb5-68d64b756f5b',
|
||||||
'2c975c515f8b414db5eea60ba57ba455', 'bc1f2d8a-681c-4cc0-9a12-6067c7e1ac24']
|
'2c975c515f8b414db5eea60ba57ba455', 'bc1f2d8a-681c-4cc0-9a12-6067c7e1ac24']
|
||||||
sample_test_subscription_address = ['BM-2cWQLCBGorT9pUGkYSuGGVr9LzE4mRnQaq', 'BM-GtovgYdgs7qXPkoYaRgrLFuFKz1SFpsw']
|
sample_test_subscription_address = ['BM-2cWQLCBGorT9pUGkYSuGGVr9LzE4mRnQaq', 'BM-GtovgYdgs7qXPkoYaRgrLFuFKz1SFpsw']
|
||||||
|
|
|
@ -13,8 +13,7 @@ import psutil
|
||||||
|
|
||||||
from .samples import (
|
from .samples import (
|
||||||
sample_seed, sample_deterministic_addr3, sample_deterministic_addr4, sample_statusbar_msg,
|
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_inbox_msg_ids, sample_test_subscription_address, sample_subscription_name)
|
||||||
sample_subscription_name)
|
|
||||||
|
|
||||||
from .test_process import TestProcessProto
|
from .test_process import TestProcessProto
|
||||||
|
|
||||||
|
@ -114,7 +113,7 @@ class TestAPI(TestAPIProto):
|
||||||
)
|
)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
len(json.loads(
|
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):
|
def test_delete_message(self):
|
||||||
|
|
Reference in New Issue
Block a user