[tracker/writeback] Made the tracker-writeback unit test actually test something
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/writeback] Made the tracker-writeback unit test actually test something
- Date: Wed, 16 Dec 2009 12:14:26 +0000 (UTC)
commit 2247c4db279cc04865b04e8f467d667ba60559ed
Author: Philip Van Hoof <philip codeminded be>
Date: Wed Dec 16 13:10:53 2009 +0100
Made the tracker-writeback unit test actually test something
tests/tracker-writeback/01-writeback.py | 36 ++++++++++++++++++++++++++++--
tests/tracker-writeback/data/test01.jpg | Bin 7976 -> 306 bytes
2 files changed, 33 insertions(+), 3 deletions(-)
---
diff --git a/tests/tracker-writeback/01-writeback.py b/tests/tracker-writeback/01-writeback.py
index 77f877a..1e553b3 100755
--- a/tests/tracker-writeback/01-writeback.py
+++ b/tests/tracker-writeback/01-writeback.py
@@ -23,6 +23,10 @@ import dbus
import unittest
import random
import os
+import shutil
+import re
+import time
+import commands
TRACKER = 'org.freedesktop.Tracker1'
TRACKER_OBJ = '/org/freedesktop/Tracker1/Resources'
@@ -37,8 +41,15 @@ class TestInsertion (unittest.TestCase):
dbus_interface=RESOURCES_IFACE);
def test_simple_insertion (self):
-
- uri = "file://" + os.getcwd() + "/data/test01.jpg"
+ try:
+ os.mkdir (os.getcwd() + "/tmp")
+ except:
+ print ""
+
+ shutil.copy2 (os.getcwd() + "/data/test01.jpg",
+ os.getcwd() + "/tmp/test01.jpg")
+
+ uri = "file://" + os.getcwd() + "/tmp/test01.jpg"
insert = """INSERT { <%s> a nfo:Image, nmm:Photo, nfo:FileDataObject;
nie:isStoredAs <%s> ;
@@ -62,9 +73,28 @@ class TestInsertion (unittest.TestCase):
}""" % (uri, uri, uri)
-
self.resources.SparqlUpdate (insert)
+ time.sleep (3)
+
+ ret = os.system ("exiftool " + os.getcwd() + "/tmp/test01.jpg | grep test_title_1")
+ self.assertEqual (ret, 0)
+
+ ret = os.system ("exiftool " + os.getcwd() + "/tmp/test01.jpg | grep test_fullname_1")
+ self.assertEqual (ret, 0)
+
+ ret = os.system ("exiftool " + os.getcwd() + "/tmp/test01.jpg | grep test_description_1")
+ self.assertEqual (ret, 0)
+
+ ret = os.system ("exiftool " + os.getcwd() + "/tmp/test01.jpg | grep test_keyword_1")
+ self.assertEqual (ret, 0)
+
+ ret = os.system ("exiftool " + os.getcwd() + "/tmp/test01.jpg | grep test_keyword_2")
+ self.assertEqual (ret, 0)
+
+ ret = os.system ("exiftool " + os.getcwd() + "/tmp/test01.jpg | grep test_keyword_3")
+ self.assertEqual (ret, 0)
+
if __name__ == '__main__':
unittest.main()
diff --git a/tests/tracker-writeback/data/test01.jpg b/tests/tracker-writeback/data/test01.jpg
index 89dc581..a62b7d4 100644
Binary files a/tests/tracker-writeback/data/test01.jpg and b/tests/tracker-writeback/data/test01.jpg differ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]