Trying to use the _settings

This commit is contained in:
Dmitri Bogomolov 2019-07-22 17:55:33 +03:00
parent 0975099e36
commit d32b5dea18
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
2 changed files with 13 additions and 9 deletions

View File

@ -219,12 +219,12 @@ class Main:
state.last_api_response = time.time() state.last_api_response = time.time()
# Apply special settings # Apply special settings
config = BMConfigParser() config = BMConfigParser()
config.set( # config.set(
'bitmessagesettings', 'apienabled', 'true') # 'bitmessagesettings', 'apienabled', 'true')
config.set( # config.set(
'bitmessagesettings', 'apiusername', 'username') # 'bitmessagesettings', 'apiusername', 'username')
config.set( # config.set(
'bitmessagesettings', 'apipassword', 'password') # 'bitmessagesettings', 'apipassword', 'password')
config.set( config.set(
'bitmessagesettings', 'apinotifypath', 'bitmessagesettings', 'apinotifypath',
os.path.join(app_dir, 'tests', 'apinotify_handler.py') os.path.join(app_dir, 'tests', 'apinotify_handler.py')

View File

@ -4,8 +4,8 @@ Tests using API.
import base64 import base64
import json import json
import time
import xmlrpclib # nosec import xmlrpclib # nosec
from time import sleep
from test_process import TestProcessProto from test_process import TestProcessProto
@ -16,6 +16,11 @@ class TestAPI(TestProcessProto):
_seed = base64.encodestring( _seed = base64.encodestring(
'TIGER, tiger, burning bright. In the forests of the night' 'TIGER, tiger, burning bright. In the forests of the night'
) )
_settings = {
'apienabled': 'true',
'apiusername': 'username',
'apipassword': 'password'
}
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
@ -26,9 +31,8 @@ class TestAPI(TestProcessProto):
"http://username:password@127.0.0.1:8442/") "http://username:password@127.0.0.1:8442/")
for _ in range(0, 5): for _ in range(0, 5):
if cls._get_readline('.api_started'): if cls._get_readline('.api_started'):
print('API start detected!')
return return
sleep(1) time.sleep(1)
def _add_random_address(self, label): def _add_random_address(self, label):
return self.api.createRandomAddress(base64.encodestring(label)) return self.api.createRandomAddress(base64.encodestring(label))