Exemple #1
0
    def initializeNetwork(self, network):

        self.event = Event()
        self.__message_buffer = []

        # Network Configuration
        self._networkManager = NetworkManager.NetworkManager(
            self.event, network)

        # This registers the message buffering feature based on network availability.
        self.event.subscribe('network.connected', self.__clear_payload_buffer)
        self.event.subscribe('network.disconnected',
                             self._networkManager.networkDisconnected)
 def test_network_disconnected(self):
     networkManager = NetworkManager.NetworkManager(None, '')
     networkManager.networkDisconnected()
     assert networkManager.networkActive == False
 def test_network_connected(self):
     networkManager = NetworkManager.NetworkManager(None, '')
     networkManager.networkConnected()
     assert networkManager.networkActive == True
 def test_invalid_ppp_create(self):
     with pytest.raises(Exception,
                        message='Invalid mode type: invalid-ppp'):
         networkManager = NetworkManager.NetworkManager('invalid-ppp')
 def test_create_non_network(self):
     networkManager = NetworkManager.NetworkManager(None, '')
     assert networkManager.networkActive == True
     assert repr(networkManager) == 'Network Agnostic Mode'
 def test_invalid_create(self):
     with pytest.raises(Exception, message='Invalid network type: invalid'):
         networkManager = NetworkManager.NetworkManager(None, 'invalid')
Exemple #7
0
 def test_invalid_ppp_create(self):
     with pytest.raises(Exception,
                        match='Invalid network type: invalid-ppp'):
         networkManager = NetworkManager.NetworkManager(None, 'invalid-ppp')