D-Bus testing: adapted to revised deviceName/peerName semantic

The test script still tested peerName although now that information is
stored in a dedicated hardwareName. Also unified the tests a bit and
covered all ways of returning names for the device.
This commit is contained in:
Patrick Ohly 2011-10-20 12:54:44 +02:00
parent 4a303e140e
commit a85bdee7c8
1 changed files with 10 additions and 12 deletions

View File

@ -3172,15 +3172,6 @@ class TestBluetooth(unittest.TestCase, DBusUtil):
def run(self, result):
self.runTest(result)
@property("ENV", "DBUS_TEST_BLUETOOTH=session")
@timeout(100)
def testBluetoothProductId(self):
"""TestBluetooth.testBluetoothProductId - check that fingerprint was properly matched using productId"""
# This needs to be called before we can fetch the single config.
configs = self.server.GetConfigs(True, utf8_strings=True)
config = self.server.GetConfig(bt_template, True, utf8_strings=True)
self.failIf(string.find(config['']["fingerPrint"], bt_fingerprint) < 0)
@property("ENV", "DBUS_TEST_BLUETOOTH=session")
@timeout(100)
def testBluetoothTemplates(self):
@ -3191,12 +3182,19 @@ class TestBluetooth(unittest.TestCase, DBusUtil):
@property("ENV", "DBUS_TEST_BLUETOOTH=session")
@timeout(100)
def testBluetoothUserModifiableDeviceName(self):
"""TestBluetooth.testBluetoothUserModifiableDeviceName - check that peerName equals """
def testBluetoothNames(self):
"""TestBluetooth.testBluetoothNames - check that fingerPrint/peerName/deviceName/hardwareName are set correctly"""
# This needs to be called before we can fetch the single config.
configs = self.server.GetConfigs(True, utf8_strings=True)
config = self.server.GetConfig(bt_template, True, utf8_strings=True)
self.failUnlessEqual(config['']["peerName"], bt_name)
# user-configurable name
self.failUnlessEqual(config['']["deviceName"], bt_name)
# must not be set
self.failIf("peerName" in config[''])
# all of the possible strings in the template, must include the hardware name of this example device
self.failIf(string.find(config['']["fingerPrint"], bt_fingerprint) < 0)
# real hardware information
self.failUnlessEqual(config['']["hardwareName"], bt_fingerprint)
if __name__ == '__main__':
unittest.main()