Commit 38218ace authored by André's avatar André
Browse files

Tests: fix imports

parent c49f9d60
......@@ -9,7 +9,6 @@
from gajim.common import resolver
from mock import Mock, expectParams
from gajim_mocks import *
from xmpp_mocks import IdleQueueThread
......@@ -55,5 +55,5 @@ def setup_env():
if use_x:
from gajim import gtkgui_helpers
gtkgui_helpers.GUI_DIR = gajim_root + '/gajim/data/gui'
from gajim.gajim import GajimApplication
from gajim.application import GajimApplication = GajimApplication()
......@@ -9,12 +9,11 @@
from mock import Mock
from gajim.common.protocol.bytestream import ConnectionIBBytestream, ConnectionSocks5Bytestream
from common.xmpp import dispatcher_nb
from common.xmpp import protocol
from nbxmpp import dispatcher_nb
from nbxmpp import protocol
from gajim.common.jingle import ConnectionJingle
from gajim.common import gajim
from gajim.common import app
from gajim.common.socks5 import SocksQueue
import gajim.common
session_init = '''
......@@ -72,17 +71,17 @@ def __init__(self):
self.connected = 2 # This tells gajim we are connected
def send(self, stanza=None, when=None):
# Called when gajim wants to send something
class TestJingle(unittest.TestCase):
def setUp(self):
self.dispatcher = dispatcher_nb.XMPPDispatcher() = Mock()
gajim.socks5queue = SocksQueue(Mock()) = Mock()
app.socks5queue = SocksQueue(Mock())
# Setup mock client
self.client = Connection()
self.client.__str__ = lambda: 'Mock' # FIXME: why do I need this one?
......@@ -99,10 +98,10 @@ def setUp(self):
a lot of places. It is easier to just copy it in here.
If the session_initiate stanza changes, this also must change.
self.recieve_file = {'stream-methods':
self.receive_file = {'stream-methods':
'sender': '',
'file-name': 'test_recieved_file',
'file-name': 'test_received_file',
'request-id': '43', 'sid': '39',
'session-sid': '38', 'session-type': 'jingle',
'transfered_size': [], 'receiver':
......@@ -132,26 +131,23 @@ def _simulate_connect(self):
def _simulate_jingle_session(self):
self.dispatcher.RegisterHandler('iq', self.con._JingleCB, 'set'
, common.xmpp.NS_JINGLE)
self.dispatcher.RegisterHandler('iq', self.con._JingleCB, 'set',
session = list(self.con._sessions.values())[0] # The only session we have
jft = list(session.contents.values())[0] # jingleFT object
jft.file_props = self.recieve_file # We plug file_props manually
# The user accepts to recieve the file
jft.file_props = self.receive_file # We plug file_props manually
# The user accepts to receive the file
# we have to manually simulate this behavior
def test_jingle_session(self):
if __name__ == '__main__':
......@@ -13,13 +13,12 @@
from gajim.common import ged
from import NetworkEvent
from gajim.common.modules.message import MessageReceivedEvent
from gajim.common.connection_handlers_events import DecryptedMessageReceivedEvent
from gajim.common.modules.message import DecryptedMessageReceivedEvent
import nbxmpp
from gajim.session import ChatControlSession
from gajim.roster_window import RosterWindow
from mock import Mock, expectParams
from gajim_mocks import *
from data import account1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment