diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2010-10-26 22:25:09 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2010-10-26 22:25:09 +0200 |
commit | 88ff795fcb2ad826bb510b7ec95b57dd27f42a76 (patch) | |
tree | 1d538f60386be6ccfc59a25a3bd6660ef1890dfd | |
parent | 501f4fd1d8b7517b13ab225f9106937ff9ba064f (diff) | |
download | ofono-88ff795fcb2ad826bb510b7ec95b57dd27f42a76.tar.bz2 |
test: Add scripts for creating Internet and MMS contexts
-rw-r--r-- | Makefile.am | 8 | ||||
-rwxr-xr-x | test/create-internet-context (renamed from test/create-context) | 25 | ||||
-rwxr-xr-x | test/create-mms-context (renamed from test/set-context) | 34 |
3 files changed, 42 insertions, 25 deletions
diff --git a/Makefile.am b/Makefile.am index 17797ae8..171ad910 100644 --- a/Makefile.am +++ b/Makefile.am @@ -356,9 +356,11 @@ doc_files = doc/overview.txt doc/ofono-paper.txt \ test_scripts = test/backtrace \ - test/create-context \ + test/create-internet-context \ + test/create-mms-context \ test/activate-context \ test/deactivate-context \ + test/deactivate-all \ test/dial-number \ test/list-calls \ test/answer-calls \ @@ -370,7 +372,6 @@ test_scripts = test/backtrace \ test/hangup-all \ test/hangup-active \ test/set-roaming-allowed \ - test/set-context \ test/list-contexts \ test/list-modems \ test/list-operators \ @@ -409,8 +410,7 @@ test_scripts = test/backtrace \ test/unlock-pin \ test/enable-gprs \ test/disable-gprs \ - test/get-icon \ - test/deactivate-all + test/get-icon if TEST testdir = $(pkglibdir)/test diff --git a/test/create-context b/test/create-internet-context index 6777ba79..3d548d02 100755 --- a/test/create-context +++ b/test/create-internet-context @@ -18,19 +18,30 @@ for path, properties in modems: 'org.ofono.ConnectionManager') contexts = connman.GetContexts() + path = ""; - if (len(contexts) == 0): + for i, properties in contexts: + if properties["Type"] == "internet": + path = i + break + + if path == "": path = connman.AddContext("internet") + print "Created new context %s" % (path) else: - path = contexts[0][0] + print "Found context %s" % (path) context = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.ConnectionContext') - try: + if len(sys.argv) > 1: context.SetProperty("AccessPointName", sys.argv[1]) - except IndexError: - print "Usage: %s <apn_name>" % sys.argv[0] - exit(1) + print "Setting APN to %s" % (sys.argv[1]) + + if len(sys.argv) > 2: + context.SetProperty("Username", sys.argv[2]) + print "Setting username to %s" % (sys.argv[2]) - print "Setting APN of %s to %s" % (path, sys.argv[1]) + if len(sys.argv) > 3: + context.SetProperty("Password", sys.argv[3]) + print "Setting password to %s" % (sys.argv[3]) diff --git a/test/set-context b/test/create-mms-context index 3d15764a..861ca7cb 100755 --- a/test/set-context +++ b/test/create-mms-context @@ -18,24 +18,30 @@ for path, properties in modems: 'org.ofono.ConnectionManager') contexts = connman.GetContexts() + path = ""; - if len(contexts) < 1: - print "No context available" - exit(1) + for i, properties in contexts: + if properties["Type"] == "mms": + path = i + break + + if path == "": + path = connman.AddContext("mms") + print "Created new context %s" % (path) else: - path = contexts[0][0] + print "Found context %s" % (path) context = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.ConnectionContext') - try: + if len(sys.argv) > 1: context.SetProperty("AccessPointName", sys.argv[1]) - if len(sys.argv) > 2: - context.SetProperty("Username", sys.argv[2]) - if len(sys.argv) > 3: - context.SetProperty("Password", sys.argv[3]) - except IndexError: - print "Usage: %s <apn_name> [username] [password]" % sys.argv[0] - exit(1) - - print "Setting APN of %s to %s" % (path, sys.argv[1]) + print "Setting APN to %s" % (sys.argv[1]) + + if len(sys.argv) > 2: + context.SetProperty("Username", sys.argv[2]) + print "Setting username to %s" % (sys.argv[2]) + + if len(sys.argv) > 3: + context.SetProperty("Password", sys.argv[3]) + print "Setting password to %s" % (sys.argv[3]) |