Add test scripts to to lock and unlock pin

This commit is contained in:
Kalle Valo 2010-08-09 17:22:31 +03:00 committed by Denis Kenzior
parent 6556eda51c
commit 1d449943af
3 changed files with 57 additions and 1 deletions

View File

@ -344,7 +344,9 @@ test_scripts = test/activate-context \
test/set-use-sms-reports \
test/set-cbs-topics \
test/enable-cbs \
test/propose-scan
test/propose-scan \
test/lock-pin \
test/unlock-pin
if TEST
testdir = $(pkglibdir)/test

27
test/lock-pin Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/python
import dbus
import sys
bus = dbus.SystemBus()
if len(sys.argv) == 4:
path = sys.argv[1]
pin_type = sys.argv[2]
pin = sys.argv[3]
elif len(sys.argv) == 3:
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
'org.ofono.Manager')
properties = manager.GetProperties()
path = properties["Modems"][0]
pin_type = sys.argv[1]
pin = sys.argv[2]
else:
print "%s [PATH] pin_type pin" % (sys.argv[0])
sys.exit(0)
print "Lock %s %s for modem %s..." % (pin_type, pin, path)
simmanager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.SimManager')
simmanager.LockPin(pin_type, pin)

27
test/unlock-pin Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/python
import dbus
import sys
bus = dbus.SystemBus()
if len(sys.argv) == 4:
path = sys.argv[1]
pin_type = sys.argv[2]
pin = sys.argv[3]
elif len(sys.argv) == 3:
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
'org.ofono.Manager')
properties = manager.GetProperties()
path = properties["Modems"][0]
pin_type = sys.argv[1]
pin = sys.argv[2]
else:
print "%s [PATH] pin_type pin" % (sys.argv[0])
sys.exit(0)
print "Unlock %s %s for modem %s..." % (pin_type, pin, path)
simmanager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.SimManager')
simmanager.UnlockPin(pin_type, pin)