Broke out wrapper_tests to toxygen_wrapper
This commit is contained in:
parent
c5edc1f01b
commit
695d8e2cf9
@ -9,8 +9,8 @@ from time import sleep
|
|||||||
from gevent import monkey; monkey.patch_all(); del monkey # noqa
|
from gevent import monkey; monkey.patch_all(); del monkey # noqa
|
||||||
import gevent
|
import gevent
|
||||||
|
|
||||||
import tests.support_testing as ts
|
import wrapper_tests.support_testing as ts
|
||||||
from tests.tests_wrapper import bootstrap_iNodeInfo
|
from wrapper_tests.tests_wrapper import bootstrap_iNodeInfo
|
||||||
from user_data import settings
|
from user_data import settings
|
||||||
|
|
||||||
IDLE_PERIOD = 0.10
|
IDLE_PERIOD = 0.10
|
||||||
@ -117,8 +117,8 @@ from contacts.group_peer_factory import GroupPeerFactory
|
|||||||
from user_data.backup_service import BackupService
|
from user_data.backup_service import BackupService
|
||||||
import styles.style # TODO: dynamic loading
|
import styles.style # TODO: dynamic loading
|
||||||
|
|
||||||
from tests.support_testing import lLOCAL, lGOOD, lNEW, lRELAYS
|
from wrapper_tests.support_testing import lLOCAL, lGOOD, lNEW, lRELAYS
|
||||||
from tests.tests_wrapper import main as oTOX_OPTIONS, iMain, ToxOptions, iNodeInfo
|
from wrapper_tests.tests_wrapper import main as oTOX_OPTIONS, iMain, ToxOptions, iNodeInfo
|
||||||
|
|
||||||
global iI
|
global iI
|
||||||
iI = 0
|
iI = 0
|
||||||
|
@ -10,7 +10,7 @@ from av.call import Call
|
|||||||
import common.tox_save
|
import common.tox_save
|
||||||
|
|
||||||
from utils import ui as util_ui
|
from utils import ui as util_ui
|
||||||
import tests.support_testing as ts
|
import wrapper_tests.support_testing as ts
|
||||||
from middleware.threads import invoke_in_main_thread
|
from middleware.threads import invoke_in_main_thread
|
||||||
from main import sleep
|
from main import sleep
|
||||||
from middleware.threads import BaseThread
|
from middleware.threads import BaseThread
|
||||||
|
@ -5,18 +5,14 @@ from utils.util import *
|
|||||||
from PyQt5 import QtNetwork
|
from PyQt5 import QtNetwork
|
||||||
from PyQt5 import QtCore
|
from PyQt5 import QtCore
|
||||||
try:
|
try:
|
||||||
import requests
|
|
||||||
except ImportError:
|
|
||||||
requests = None
|
|
||||||
try:
|
|
||||||
import pycurl
|
|
||||||
import certifi
|
import certifi
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pycurl = None
|
certifi = None
|
||||||
|
|
||||||
from user_data.settings import get_user_config_path
|
from user_data.settings import get_user_config_path
|
||||||
from tests.support_testing import download_url, _get_nodes_path
|
from wrapper_tests.support_testing import _get_nodes_path
|
||||||
|
from wrapper_tests.support_http import download_url
|
||||||
|
|
||||||
global LOG
|
global LOG
|
||||||
import logging
|
import logging
|
||||||
@ -33,7 +29,7 @@ def download_nodes_list(settings, oArgs):
|
|||||||
result = fl.read()
|
result = fl.read()
|
||||||
return result
|
return result
|
||||||
LOG.debug("downloading list of nodes")
|
LOG.debug("downloading list of nodes")
|
||||||
result = download_url(url, settings._app)
|
result = download_url(url, settings._app._settings)
|
||||||
if not result:
|
if not result:
|
||||||
LOG.warn("failed downloading list of nodes")
|
LOG.warn("failed downloading list of nodes")
|
||||||
return ''
|
return ''
|
||||||
|
@ -40,7 +40,10 @@ class ContactsManager(ToxSave):
|
|||||||
self._history = history
|
self._history = history
|
||||||
self._load_contacts()
|
self._load_contacts()
|
||||||
|
|
||||||
def _log(self, s): self._ms(s)
|
def _log(self, s):
|
||||||
|
try:
|
||||||
|
self._ms._log(s)
|
||||||
|
except: pass
|
||||||
|
|
||||||
def get_contact(self, num):
|
def get_contact(self, num):
|
||||||
if num < 0 or num >= len(self._contacts):
|
if num < 0 or num >= len(self._contacts):
|
||||||
@ -431,6 +434,7 @@ class ContactsManager(ToxSave):
|
|||||||
:param message: additional message
|
:param message: additional message
|
||||||
:return: True on success else error string
|
:return: True on success else error string
|
||||||
"""
|
"""
|
||||||
|
retval = ''
|
||||||
try:
|
try:
|
||||||
message = message or 'Hello! Add me to your contact list please'
|
message = message or 'Hello! Add me to your contact list please'
|
||||||
if len(tox_id) == TOX_PUBLIC_KEY_SIZE * 2: # public key
|
if len(tox_id) == TOX_PUBLIC_KEY_SIZE * 2: # public key
|
||||||
|
@ -3,7 +3,7 @@ from messenger.messages import *
|
|||||||
from ui.contact_items import *
|
from ui.contact_items import *
|
||||||
import utils.util as util
|
import utils.util as util
|
||||||
from common.tox_save import ToxSave
|
from common.tox_save import ToxSave
|
||||||
from tests.support_testing import assert_main_thread
|
from wrapper_tests.support_testing import assert_main_thread
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
# LOG=util.log
|
# LOG=util.log
|
||||||
|
@ -12,7 +12,7 @@ faulthandler.enable()
|
|||||||
import warnings
|
import warnings
|
||||||
warnings.filterwarnings('ignore')
|
warnings.filterwarnings('ignore')
|
||||||
|
|
||||||
import tests.support_testing as ts
|
import wrapper_tests.support_testing as ts
|
||||||
try:
|
try:
|
||||||
from trepan.interfaces import server as Mserver
|
from trepan.interfaces import server as Mserver
|
||||||
from trepan.api import debug
|
from trepan.api import debug
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
|
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
|
||||||
import common.tox_save as tox_save
|
import common.tox_save as tox_save
|
||||||
from messenger.messages import *
|
from messenger.messages import *
|
||||||
from tests.support_testing import assert_main_thread
|
from wrapper_tests.support_testing import assert_main_thread
|
||||||
|
|
||||||
global LOG
|
global LOG
|
||||||
import logging
|
import logging
|
||||||
@ -170,7 +170,9 @@ class Messenger(tox_save.ToxSave):
|
|||||||
return
|
return
|
||||||
assert_main_thread()
|
assert_main_thread()
|
||||||
|
|
||||||
|
# FixMe: peer_id is None?
|
||||||
group_peer_contact = self._contacts_manager.get_or_create_group_peer_contact(group_number, peer_id)
|
group_peer_contact = self._contacts_manager.get_or_create_group_peer_contact(group_number, peer_id)
|
||||||
|
# group_peer_contact now may be None
|
||||||
group = self._get_group_by_number(group_number)
|
group = self._get_group_by_number(group_number)
|
||||||
messages = self._split_message(text.encode('utf-8'))
|
messages = self._split_message(text.encode('utf-8'))
|
||||||
t = util.get_unix_time()
|
t = util.get_unix_time()
|
||||||
|
@ -6,7 +6,7 @@ from PyQt5 import QtCore
|
|||||||
|
|
||||||
from bootstrap.bootstrap import *
|
from bootstrap.bootstrap import *
|
||||||
from bootstrap.bootstrap import download_nodes_list
|
from bootstrap.bootstrap import download_nodes_list
|
||||||
import tests.support_testing as ts
|
import wrapper_tests.support_testing as ts
|
||||||
from utils import util
|
from utils import util
|
||||||
|
|
||||||
if 'QtCore' in sys.modules:
|
if 'QtCore' in sys.modules:
|
||||||
|
@ -6,7 +6,7 @@ import wave
|
|||||||
|
|
||||||
from ui import widgets
|
from ui import widgets
|
||||||
import utils.util as util
|
import utils.util as util
|
||||||
import tests.support_testing as ts
|
import wrapper_tests.support_testing as ts
|
||||||
|
|
||||||
global LOG
|
global LOG
|
||||||
import logging
|
import logging
|
||||||
|
@ -7,7 +7,7 @@ from utils.util import *
|
|||||||
from ui.widgets import CenteredWidget, DataLabel, LineEdit, RubberBandWindow
|
from ui.widgets import CenteredWidget, DataLabel, LineEdit, RubberBandWindow
|
||||||
import updater.updater as updater
|
import updater.updater as updater
|
||||||
import utils.ui as util_ui
|
import utils.ui as util_ui
|
||||||
import tests.support_testing as ts
|
import wrapper_tests.support_testing as ts
|
||||||
from user_data import settings
|
from user_data import settings
|
||||||
|
|
||||||
global LOG
|
global LOG
|
||||||
@ -56,9 +56,10 @@ class AddContact(CenteredWidget):
|
|||||||
self._adding = False
|
self._adding = False
|
||||||
if send is True:
|
if send is True:
|
||||||
# request was successful
|
# request was successful
|
||||||
self.close()
|
pass
|
||||||
else: # print error data
|
elif send and type(send) == str: # print error data
|
||||||
self.errorLabel.setText(send)
|
self.errorLabel.setText(send)
|
||||||
|
self.close()
|
||||||
|
|
||||||
def _retranslate_ui(self):
|
def _retranslate_ui(self):
|
||||||
self.setWindowTitle(util_ui.tr('Add contact'))
|
self.setWindowTitle(util_ui.tr('Add contact'))
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
|
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
|
||||||
|
|
||||||
|
import os
|
||||||
from platform import system
|
from platform import system
|
||||||
import json
|
import json
|
||||||
import os
|
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
from utils.util import *
|
from utils.util import *
|
||||||
@ -10,7 +11,7 @@ from common.event import Event
|
|||||||
import utils.ui as util_ui
|
import utils.ui as util_ui
|
||||||
import utils.util as util_utils
|
import utils.util as util_utils
|
||||||
import user_data
|
import user_data
|
||||||
import tests.support_testing as ts
|
import wrapper_tests.support_testing as ts
|
||||||
|
|
||||||
global LOG
|
global LOG
|
||||||
import logging
|
import logging
|
||||||
@ -210,10 +211,15 @@ class Settings(dict):
|
|||||||
text = bytes(self._toxes.pass_encrypt(bytes(text, 'utf-8')))
|
text = bytes(self._toxes.pass_encrypt(bytes(text, 'utf-8')))
|
||||||
else:
|
else:
|
||||||
text = bytes(text, 'utf-8')
|
text = bytes(text, 'utf-8')
|
||||||
with open(self._path, 'wb') as fl:
|
tmp = self._path + str(os.getpid())
|
||||||
fl.write(text)
|
try:
|
||||||
|
with open(tmp, 'wb') as fl:
|
||||||
self._settings_saved_event(text)
|
fl.write(text)
|
||||||
|
os.rename(tmp, self._path)
|
||||||
|
except Exception as e:
|
||||||
|
LOG.warn(f'Error saving to {self._path} ' +str(e))
|
||||||
|
else:
|
||||||
|
self._settings_saved_event(text)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
path = self._profile_path + '.lock'
|
path = self._profile_path + '.lock'
|
||||||
|
Loading…
Reference in New Issue
Block a user