Fixed CQ for test/core.py module
This commit is contained in:
parent
0023fc4b3d
commit
b7d920d529
|
@ -12,8 +12,15 @@ import sys
|
||||||
import time
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
import base64
|
||||||
|
import json
|
||||||
|
import xmlrpclib
|
||||||
import protocol
|
import protocol
|
||||||
import state
|
import state
|
||||||
|
import helper_sent
|
||||||
|
|
||||||
|
from addresses import decodeAddress
|
||||||
|
from helper_ackPayload import genAckPayload
|
||||||
from bmconfigparser import BMConfigParser
|
from bmconfigparser import BMConfigParser
|
||||||
from helper_msgcoding import MsgEncode, MsgDecode
|
from helper_msgcoding import MsgEncode, MsgDecode
|
||||||
from helper_startup import start_proxyconfig
|
from helper_startup import start_proxyconfig
|
||||||
|
@ -240,21 +247,18 @@ class TestCore(unittest.TestCase):
|
||||||
|
|
||||||
def test_insert_method(self):
|
def test_insert_method(self):
|
||||||
"""Test insert method of helper_sent module with message sending"""
|
"""Test insert method of helper_sent module with message sending"""
|
||||||
import helper_sent
|
api = xmlrpclib.ServerProxy("http://username:password@127.0.0.1:8442/")
|
||||||
from addresses import decodeAddress
|
fromAddress = api.createRandomAddress(base64.encodestring('random_3'))
|
||||||
from bmconfigparser import BMConfigParser
|
|
||||||
from helper_ackPayload import genAckPayload
|
|
||||||
|
|
||||||
toAddress = 'BM-2cVWtdUzPwF7UNGDrZftWuHWiJ6xxBpiSP' # this address is autoresponder address
|
toAddress = 'BM-2cVWtdUzPwF7UNGDrZftWuHWiJ6xxBpiSP' # this address is autoresponder address
|
||||||
message = 'test message'
|
message = 'test message'
|
||||||
subject = 'test subject'
|
subject = 'test subject'
|
||||||
fromAddress = 'BM-2cVdyaMNhYfnw8j1SDPW3QBhjzKzP9vtdp' # here use your own address for testing
|
|
||||||
|
|
||||||
status, addressVersionNumber, streamNumber, ripe = decodeAddress(
|
status, addressVersionNumber, streamNumber, ripe = decodeAddress(toAddress)
|
||||||
toAddress)
|
print('status: ', status)
|
||||||
|
print('addressVersionNumber: ', addressVersionNumber)
|
||||||
encoding = 2
|
encoding = 2
|
||||||
stealthLevel = BMConfigParser().safeGetInt(
|
stealthLevel = BMConfigParser().safeGetInt('bitmessagesettings', 'ackstealthlevel')
|
||||||
'bitmessagesettings', 'ackstealthlevel')
|
|
||||||
ackdata = genAckPayload(streamNumber, stealthLevel)
|
ackdata = genAckPayload(streamNumber, stealthLevel)
|
||||||
print('ackdata: ', ackdata)
|
print('ackdata: ', ackdata)
|
||||||
t = ('',
|
t = ('',
|
||||||
|
@ -273,7 +277,9 @@ class TestCore(unittest.TestCase):
|
||||||
encoding,
|
encoding,
|
||||||
0)
|
0)
|
||||||
helper_sent.insert(t)
|
helper_sent.insert(t)
|
||||||
self.assertTrue(True)
|
msg_exist = True if json.loads(
|
||||||
|
api.getSentMessagesByAddress(fromAddress))['sentMessages'] else False
|
||||||
|
self.assertTrue(msg_exist)
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
|
Reference in New Issue
Block a user