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 similarity index 55% rename from test/create-context rename to 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 " % sys.argv[0] - exit(1) + print "Setting APN to %s" % (sys.argv[1]) - print "Setting APN of %s to %s" % (path, 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]) diff --git a/test/set-context b/test/create-mms-context similarity index 52% rename from test/set-context rename to 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 [username] [password]" % sys.argv[0] - exit(1) + print "Setting APN to %s" % (sys.argv[1]) - print "Setting APN of %s to %s" % (path, 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])