From 62ffe96bc8d8ad8931cd356f126776fc7c1dc7f5 Mon Sep 17 00:00:00 2001 From: "kuldeep.k@cisinlabs.com" Date: Fri, 26 Nov 2021 20:08:51 +0530 Subject: [PATCH] Added anouncement addr comment, replaces assertTrue with assertEqual & added print for getAllInboxMessages to check build failure --- src/tests/samples.py | 1 + src/tests/test_api.py | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/tests/samples.py b/src/tests/samples.py index 8c36dd89..e1a3e676 100644 --- a/src/tests/samples.py +++ b/src/tests/samples.py @@ -39,5 +39,6 @@ sample_daddr4_512 = 25152821841976547050350277460563089811513157529113201589004 sample_statusbar_msg = "new status bar message" sample_inbox_msg_ids = ['27e644765a3e4b2e973ee7ccf958ea20', '51fc5531-3989-4d69-bbb5-68d64b756f5b', '2c975c515f8b414db5eea60ba57ba455', 'bc1f2d8a-681c-4cc0-9a12-6067c7e1ac24'] +# second address in sample_test_subscription_address is for the announcement broadcast sample_test_subscription_address = ['BM-2cWQLCBGorT9pUGkYSuGGVr9LzE4mRnQaq', 'BM-GtovgYdgs7qXPkoYaRgrLFuFKz1SFpsw'] sample_subscription_name = 'test sub' diff --git a/src/tests/test_api.py b/src/tests/test_api.py index 167ff298..75a4290b 100644 --- a/src/tests/test_api.py +++ b/src/tests/test_api.py @@ -99,21 +99,27 @@ class TestAPI(TestAPIProto): def test_message_inbox(self): """Test message inbox methods""" - self.assertTrue( + print("getAllInboxMessages: ", json.loads( + self.api.getAllInboxMessages())["inboxMessages"]) + self.assertEqual( len(json.loads( - self.api.getAllInboxMessages())["inboxMessages"]) == 2 + self.api.getAllInboxMessages())["inboxMessages"]), + 2 ) - self.assertTrue( + self.assertEqual( len(json.loads( - self.api.getAllInboxMessageIds())["inboxMessageIds"]) == 2 + self.api.getAllInboxMessageIds())["inboxMessageIds"]), + 2 ) - self.assertTrue( + self.assertEqual( len(json.loads( - self.api.getInboxMessageById(hexlify(sample_inbox_msg_ids[2])))["inboxMessage"]) == 1 + self.api.getInboxMessageById(hexlify(sample_inbox_msg_ids[2])))["inboxMessage"]), + 1 ) - self.assertTrue( + self.assertEqual( len(json.loads( - self.api.getInboxMessagesByReceiver(sample_deterministic_addr4))["inboxMessages"]) == 2 + self.api.getInboxMessagesByReceiver(sample_deterministic_addr4))["inboxMessages"]), + 2 ) def test_delete_message(self):