D-Bus test: make TestDBusServer.testGetConfigsTemplates pass regardless of the environment

The test used to fail if the user running the test had SyncML capable
devices paired via Bluez. Now the BluezManager is told to not use
Bluez in this particular test.
This commit is contained in:
Patrick Ohly 2011-08-26 15:04:17 +02:00
parent 197f9386fc
commit 41c08af6a6
2 changed files with 5 additions and 1 deletions

View File

@ -37,7 +37,10 @@ BluezManager::BluezManager(Server &server) :
m_adapterChanged(*this, "DefaultAdapterChanged")
{
const char *bluetoothTest = getenv ("DBUS_TEST_BLUETOOTH");
m_bluezConn = b_dbus_setup_bus(bluetoothTest ? DBUS_BUS_SESSION: DBUS_BUS_SYSTEM, NULL, true, NULL);
m_bluezConn = (bluetoothTest && !strcmp(bluetoothTest, "none")) ? NULL :
b_dbus_setup_bus((bluetoothTest && !strcmp(bluetoothTest, "session")) ?
DBUS_BUS_SESSION : DBUS_BUS_SYSTEM,
NULL, true, NULL);
if(m_bluezConn) {
m_done = false;
DBusClientCall1<DBusObject_t> getAdapter(*this, "DefaultAdapter");

View File

@ -749,6 +749,7 @@ class TestDBusServer(unittest.TestCase, DBusUtil):
configs = self.server.GetConfigs(False, utf8_strings=True)
self.assertEqual(configs, [])
@property("ENV", "DBUS_TEST_BLUETOOTH=none")
def testGetConfigsTemplates(self):
"""TestDBusServer.testGetConfigsTemplates - Server.GetConfigsTemplates()"""
configs = self.server.GetConfigs(True, utf8_strings=True)