summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2013-11-10 17:40:21 +0100
committerSamuel Ortiz <sameo@linux.intel.com>2013-11-10 17:57:09 +0100
commit3174c325913f724408d7dfa457162ddec71b347c (patch)
treed840527ee7a32552d686e33cf7196715452131b1 /test
parent9160b8abb1157186ce496cfaf2dfdf7018e49c62 (diff)
downloadneard-3174c325913f724408d7dfa457162ddec71b347c.tar.gz
neard-3174c325913f724408d7dfa457162ddec71b347c.tar.bz2
neard-3174c325913f724408d7dfa457162ddec71b347c.zip
neardutils: Implement dump_all_records
This is useful for dumping all records from all tags, and avoids always having to specify a tag path on the test-tag command line.
Diffstat (limited to 'test')
-rw-r--r--test/neardutils.py13
-rwxr-xr-xtest/test-tag16
2 files changed, 20 insertions, 9 deletions
diff --git a/test/neardutils.py b/test/neardutils.py
index 64ef489..903e59e 100644
--- a/test/neardutils.py
+++ b/test/neardutils.py
@@ -81,3 +81,16 @@ def dump_record(record_path):
else:
val = str(properties[key])
print " %s = %s" % (key, val)
+
+def dump_all_records(path):
+ bus = dbus.SystemBus()
+ om = dbus.Interface(bus.get_object("org.neard", "/"),
+ "org.freedesktop.DBus.ObjectManager")
+ objects = om.GetManagedObjects()
+ for path, interfaces in objects.iteritems():
+ if "org.neard.Record" not in interfaces:
+ continue
+
+ if path.startswith(path):
+ print(" [ %s ]" % (path))
+ dump_record(path)
diff --git a/test/test-tag b/test/test-tag
index 6c28a70..5b0b1da 100755
--- a/test/test-tag
+++ b/test/test-tag
@@ -57,23 +57,21 @@ if (sys.argv[1] == "list"):
if (sys.argv[1] == "dump"):
if (len(sys.argv) < 3):
- usage()
- else:
- tag_path = sys.argv[2]
-
om = dbus.Interface(bus.get_object("org.neard", "/"),
"org.freedesktop.DBus.ObjectManager")
objects = om.GetManagedObjects()
for path, interfaces in objects.iteritems():
- if "org.neard.Record" not in interfaces:
+ if "org.neard.Tag" not in interfaces:
continue
- if path.startswith(tag_path):
- print(" [ %s ]" % (path))
- neardutils.dump_record(path)
+ print("[ %s ]" % (path))
+ neardutils.dump_all_records(path)
sys.exit(0)
+ else:
+ neardutils.dump_all_records(sys.argv[2])
+ sys.exit(0)
if (sys.argv[1] == "write"):
if (len(sys.argv) < 5):
@@ -122,4 +120,4 @@ if (sys.argv[1] == "write"):
usage()
else:
- usage() \ No newline at end of file
+ usage()