def test_010_ListPhonebooks(self): """org.fresmartphone.GSM.SIM.ListPhonebooks""" result = self.sim.ListPhonebooks() testDbusType(result, dbus.Array) for value in result: testDbusType(value, dbus.String)
def test_031_GetMessageBookInfo(self): """org.freesmartphone.GSM.SIM.GetMessagebookInfo""" result = self.sim.GetMessagebookInfo() testDbusType(result, dbus.Dictionary) for key, value in result.items(): assert key in "first last used".split() testDbusValueIsInteger(value)
def test_003_SoundStatus( self ): """org.freesmartphone.Device.Audio.SoundStatus (stopped)""" self.audio.StopAllSounds() self.audio.PlaySound( SOUND_RESOURCE, 0, 0 ) self.audio.StopAllSounds( reply_handler=lambda:None, error_handler=lambda Foo:None ) result = yield ( tasklet.WaitDBusSignal( self.audio, 'SoundStatus', SIGNAL_TIMEOUT ) ) testDbusType( result, types.TupleType ) assert result[0] == SOUND_RESOURCE, "expected '%s' as key" % SOUND_RESOURCE assert result[1] == "stopped", "expected 'stopped' as value for sound resource"
def test_010_ListOperators(self): """org.freesmartphone.GSM.Network.ListProviders""" self.network.Register() result = self.network.ListProviders(timeout=60000) assert type( result ) == dbus.Array, "array expected, got '%s' instead" % type(result) for value in result: testDbusType(value, dbus.Struct) assert len( value) == 4, "expected a 4-tuple, got a %d-tuple" % len(value) code, status, longname, shortname = value testDbusValueIsInteger(code) testDbusType(status, dbus.String) testDbusType(longname, dbus.String) testDbusType(shortname, dbus.String) assert status in "forbidden current home".split( ), "unexpected status '%s', valid are 'forbidden', 'current', 'home'" % status
def test_033_RetrieveMessage(self): """org.freesmartphone.GSM.SIM.RetrieveMessage""" for index in xrange(1, 255): try: entry = self.sim.RetrieveMessage(index) except dbus.DBusException, e: assert e.get_dbus_name( ) == "org.freesmartphone.GSM.SIM.NotFound", "unexpected error returned" else: testDbusType(entry, types.TupleType) assert len(entry) == 4, "expected 4 elements for one entry" category, peer, contents, properties = entry assert category in "read unread sent unsent".split( ), "unexpected category '%s', valid are 'read unread sent unsent'" % category testDbusType( peer, dbus.String) # can be number or name (if found on SIM) testDbusType(contents, dbus.String) testDbusType(properties, dbus.Dictionary)
def test_000_GetCellBroadcastSubscription(self): """org.freesmartphone.GSM.Network.GetCellBroadcastSubscriptions""" result = self.cb.GetCellBroadcastSubscriptions() testDbusType(result, dbus.String)
def test_030_GetCallingIdentification(self): """org.freesmartphone.GSM.Network.GetCallingIdentification""" result = self.network.GetCallingIdentification() testDbusType(result, dbus.String) assert result in "on off network".split()
@REQUIRE("sim.present", True) def test_011_RetrievePhonebook(self): """org.fresmartphone.GSM.SIM.RetrievePhonebook""" try: self.sim.RetrievePhonebook("this/phonebook/not/there") except dbus.DBusException, e: assert e.get_dbus_name( ) == "org.freesmartphone.GSM.InvalidParameter" else: assert False, "InvalidParameter expected" for phonebook in self.sim.ListPhonebooks(): result = self.sim.RetrievePhonebook(phonebook) testDbusType(result, dbus.Array) for entry in result: testDbusType(entry, dbus.Struct) assert len(entry) == 3, "wrong length for struct" testDbusValueIsInteger(entry[0]) assert type( entry[1]) == dbus.String, "type for name not string" assert type( entry[2]) == dbus.String, "type for number not string" @REQUIRE("sim.present", True) def test_012_GetPhonebookInfo(self): """org.freesmartphone.GSM.SIM.GetPhonebookInfo""" try: