Пример #1
0
 def test_no_session(self):
     self.env(None)
     try:
         endpoints.getDBusEnvEndpoints(reactor)
         self.assertTrue(False)
     except Exception as e:
         self.assertEquals(str(e), 'DBus Session environment variable not set')
Пример #2
0
 def test_no_session(self):
     self.env(None)
     try:
         endpoints.getDBusEnvEndpoints(reactor)
         self.assertTrue(False)
     except Exception as e:
         self.assertEquals(str(e), "DBus Session environment variable not set")
Пример #3
0
    def setUp(self):

        if INTERNAL_BUS:
            os.environ['DBUS_SESSION_BUS_ADDRESS'] = (
                'unix:abstract=/tmp/txdbus-test,guid=5'
            )

            bus_obj = bus.Bus()

            f = Factory()
            f.protocol = bus.BusProtocol
            f.bus = bus_obj

            point = endpoints.getDBusEnvEndpoints(reactor, False)[0]
            d = point.listen(f)

            def got_port(port):
                self.port = port
                return self._client_connect()

            d.addCallback(got_port)

            return d
        else:
            return self._client_connect()
Пример #4
0
    def _client_connect(self):
        self.conn = None

        f = AuthFactory()

        point = endpoints.getDBusEnvEndpoints(reactor)[0]
        point.connect(f)

        d = f.getConnection()
        d.addCallback(self._connected)

        return d
Пример #5
0
    def _client_connect(self):
        self.conn = None

        f = AuthFactory()

        point = endpoints.getDBusEnvEndpoints(reactor)[0]
        point.connect(f)

        d = f.getConnection()
        d.addCallback(self._connected)

        return d
    def _setup(self):
        self.orig_env = os.environ['DBUS_SESSION_BUS_ADDRESS']
        
        os.environ['DBUS_SESSION_BUS_ADDRESS']='unix:abstract=/tmp/txdbus-test,guid=5'
            
        bus_obj = bus.Bus()

        f = Factory()
        f.protocol = bus.BusProtocol
        f.bus = bus_obj
        
        point = endpoints.getDBusEnvEndpoints(reactor, False)[0]
        d = point.listen(f)

        def got_port(port):
            self.port = port
        
        d.addCallback( got_port )
        
        return d
Пример #7
0
    def setUp(self):
        if INTERNAL_BUS:
            os.environ[
                'DBUS_SESSION_BUS_ADDRESS'] = 'unix:abstract=/tmp/txdbus-test,guid=5'

            bus_obj = bus.Bus()

            f = Factory()
            f.protocol = bus.BusProtocol
            f.bus = bus_obj

            point = endpoints.getDBusEnvEndpoints(reactor, False)[0]
            d = point.listen(f)

            def got_port(port):
                self.port = port
                return self._client_connect()

            d.addCallback(got_port)

            return d
        else:
            return self._client_connect()