def msg_general(self): data = { 'host': dna.get_host(), 'vpn': vpn_is_running(), 'tree': dna.get_tree(), 'exitnode': plebnet_settings.get_instance().tribler_exitnode() } self.send_msg("general: %s" % data)
def test_vpn_is_running(self): self.pid = plebnet_settings.Init.vpn_pid self.run = plebnet_settings.Init.vpn_running self.call = subprocess.call plebnet_settings.Init.vpn_pid = MagicMock(return_value='String') plebnet_settings.Init.vpn_running = MagicMock() subprocess.call = MagicMock(return_value=0) assert Core.vpn_is_running() subprocess.call = MagicMock(return_value=1) self.assertFalse(Core.vpn_is_running()) plebnet_settings.Init.vpn_pid = self.pid plebnet_settings.Init.vpn_running = self.run subprocess.call = self.call
def msg_general(self): qtable = QTable() qtable.read_dictionary() data = { 'host': qtable.self_state.provider, 'option': qtable.self_state.option, 'vpn': vpn_is_running(), 'tree': qtable.tree, 'exitnode': plebnet_settings.get_instance().tribler_exitnode() } self.send_msg("general: %s" % data)