[tracker/gnome-master-test] Tests: Restructured data and added metadata extraction test
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/gnome-master-test] Tests: Restructured data and added metadata extraction test
- Date: Thu, 18 Feb 2010 10:44:49 +0000 (UTC)
commit d5542cb63a05d54993086674ece42ba20c5fae92
Author: Martyn Russell <martyn lanedo com>
Date: Thu Feb 18 10:43:02 2010 +0000
Tests: Restructured data and added metadata extraction test
configure.ac | 5 +-
tests/functional-tests/Makefile.am | 7 +-
tests/functional-tests/configuration.py | 48 +-
.../{testdata => data}/Makefile.am | 1 -
.../{testdata => data}/Music/Makefile.am | 2 +-
.../data/Music/tracker-mp3-test.mp3 | Bin 0 -> 61547 bytes
tests/functional-tests/data/pickled_Music | Bin 0 -> 877 bytes
tests/functional-tests/metadata_extraction_tc.py | 616 +
tests/functional-tests/metadata_tc.py | 137 -
tests/functional-tests/testdata/Images/flower.gif | Bin 956 -> 0 bytes
tests/functional-tests/testdata/Music/row_row.mp3 | Bin 1012174 -> 0 bytes
tests/functional-tests/testdata/pickled_Images | Bin 423 -> 0 bytes
tests/functional-tests/testdata/pickled_Music | Bin 548 -> 0 bytes
tests/functional-tests/testdata/ttl/Makefile.am | 11 -
tests/functional-tests/testdata/ttl/bookmarks.ttl | 93 -
tests/functional-tests/testdata/ttl/contacts.ttl |74329 --------------------
.../functional-tests/testdata/ttl/load_turtle.ttl | 609 -
.../functional-tests/testdata/ttl/planet-gnome.ttl | 470 -
.../functional-tests/testdata/ttl/planet-maemo.ttl | 177 -
tests/functional-tests/testdata/ttl/songlist.ttl |60207 ----------------
.../functional-tests/testdata/ttl/songlist_nmm.ttl | 350 -
tests/functional-tests/testdata/ttl/webhistory.ttl | 6011 --
tests/functional-tests/tests.xml | 176 +-
tests/tracker-writeback/Makefile.am | 1 -
24 files changed, 775 insertions(+), 142475 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 4bafb57..c18254d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1674,9 +1674,8 @@ AC_CONFIG_FILES([
tests/libtracker-db/Makefile
tests/libtracker-fts/Makefile
tests/functional-tests/Makefile
- tests/functional-tests/testdata/Makefile
- tests/functional-tests/testdata/ttl/Makefile
- tests/functional-tests/testdata/Music/Makefile
+ tests/functional-tests/data/Makefile
+ tests/functional-tests/data/Music/Makefile
tests/Makefile
tests/tracker-miner-fs/Makefile
tests/tracker-extract/Makefile
diff --git a/tests/functional-tests/Makefile.am b/tests/functional-tests/Makefile.am
index f65823f..e4050db 100644
--- a/tests/functional-tests/Makefile.am
+++ b/tests/functional-tests/Makefile.am
@@ -1,6 +1,6 @@
include $(top_srcdir)/Makefile.decl
-SUBDIRS = testdata
+SUBDIRS = data
if DIST_FUNCTIONAL_TESTS
configdir = $(datadir)/tracker-tests
@@ -11,8 +11,9 @@ config_DATA = \
02-metacontacts.py \
03-fts-functions.py \
configuration.py \
- metadata_tc.py
-
+ metadata_extraction_tc.py \
+ 04-group-concat.py \
+ 05-coalesce.py
EXTRA_DIST = $(config_DATA)
endif
diff --git a/tests/functional-tests/configuration.py b/tests/functional-tests/configuration.py
index 16c1ac2..6b3fb04 100644
--- a/tests/functional-tests/configuration.py
+++ b/tests/functional-tests/configuration.py
@@ -6,33 +6,33 @@
import os, sys
-testDataDir_pre = '/usr/share/tracker-func-ci-tests/testdata/'
-testDataDir = '/home/user/MyDocs/.sounds/'
+testDataDir_pre = '$prefix/share/tracker-func-ci-tests/testdata/'
+testDataDir = '$HOME/MyDocs/.sounds/'
def dir_path():
- return testDataDir
-
-
-def check_target():
- on_target = 'OSSO_PRODUCT_NAME'
- try :
- if os.environ[on_target]:
- #if os.environ['DBUS_SESSION_BUS_ADDRESS'] == 'unix:path=/tmp/session_bus_socket':
- awk_print = '1'
- return awk_print
- except KeyError:
- awk_print = '2'
- return awk_print
+ return testDataDir
'''
-sboxindicator='/targets/links/scratchbox.config'
-try :
- if os.path.islink(sboxindicator) and os.path.isfile(os.readlink(sboxindicator)) :
- awk_print = '3'
- else:
+def check_target():
+ on_target = 'OSSO_PRODUCT_NAME'
+ try :
+ if os.environ[on_target]:
+ #if os.environ['DBUS_SESSION_BUS_ADDRESS'] == 'unix:path=/tmp/session_bus_socket':
+ awk_print = '1'
+ return awk_print
+ except KeyError:
awk_print = '2'
-
-except OSError:
- awk_print = '2'
+ return awk_print
'''
-
+
+def check_target():
+ sboxindicator='/targets/links/scratchbox.config'
+ try :
+ if os.path.islink(sboxindicator) and os.path.isfile(os.readlink(sboxindicator)) :
+ awk_print = '3'
+ else:
+ awk_print = '2'
+ return awk_print
+
+ except OSError:
+ awk_print = '2'
diff --git a/tests/functional-tests/testdata/Makefile.am b/tests/functional-tests/data/Makefile.am
similarity index 96%
rename from tests/functional-tests/testdata/Makefile.am
rename to tests/functional-tests/data/Makefile.am
index a1a2cee..968b094 100644
--- a/tests/functional-tests/testdata/Makefile.am
+++ b/tests/functional-tests/data/Makefile.am
@@ -1,7 +1,6 @@
include $(top_srcdir)/Makefile.decl
SUBDIRS = \
- ttl \
Music
if DIST_FUNCTIONAL_TESTS
diff --git a/tests/functional-tests/testdata/Music/Makefile.am b/tests/functional-tests/data/Music/Makefile.am
similarity index 88%
rename from tests/functional-tests/testdata/Music/Makefile.am
rename to tests/functional-tests/data/Music/Makefile.am
index 4dffd08..cb869e6 100644
--- a/tests/functional-tests/testdata/Music/Makefile.am
+++ b/tests/functional-tests/data/Music/Makefile.am
@@ -4,7 +4,7 @@ if DIST_FUNCTIONAL_TESTS
configdir = $(datadir)/tracker-tests/data/Music
config_DATA = \
- row_row.mp3
+ tracker-mp3-test.mp3
EXTRA_DIST = $(config_DATA)
endif
diff --git a/tests/functional-tests/data/Music/tracker-mp3-test.mp3 b/tests/functional-tests/data/Music/tracker-mp3-test.mp3
new file mode 100644
index 0000000..bbd4c76
Binary files /dev/null and b/tests/functional-tests/data/Music/tracker-mp3-test.mp3 differ
diff --git a/tests/functional-tests/data/pickled_Music b/tests/functional-tests/data/pickled_Music
new file mode 100644
index 0000000..1913fc4
Binary files /dev/null and b/tests/functional-tests/data/pickled_Music differ
diff --git a/tests/functional-tests/metadata_extraction_tc.py b/tests/functional-tests/metadata_extraction_tc.py
new file mode 100755
index 0000000..5e7e177
--- /dev/null
+++ b/tests/functional-tests/metadata_extraction_tc.py
@@ -0,0 +1,616 @@
+#!/usr/bin/env python2.5
+
+# Copyright (C) 2008, Nokia (urho konttori nokia com)
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+#
+
+
+import sys,os,dbus,commands, signal, re
+import unittest
+import pickle
+import configuration
+
+""" get target environment """
+target = configuration.check_target()
+print target
+
+TRACKER = 'org.freedesktop.Tracker1'
+TRACKER_OBJ = '/org/freedesktop/Tracker1/Resources'
+RESOURCES_IFACE = "org.freedesktop.Tracker1.Resources"
+
+if target == '2':
+ """target is device """
+ MUSIC_FILE_PATH = "file:///home/user/MyDocs/.sounds/"
+else:
+ """target is SBOX """
+ MUSIC_FILE_PATH = "file:///usr/share/tracker-tests/data/Music/"
+
+class TrackerHelpers(unittest.TestCase):
+ def setUp(self):
+ bus = dbus.SessionBus()
+ tracker = bus.get_object(TRACKER, TRACKER_OBJ)
+ self.resources = dbus.Interface (tracker,
+ dbus_interface=RESOURCES_IFACE)
+
+
+ def de_pickle(self,pckl_file):
+ pckl_file = '/usr/share/tracker-tests/data/'+pckl_file
+ pickf=open(pckl_file, 'rb')
+ dictList=pickle.load(pickf)
+ pickf.close()
+ print dictList
+ return dictList
+
+ def sparql_update(self,query):
+ return self.resources.SparqlUpdate(query)
+
+ def query(self,query):
+ return self.resources.SparqlQuery(query)
+
+class mydict:
+ def __init__ (self):
+ self.nested_dict = { }
+ def append (self, key, value):
+ if not self.nested_dict.has_key (key):
+ self.nested_dict[key] = { }
+ self.nested_dict[key][value] = 1
+ def __getitem__ (self, key):
+ return self.nested_dict[key].keys ()
+
+
+#class images(TrackerHelpers):
+
+ #def test_get_images_height_1(self):
+ #dictList = self.de_pickle('pickled_Images')
+ #print dictList
+ #item = 'Image Height'
+ #flag = False
+ #for adict in dictList:
+ # # adict is a file
+ # testFile = adict['FILENAME']
+ # file_uri = "file://" + testFile
+ # #file_uri = MUSIC_FILE_PATH + testFile
+ # print 'testfile is %s' %file_uri
+ # for parm, expRes in adict.iteritems():
+ # # iterate thro the dictaionary, file's fields
+ ## if re.compile('^'+item+'$',re.M).search(parm):
+ # print 'parm val is %s' %parm
+ # query = "SELECT ?height WHERE { \
+ # <%s> a nfo:FileDataObject; \
+ # nfo:height ?height.}" %(file_uri)
+ # print query
+ # results = self.query (query)
+ # print results
+ ##
+ # print 'height of image retrieved is %d' (results[0][0])
+ # print 'value in dic %s' %(expRes.strip())
+ # if not expRes.strip() == height:
+ # flag = False
+ # print 'Failed to get correct height of image %s' %testFile
+ # else:
+ # flag = True
+
+ #self.assert_(flag, "Get metadata for Images failed." )
+
+class music(TrackerHelpers):
+
+ def test_get_music_title_1(self):
+ """
+ get the title of the music files
+ and verify them with that present in the earlier created dictionary
+ """
+ dictList = self.de_pickle('pickled_Music')
+ print dictList
+ overallRes = []
+ for adict in dictList:
+ """adict is a file"""
+ Results = {}
+ testFile = adict['FILENAME']
+ print 'testfile is %s' %testFile
+ file_uri = MUSIC_FILE_PATH + testFile
+ """browse the file's metadata list in dictionary for title """
+ for parm, expRes in adict.iteritems():
+ print parm
+ if parm.rstrip() == 'Title':
+ query = "SELECT ?title WHERE { \
+ <%s> a nfo:FileDataObject. \
+ <%s> nie:title ?title.}" %(file_uri,file_uri)
+ print query
+ results = self.query (query)
+ print results
+ print 'Actual = ' + results[0][0]
+ print 'Expected = ' + expRes.strip()
+ if not expRes.strip() == results[0][0]:
+ Results[testFile]=parm
+ flag = False
+ print 'Failed to get correct title for file %s' %testFile
+ else:
+ flag = True
+ overallRes.append(Results)
+ for Result_dict in overallRes:
+ for k in Result_dict:
+ self.assert_(not k,'Get Metadata failed for following Music files %s\n\n' % (str(overallRes)) )
+
+
+ def test_get_music_genre_1(self):
+
+ """
+ get the genre of the music files
+ and verify them with that present in the earlier created dictionary
+ """
+
+ dictList = self.de_pickle('pickled_Music')
+ print dictList
+ overallRes = []
+ for adict in dictList:
+ """adict is a file"""
+ Results = {}
+ testFile = adict['FILENAME']
+ file_uri = MUSIC_FILE_PATH + testFile
+ print 'testfile is %s' %testFile
+
+ """browse the file's metadata list in dictionary for genre """
+ for parm, expRes in adict.iteritems():
+ print parm
+ if parm.rstrip() == 'Genre':
+ print parm
+ query = "SELECT ?genre WHERE { \
+ <%s> a nfo:FileDataObject. \
+ <%s> nfo:genre ?genre.}" %(file_uri,file_uri)
+ print query
+ results = self.query (query)
+ print results
+ print 'Actual = ' + results[0][0]
+ print 'Expected = ' + expRes.strip()
+ if not expRes.strip() == results[0][0]:
+ Results[testFile]=parm
+ flag = False
+ print 'Failed to get correct genre for file %s' %testFile
+ else:
+ flag = True
+ overallRes.append(Results)
+ for Result_dict in overallRes:
+ for k in Result_dict:
+ self.assert_(not k,'Get Metadata failed for following Music files %s\n\n' % (str(overallRes)) )
+
+
+ def test_get_music_composer_1(self):
+
+ """
+ get the copmpser of the music files
+ and verify them with that present in the earlier created dictionary
+ """
+
+ dictList = self.de_pickle('pickled_Music')
+ print dictList
+ overallRes = []
+ for adict in dictList:
+ """adict is a file"""
+ Results = {}
+ testFile = adict['FILENAME']
+ file_uri = MUSIC_FILE_PATH + testFile
+ print 'testfile is %s' %testFile
+
+ """browse the file's metadata list in dictionary for creator """
+ for parm, expRes in adict.iteritems():
+ print parm
+ if parm.rstrip() == 'Composer':
+ print parm
+ query = "SELECT ?composer WHERE { \
+ <%s> a nfo:FileDataObject. \
+ <%s> nmm:composer ?composer.}" %(file_uri,file_uri)
+ print query
+ results = self.query (query)
+ print results
+ value = results[0][0].split('urn:artist:')
+ print 'Actual = ' + value[1]
+ print 'Expected = ' + expRes.strip()
+ if not expRes.strip() == value[1]:
+ Results[testFile]=parm
+ flag = False
+ print 'Failed to get correct composer for file %s' %testFile
+ else:
+ flag = True
+ overallRes.append(Results)
+ for Result_dict in overallRes:
+ for k in Result_dict:
+ self.assert_(not k,'Get Metadata failed for following Music files %s\n\n' % (str(overallRes)) )
+
+
+ def test_get_music_performer_1(self):
+
+ """
+ get the performer of the music files
+ and verify them with that present in the earlier created dictionary
+ """
+
+ dictList = self.de_pickle('pickled_Music')
+ print dictList
+ overallRes = []
+ for adict in dictList:
+ """adict is a file"""
+ Results = {}
+ testFile = adict['FILENAME']
+ file_uri = MUSIC_FILE_PATH + testFile
+ print 'testfile is %s' %testFile
+
+ """browse the file's metadata list in dictionary for performer """
+ for parm, expRes in adict.iteritems():
+ print parm
+ if parm.rstrip() == 'Artist':
+ print parm
+ query = "SELECT ?artist WHERE { \
+ <%s> a nfo:FileDataObject. \
+ <%s> nmm:performer ?artist.}" %(file_uri,file_uri)
+ print query
+ results = self.query (query)
+ print results
+ value = results[0][0].split('urn:artist:')
+ print 'Actual = ' + value[1]
+ print 'Expected = ' + expRes.strip()
+ if not expRes.strip() == value[1]:
+ Results[testFile]=parm
+ flag = False
+ print 'Failed to get correct performer for file %s' %testFile
+ else:
+ flag = True
+ overallRes.append(Results)
+ for Result_dict in overallRes:
+ for k in Result_dict:
+ self.assert_(not k,'Get Metadata failed for following Music files %s\n\n' % (str(overallRes)) )
+
+
+ def test_get_music_album_1(self):
+
+ """
+ get the music album of the music files
+ and verify them with that present in the earlier created dictionary
+ """
+
+ dictList = self.de_pickle('pickled_Music')
+ print dictList
+ overallRes = []
+ for adict in dictList:
+ """adict is a file"""
+ Results = {}
+ testFile = adict['FILENAME']
+ file_uri = MUSIC_FILE_PATH + testFile
+ print 'testfile is %s' %testFile
+
+ """browse the file's metadata list in dictionary for music album """
+ for parm, expRes in adict.iteritems():
+ print parm
+ if parm.rstrip() == 'Album':
+ print parm
+ query = "SELECT ?album WHERE { \
+ <%s> a nfo:FileDataObject. \
+ <%s> nmm:musicAlbum ?album.}" %(file_uri,file_uri)
+ print query
+ results = self.query (query)
+ print results
+ value = results[0][0].split('urn:album:')
+ print 'Actual = ' + value[1]
+ print 'Expected = ' + expRes.strip()
+ if not expRes.strip() == value[1]:
+ Results[testFile]=parm
+ flag = False
+ print 'Failed to get correct album for file %s' %testFile
+ else:
+ flag = True
+ overallRes.append(Results)
+ for Result_dict in overallRes:
+ for k in Result_dict:
+ self.assert_(not k,'Get Metadata failed for following Music files %s\n\n' % (str(overallRes)) )
+
+
+ def test_get_music_copyright_1(self):
+
+ """
+ get the copyright of the music files
+ and verify them with that present in the earlier created dictionary
+ """
+
+ dictList = self.de_pickle('pickled_Music')
+ print dictList
+ overallRes = []
+ for adict in dictList:
+ """adict is a file"""
+ Results = {}
+ testFile = adict['FILENAME']
+ file_uri = MUSIC_FILE_PATH + testFile
+ print 'testfile is %s' %testFile
+
+ """browse the file's metadata list in dictionary for copyright """
+ for parm, expRes in adict.iteritems():
+ print parm
+ if parm.rstrip() == 'Copyright':
+ print parm
+ query = "SELECT ?copyright WHERE { \
+ <%s> a nfo:FileDataObject. \
+ <%s> nie:copyright ?copyright.}" %(file_uri,file_uri)
+ print query
+ results = self.query (query)
+ print results
+ print 'Actual = ' + results[0][0]
+ print 'Expected = ' + expRes.strip()
+ if not expRes.strip() == results[0][0]:
+ Results[testFile]=parm
+ flag = False
+ print 'Failed to get correct copyright for file %s' %testFile
+ else:
+ flag = True
+ overallRes.append(Results)
+ for Result_dict in overallRes:
+ for k in Result_dict:
+ self.assert_(not k,'Get Metadata failed for following Music files %s\n\n' % (str(overallRes)) )
+
+
+ def test_get_music_track_1(self):
+
+ """
+ get the track number of the music files
+ and verify them with that present in the earlier created dictionary
+ """
+
+ dictList = self.de_pickle('pickled_Music')
+ print dictList
+ overallRes = []
+ for adict in dictList:
+ """adict is a file"""
+ Results = {}
+ testFile = adict['FILENAME']
+ file_uri = MUSIC_FILE_PATH + testFile
+ print 'testfile is %s' %testFile
+
+ """browse the file's metadata list in dictionary for track number """
+ for parm, expRes in adict.iteritems():
+ print parm
+ if parm.rstrip() == 'Track':
+ print parm
+ query = "SELECT ?track WHERE { \
+ <%s> a nfo:FileDataObject. \
+ <%s> nmm:trackNumber ?track.}" %(file_uri,file_uri)
+ print query
+ results = self.query (query)
+ print results
+ print 'Actual = ' + results[0][0]
+ print 'Expected = ' + expRes.strip()
+ if not expRes.strip() == results[0][0]:
+ Results[testFile]=parm
+ flag = False
+ print 'Failed to get correct track number for file %s' %testFile
+ else:
+ flag = True
+ overallRes.append(Results)
+ for Result_dict in overallRes:
+ for k in Result_dict:
+ self.assert_(not k,'Get Metadata failed for following Music files %s\n\n' % (str(overallRes)) )
+
+
+ def ztest_get_music_date_1(self):
+
+ """
+ get the creation date of the music files
+ and verify them with that present in the earlier created dictionary
+ """
+
+ dictList = self.de_pickle('pickled_Music')
+ print dictList
+ overallRes = []
+ for adict in dictList:
+ """adict is a file"""
+ Results = {}
+ testFile = adict['FILENAME']
+ file_uri = MUSIC_FILE_PATH + testFile
+ print 'testfile is %s' %testFile
+
+ """browse the file's metadata list in dictionary for creation date """
+ for parm, expRes in adict.iteritems():
+ print parm
+ if parm.rstrip() == 'File Modification Date/Time':
+ print parm
+ query = "SELECT ?date WHERE { \
+ <%s> a nfo:FileDataObject. \
+ <%s> nie:contentCreated ?date.}" %(file_uri,file_uri)
+ print query
+ results = self.query (query)
+ print results
+ print 'Actual = ' + results[0][0]
+ print 'Expected = ' + expRes.strip()
+ if not expRes.strip() == results[0][0]:
+ Results[testFile]=parm
+ flag = False
+ print 'Failed to get correct creation date for file %s' %testFile
+ else:
+ flag = True
+ overallRes.append(Results)
+ for Result_dict in overallRes:
+ for k in Result_dict:
+ self.assert_(not k,'Get Metadata failed for following Music files %s\n\n' % (str(overallRes)) )
+
+
+ def test_get_music_mime_1(self):
+
+ """
+ get the mime type of the music files
+ and verify them with that present in the earlier created dictionary
+ """
+
+ dictList = self.de_pickle('pickled_Music')
+ print dictList
+ overallRes = []
+ for adict in dictList:
+ """adict is a file"""
+ Results = {}
+ testFile = adict['FILENAME']
+ file_uri = MUSIC_FILE_PATH + testFile
+ print 'testfile is %s' %testFile
+
+ """browse the file's metadata list in dictionary for mime type """
+ for parm, expRes in adict.iteritems():
+ print parm
+ if parm.rstrip() == 'MIME Type':
+ print parm
+ query = "SELECT ?mime WHERE { \
+ <%s> a nfo:FileDataObject. \
+ <%s> nie:mimeType ?mime.}" %(file_uri,file_uri)
+ print query
+ results = self.query (query)
+ print results
+ print 'Actual = ' + results[0][0]
+ print 'Expected = ' + expRes.strip()
+ if not expRes.strip() == results[0][0]:
+ Results[testFile]=parm
+ flag = False
+ print 'Failed to get correct mime type for file %s' %testFile
+ else:
+ flag = True
+ overallRes.append(Results)
+ for Result_dict in overallRes:
+ for k in Result_dict:
+ self.assert_(not k,'Get Metadata failed for following Music files %s\n\n' % (str(overallRes)) )
+
+
+ def test_get_music_contributor_1(self):
+
+ """
+ get the contributor of the music files
+ and verify them with that present in the earlier created dictionary
+ """
+
+ dictList = self.de_pickle('pickled_Music')
+ print dictList
+ overallRes = []
+ for adict in dictList:
+ """adict is a file"""
+ Results = {}
+ testFile = adict['FILENAME']
+ file_uri = MUSIC_FILE_PATH + testFile
+ print 'testfile is %s' %testFile
+
+ """browse the file's metadata list in dictionary for contributor """
+ for parm, expRes in adict.iteritems():
+ print parm
+ if parm.rstrip() == 'contributor':
+ print parm
+ query = "SELECT ?contributor WHERE { \
+ <%s> a nfo:FileDataObject. \
+ <%s> nco:contributor ?contributor.}" %(file_uri,file_uri)
+ print query
+ results = self.query (query)
+ print results
+ value = results[0][0].split('urn:artist:')
+ print 'Actual = ' + value[1]
+ print 'Expected = ' + expRes.strip()
+ if not expRes.strip() == value[1]:
+ Results[testFile]=parm
+ flag = False
+ print 'Failed to get correct contributor for file %s' %testFile
+ else:
+ flag = True
+ overallRes.append(Results)
+ for Result_dict in overallRes:
+ for k in Result_dict:
+ self.assert_(not k,'Get Metadata failed for following Music files %s\n\n' % (str(overallRes)) )
+
+
+ def test_get_music_duration_1(self):
+
+ """
+ get the duration of the music files
+ and verify them with that present in the earlier created dictionary
+ """
+
+ dictList = self.de_pickle('pickled_Music')
+ print dictList
+ overallRes = []
+ for adict in dictList:
+ """adict is a file"""
+ Results = {}
+ testFile = adict['FILENAME']
+ file_uri = MUSIC_FILE_PATH + testFile
+ print 'testfile is %s' %testFile
+
+ """browse the file's metadata list in dictionary for duration """
+ for parm, expRes in adict.iteritems():
+ print parm
+ if parm.rstrip() == 'Duration':
+ print parm
+ query = "SELECT ?duration WHERE { \
+ <%s> a nfo:FileDataObject. \
+ <%s> nmm:length ?duration.}" %(file_uri,file_uri)
+ print query
+ results = self.query (query)
+ print results
+ exp_value = (expRes.strip()).split('.')
+ print 'Actual = ' + results[0][0]
+ print 'Expected = ' + exp_value[0]
+ if not exp_value[0] == results[0][0]:
+ Results[testFile]=parm
+ flag = False
+ print 'Failed to get correct duration for file %s' %testFile
+ else:
+ flag = True
+ overallRes.append(Results)
+ for Result_dict in overallRes:
+ for k in Result_dict:
+ self.assert_(not k,'Get Metadata failed for following Music files %s\n\n' % (str(overallRes)) )
+
+
+ def test_get_music_comment_1(self):
+
+ """
+ get the comment of the music files
+ and verify them with that present in the earlier created dictionary
+ """
+
+ dictList = self.de_pickle('pickled_Music')
+ print dictList
+ overallRes = []
+ for adict in dictList:
+ """adict is a file"""
+ Results = {}
+ testFile = adict['FILENAME']
+ file_uri = MUSIC_FILE_PATH + testFile
+ print 'testfile is %s' %testFile
+
+ """browse the file's metadata list in dictionary for comment """
+ for parm, expRes in adict.iteritems():
+ print parm
+ if parm.rstrip() == 'Comment':
+ print parm
+ query = "SELECT ?comment WHERE { \
+ <%s> a nfo:FileDataObject. \
+ <%s> nie:comment ?comment.}" %(file_uri,file_uri)
+ print query
+ results = self.query (query)
+ print results
+ print 'Actual = ' + results[0][0]
+ print 'Expected = ' + expRes.strip()
+ if not expRes.strip() == results[0][0]:
+ Results[testFile]=parm
+ flag = False
+ print 'Failed to get correct comment for file %s' %testFile
+ else:
+ flag = True
+ overallRes.append(Results)
+ for Result_dict in overallRes:
+ for k in Result_dict:
+ self.assert_(not k,'Get Metadata failed for following Music files %s\n\n' % (str(overallRes)) )
+
+
+unittest.main()
diff --git a/tests/functional-tests/tests.xml b/tests/functional-tests/tests.xml
index 6cea3bf..8511990 100644
--- a/tests/functional-tests/tests.xml
+++ b/tests/functional-tests/tests.xml
@@ -1,56 +1,136 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
<testdefinition version="0.1">
- <suite name="tracker-tests" domain="tracker-store">
- <!-- At least one set per suite, name and description mandatory -->
- <set name="testset1" description="Basic sparql tests" feature="sparql-insert">
- <pre_steps>
- <!-- This doesn't seem to work -->
- <step>. /tmp/session_bus_address.user</step>
- </pre_steps>
-
- <!-- At least one case per set, name mandatory, description mandatory, other optional -->
- <case name="test_simple_insertion" type="Functional" level="Feature"
- description="Insert and check results" requirement="01" subfeature="">
- <!-- dbus env variables defined here. This works. -->
- <step expected_result="0">. /tmp/session_bus_address.user; python2.5 /usr/share/tracker-tests/01-insertion.py</step>
- </case>
-
- <case name="test_metacontact" type="Functional" level="Feature"
- description="Metacontacts in the ontology" requirement="01" subfeature="">
- <!-- dbus env variables defined here. This works. -->
- <step expected_result="0">. /tmp/session_bus_address.user; python2.5 /usr/share/tracker-tests/02-metacontacts.py</step>
- </case>
-
- <case name="test_fts" type="Functional" level="Feature"
- description="Exposed FTS functions in sparql" requirement="01" subfeature="">
- <!-- dbus env variables defined here. This works. -->
- <step expected_result="0">. /tmp/session_bus_address.user; python2.5 /usr/share/tracker-tests/03-fts-functions.py</step>
- </case>
-
- <case name="test_group_concat" type="Functional" level="Feature"
- description="Group concat function in sparql" requirement="01" subfeature="">
- <!-- dbus env variables defined here. This works. -->
- <step expected_result="0">. /tmp/session_bus_address.user; python2.5 /usr/share/tracker-tests/04-group-concat.py</step>
- </case>
-
- <case name="test_coalesce" type="Functional" level="Feature"
- description="coalesce function in sparql" requirement="01" subfeature="">
- <!-- dbus env variables defined here. This works. -->
- <step expected_result="0">. /tmp/session_bus_address.user; python2.5 /usr/share/tracker-tests/05-coalesce.py</step>
- </case>
-
- <case name="test_distance" type="Functional" level="Feature"
- description="Distance between location points in sparql" requirement="01" subfeature="">
- <!-- dbus env variables defined here. This works. -->
- <step expected_result="0">. /tmp/session_bus_address.user; python2.5 /usr/share/tracker-tests/06-distance.py</step>
- </case>
-
- <!-- Environments optional - tells where the tests are run -->
+ <suite name="tracker">
+ <description />
+ <set name="_usr_share_tracker-tests_03-fts-functions.py">
+ <description>tracker:03-fts-functions.py</description>
+ <case name="03-fts-functions.py-TestFTSFunctions.test_fts_offsets">
+ <description>tracker:03-fts-functions.py:TestFTSFunctions.test_fts_offsets</description>
+ <step>/usr/share/tracker-tests/03-fts-functions.py TestFTSFunctions.test_fts_offsets</step>
+ </case>
+ <case name="03-fts-functions.py-TestFTSFunctions.test_fts_rank">
+ <description>tracker:03-fts-functions.py:TestFTSFunctions.test_fts_rank</description>
+ <step>/usr/share/tracker-tests/03-fts-functions.py TestFTSFunctions.test_fts_rank</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_share_tracker-tests_01-insertion.py">
+ <description>tracker:01-insertion.py</description>
+ <case name="01-insertion.py-s_batch_update.test_batch_insert_01">
+ <description>tracker:01-insertion.py:s_batch_update.test_batch_insert_01</description>
+ <step>/usr/share/tracker-tests/01-insertion.py s_batch_update.test_batch_insert_01</step>
+ </case>
+ <case name="01-insertion.py-s_delete.test_delete_01">
+ <description>tracker:01-insertion.py:s_delete.test_delete_01</description>
+ <step>/usr/share/tracker-tests/01-insertion.py s_delete.test_delete_01</step>
+ </case>
+ <case name="01-insertion.py-s_delete.test_delete_02">
+ <description>tracker:01-insertion.py:s_delete.test_delete_02</description>
+ <step>/usr/share/tracker-tests/01-insertion.py s_delete.test_delete_02</step>
+ </case>
+ <case name="01-insertion.py-s_insert.test_insert_01">
+ <description>tracker:01-insertion.py:s_insert.test_insert_01</description>
+ <step>/usr/share/tracker-tests/01-insertion.py s_insert.test_insert_01</step>
+ </case>
+ <case name="01-insertion.py-s_insert.test_insert_02">
+ <description>tracker:01-insertion.py:s_insert.test_insert_02</description>
+ <step>/usr/share/tracker-tests/01-insertion.py s_insert.test_insert_02</step>
+ </case>
+ <case name="01-insertion.py-s_insert.test_insert_03">
+ <description>tracker:01-insertion.py:s_insert.test_insert_03</description>
+ <step>/usr/share/tracker-tests/01-insertion.py s_insert.test_insert_03</step>
+ </case>
+ <case name="01-insertion.py-s_insert.test_insert_04">
+ <description>tracker:01-insertion.py:s_insert.test_insert_04</description>
+ <step>/usr/share/tracker-tests/01-insertion.py s_insert.test_insert_04</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_share_tracker-tests_metadata_extraction_tc.py">
+ <description>tracker:metadata_extraction_tc.py</description>
+ <case name="metadata_extraction_tc.py-music.test_get_music_title_1">
+ <description>tracker:metadata_extraction_tc.py:music.test_get_music_title_1</description>
+ <step>/usr/share/tracker-tests/metadata_extraction_tc.py music.test_get_music_title_1</step>
+ </case>
+ <case name="metadata_extraction_tc.py-music.test_get_music_composer_1">
+ <description>tracker:metadata_extraction_tc.py:music.test_get_music_composer_1</description>
+ <step>/usr/share/tracker-tests/metadata_extraction_tc.py music.test_get_music_composer_1</step>
+ </case>
+ <case name="metadata_extraction_tc.py-music.test_get_music_genre_1">
+ <description>tracker:metadata_extraction_tc.py:music.test_get_music_genre_1</description>
+ <step>/usr/share/tracker-tests/metadata_extraction_tc.py music.test_get_music_genre_1</step>
+ </case>
+ <case name="metadata_extraction_tc.py-music.test_get_music_performer_1">
+ <description>tracker:metadata_extraction_tc.py:music.test_get_music_performer_1</description>
+ <step>/usr/share/tracker-tests/metadata_extraction_tc.py music.test_get_music_performer_1</step>
+ </case>
+ <case name="metadata_extraction_tc.py-music.test_get_music_album_1">
+ <description>tracker:metadata_extraction_tc.py:music.test_get_music_album_1</description>
+ <step>/usr/share/tracker-tests/metadata_extraction_tc.py music.test_get_music_album_1</step>
+ </case>
+ <case name="metadata_extraction_tc.py-music.test_get_music_copyright_1">
+ <description>tracker:metadata_extraction_tc.py:music.test_get_music_copyright_1</description>
+ <step>/usr/share/tracker-tests/metadata_extraction_tc.py music.test_get_music_copyright_1</step>
+ </case>
+ <case name="metadata_extraction_tc.py-music.test_get_music_track_1">
+ <description>tracker:metadata_extraction_tc.py:music.test_get_music_track_1</description>
+ <step>/usr/share/tracker-tests/metadata_extraction_tc.py music.test_get_music_track_1</step>
+ </case>
+ <case name="metadata_extraction_tc.py-music.test_get_music_mime_1">
+ <description>tracker:metadata_extraction_tc.py:music.test_get_music_mime_1</description>
+ <step>/usr/share/tracker-tests/metadata_extraction_tc.py music.test_get_music_mime_1</step>
+ </case>
+ <case name="metadata_extraction_tc.py-music.test_get_music_contributor_1">
+ <description>tracker:metadata_extraction_tc.py:music.test_get_music_contributor_1</description>
+ <step>/usr/share/tracker-tests/metadata_extraction_tc.py music.test_get_music_contributor_1</step>
+ </case>
+ <case name="metadata_extraction_tc.py-music.test_get_music_duration_1">
+ <description>tracker:metadata_extraction_tc.py:music.test_get_music_duration_1</description>
+ <step>/usr/share/tracker-tests/metadata_extraction_tc.py music.test_get_music_duration_1</step>
+ </case>
+ <case name="metadata_extraction_tc.py-music.test_get_music_comment_1">
+ <description>tracker:metadata_extraction_tc.py:music.test_get_music_comment_1</description>
+ <step>/usr/share/tracker-tests/metadata_extraction_tc.py music.test_get_music_comment_1</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_share_tracker-tests_04-group-concat.py">
+ <description>tracker:04-group-concat.py</description>
+ <case name="04-group-concat.py-TestGroupConcat.test_group_concat">
+ <description>tracker:04-group-concat.py:TestGroupConcat.test_group_concat</description>
+ <step>/usr/share/tracker-tests/04-group-concat.py TestGroupConcat.test_group_concat</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_share_tracker-tests_05-coalesce.py">
+ <description>tracker:05-coalesce.py</description>
+ <case name="05-coalesce.py-TestCoalesce.test_coalesce_first_fine">
+ <description>tracker:05-coalesce.py:TestCoalesce.test_coalesce_first_fine</description>
+ <step>/usr/share/tracker-tests/05-coalesce.py TestCoalesce.test_coalesce_first_fine</step>
+ </case>
+ <case name="05-coalesce.py-TestCoalesce.test_coalesce_second_fine">
+ <description>tracker:05-coalesce.py:TestCoalesce.test_coalesce_second_fine</description>
+ <step>/usr/share/tracker-tests/05-coalesce.py TestCoalesce.test_coalesce_second_fine</step>
+ </case>
+ <case name="05-coalesce.py-TestCoalesce.test_coalesce_none_fine_default">
+ <description>tracker:05-coalesce.py:TestCoalesce.test_coalesce_none_fine_default</description>
+ <step>/usr/share/tracker-tests/05-coalesce.py TestCoalesce.test_coalesce_none_fine_default</step>
+ </case>
<environments>
<scratchbox>true</scratchbox>
<hardware>true</hardware>
</environments>
-
</set>
</suite>
</testdefinition>
diff --git a/tests/tracker-writeback/Makefile.am b/tests/tracker-writeback/Makefile.am
index 6eae4f1..9b48a5f 100644
--- a/tests/tracker-writeback/Makefile.am
+++ b/tests/tracker-writeback/Makefile.am
@@ -4,7 +4,6 @@ if DIST_FUNCTIONAL_TESTS
configdir = $(datadir)/tracker-tests
config_DATA = \
- tests.xml \
01-writeback.py
EXTRA_DIST = $(config_DATA)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]