Philipp Hörist pushed to branch master at gajim / gajim

Commits:

4 changed files:

Changes:

  • test/integration/test_resolver.py
    ... ... @@ -9,7 +9,6 @@ from gi.repository import GLib
    9 9
     
    
    10 10
     from gajim.common import resolver
    
    11 11
     
    
    12
    -from mock import Mock, expectParams
    
    13 12
     from gajim_mocks import *
    
    14 13
     from xmpp_mocks import IdleQueueThread
    
    15 14
     
    

  • test/lib/__init__.py
    ... ... @@ -55,5 +55,5 @@ def setup_env():
    55 55
         if use_x:
    
    56 56
             from gajim import gtkgui_helpers
    
    57 57
             gtkgui_helpers.GUI_DIR = gajim_root + '/gajim/data/gui'
    
    58
    -        from gajim.gajim import GajimApplication
    
    58
    +        from gajim.application import GajimApplication
    
    59 59
             app.app = GajimApplication()

  • test/unit/test_jingle.py
    ... ... @@ -9,12 +9,11 @@ lib.setup_env()
    9 9
     from mock import Mock
    
    10 10
     
    
    11 11
     from gajim.common.protocol.bytestream import ConnectionIBBytestream, ConnectionSocks5Bytestream
    
    12
    -from common.xmpp import dispatcher_nb
    
    13
    -from common.xmpp import protocol
    
    12
    +from nbxmpp import dispatcher_nb
    
    13
    +from nbxmpp import protocol
    
    14 14
     from gajim.common.jingle import ConnectionJingle
    
    15
    -from gajim.common import gajim
    
    15
    +from gajim.common import app
    
    16 16
     from gajim.common.socks5 import SocksQueue
    
    17
    -import gajim.common
    
    18 17
     
    
    19 18
     
    
    20 19
     session_init = '''
    
    ... ... @@ -72,17 +71,17 @@ class Connection(Mock, ConnectionJingle, ConnectionSocks5Bytestream,
    72 71
             ConnectionIBBytestream.__init__(self)
    
    73 72
             self.connected = 2 # This tells gajim we are connected
    
    74 73
     
    
    75
    -
    
    76 74
         def send(self, stanza=None, when=None):
    
    77 75
             # Called when gajim wants to send something
    
    78 76
             print(str(stanza))
    
    79 77
     
    
    78
    +
    
    80 79
     class TestJingle(unittest.TestCase):
    
    81 80
     
    
    82 81
         def setUp(self):
    
    83 82
             self.dispatcher = dispatcher_nb.XMPPDispatcher()
    
    84
    -        gajim.nec = Mock()
    
    85
    -        gajim.socks5queue = SocksQueue(Mock())
    
    83
    +        app.nec = Mock()
    
    84
    +        app.socks5queue = SocksQueue(Mock())
    
    86 85
             # Setup mock client
    
    87 86
             self.client = Connection()
    
    88 87
             self.client.__str__ = lambda: 'Mock' # FIXME: why do I need this one?
    
    ... ... @@ -99,10 +98,10 @@ class TestJingle(unittest.TestCase):
    99 98
             a lot of places. It is easier to just copy it in here.
    
    100 99
             If the session_initiate stanza changes, this also must change.
    
    101 100
             '''
    
    102
    -        self.recieve_file = {'stream-methods':
    
    101
    +        self.receive_file = {'stream-methods':
    
    103 102
                                  'http://jabber.org/protocol/bytestreams',
    
    104 103
                                  'sender': 'jtest@thiessen.im/Gajim',
    
    105
    -                             'file-name': 'test_recieved_file',
    
    104
    +                             'file-name': 'test_received_file',
    
    106 105
                                  'request-id': '43', 'sid': '39',
    
    107 106
                                  'session-sid': '38', 'session-type': 'jingle',
    
    108 107
                                  'transfered_size': [], 'receiver':
    
    ... ... @@ -132,26 +131,23 @@ class TestJingle(unittest.TestCase):
    132 131
     
    
    133 132
         def _simulate_jingle_session(self):
    
    134 133
     
    
    135
    -        self.dispatcher.RegisterHandler('iq', self.con._JingleCB, 'set'
    
    136
    -                                        , common.xmpp.NS_JINGLE)
    
    134
    +        self.dispatcher.RegisterHandler('iq', self.con._JingleCB, 'set',
    
    135
    +                                        protocol.NS_JINGLE)
    
    137 136
             self.dispatcher.ProcessNonBlocking(session_init)
    
    138 137
             session = list(self.con._sessions.values())[0] # The only session we have
    
    139 138
             jft = list(session.contents.values())[0] # jingleFT object
    
    140
    -        jft.file_props = self.recieve_file # We plug file_props manually
    
    141
    -        # The user accepts to recieve the file
    
    139
    +        jft.file_props = self.receive_file # We plug file_props manually
    
    140
    +        # The user accepts to receive the file
    
    142 141
             # we have to manually simulate this behavior
    
    143 142
             session.approve_session()
    
    144
    -        self.con.send_file_approval(self.recieve_file)
    
    143
    +        self.con.send_file_approval(self.receive_file)
    
    145 144
     
    
    146 145
             self.dispatcher.ProcessNonBlocking(transport_info)
    
    147 146
     
    
    148
    -
    
    149 147
         def test_jingle_session(self):
    
    150 148
             self._simulate_connect()
    
    151 149
             self._simulate_jingle_session()
    
    152 150
     
    
    153 151
     
    
    154
    -
    
    155
    -
    
    156 152
     if __name__ == '__main__':
    
    157 153
         unittest.main()

  • test/unit/test_sessions.py
    ... ... @@ -13,13 +13,12 @@ from gajim.common import nec
    13 13
     from gajim.common import ged
    
    14 14
     from gajim.common.nec import NetworkEvent
    
    15 15
     from gajim.common.modules.message import MessageReceivedEvent
    
    16
    -from gajim.common.connection_handlers_events import DecryptedMessageReceivedEvent
    
    16
    +from gajim.common.modules.message import DecryptedMessageReceivedEvent
    
    17 17
     import nbxmpp
    
    18 18
     
    
    19 19
     from gajim.session import ChatControlSession
    
    20 20
     from gajim.roster_window import RosterWindow
    
    21 21
     
    
    22
    -from mock import Mock, expectParams
    
    23 22
     from gajim_mocks import *
    
    24 23
     from data import account1
    
    25 24