summaryrefslogtreecommitdiff
path: root/tests/functional-tests/501-writeback-details.py
diff options
context:
space:
mode:
authorSam Thursfield <sam@afuera.me.uk>2014-12-29 17:46:46 +0000
committerSam Thursfield <sam@afuera.me.uk>2014-12-29 17:50:51 +0000
commitd0366ae3955b63ea86a8179986a066912d52da20 (patch)
treed7020f61fee3ce0bb85b7cf4872cbedca048f457 /tests/functional-tests/501-writeback-details.py
parentbe82e043cb3c9f519d89ce4e45d6a0135bb6b1e2 (diff)
downloadtracker-sam/functional-tests-pep8.tar.gz
functional-tests: Reformat code to correspond to consistent stylesam/functional-tests-pep8
The standard coding style for Python is PEP-8. I used the 'autopep8' tool to reformat all the tests to conform to PEP-8 style. There should be no functional changes. PEP-8: https://www.python.org/dev/peps/pep-0008/ autopep8: https://pypi.python.org/pypi/autopep8
Diffstat (limited to 'tests/functional-tests/501-writeback-details.py')
-rwxr-xr-xtests/functional-tests/501-writeback-details.py63
1 files changed, 33 insertions, 30 deletions
diff --git a/tests/functional-tests/501-writeback-details.py b/tests/functional-tests/501-writeback-details.py
index c7adceb2f..6bc4d6d36 100755
--- a/tests/functional-tests/501-writeback-details.py
+++ b/tests/functional-tests/501-writeback-details.py
@@ -25,22 +25,23 @@ from common.utils.expectedFailure import expectedFailureBug
import os
import time
-REASONABLE_TIMEOUT = 5 # Seconds we wait for tracker-writeback to do the work
+REASONABLE_TIMEOUT = 5 # Seconds we wait for tracker-writeback to do the work
class WritebackKeepDateTest (CommonTrackerWritebackTest):
- def setUp (self):
+ def setUp(self):
self.tracker = self.system.store
self.extractor = self.system.extractor
- self.favorite = self.__prepare_favorite_tag ()
+ self.favorite = self.__prepare_favorite_tag()
- def __prepare_favorite_tag (self):
- # Check here if favorite has tag... to make sure writeback is actually writing
+ def __prepare_favorite_tag(self):
+ # Check here if favorite has tag... to make sure writeback is actually
+ # writing
results = self.tracker.query ("""
SELECT ?label WHERE { nao:predefined-tag-favorite nao:prefLabel ?label }""")
- if len (results) == 0:
+ if len(results) == 0:
self.tracker.update ("""
INSERT { nao:predefined-tag-favorite nao:prefLabel 'favorite'}
WHERE { nao:predefined-tag-favorite a nao:Tag }
@@ -48,9 +49,8 @@ class WritebackKeepDateTest (CommonTrackerWritebackTest):
return "favorite"
else:
return str(results[0][0])
-
- def test_01_NB217627_content_created_date (self):
+ def test_01_NB217627_content_created_date(self):
"""
NB#217627 - Order if results is different when an image is marked as favorite.
"""
@@ -60,13 +60,13 @@ class WritebackKeepDateTest (CommonTrackerWritebackTest):
nfo:fileLastModified ?contentCreated
} ORDER BY ?contentCreated
"""
- results = self.tracker.query (query_images)
- self.assertEquals (len (results), 3, results)
+ results = self.tracker.query(query_images)
+ self.assertEquals(len(results), 3, results)
- log ("Waiting 2 seconds to ensure there is a noticiable difference in the timestamp")
- time.sleep (2)
+ log("Waiting 2 seconds to ensure there is a noticiable difference in the timestamp")
+ time.sleep(2)
- url = self.get_test_filename_jpeg ()
+ url = self.get_test_filename_jpeg()
filename = url[len('file://'):]
initial_mtime = os.stat(filename).st_mtime
@@ -79,29 +79,32 @@ class WritebackKeepDateTest (CommonTrackerWritebackTest):
?u nie:url <%s> .
}
""" % url
- self.tracker.update (mark_as_favorite)
- log ("Setting favorite in <%s>" % url)
+ self.tracker.update(mark_as_favorite)
+ log("Setting favorite in <%s>" % url)
- self.wait_for_file_change (filename, initial_mtime)
+ self.wait_for_file_change(filename, initial_mtime)
# Check the value is written in the file
- metadata = get_tracker_extract_output (filename, "")
- self.assertIn (self.favorite, metadata ["nao:hasTag"],
- "Tag hasn't been written in the file")
-
- # Now check the modification date of the files and it should be the same :)
- new_results = self.tracker.query (query_images)
- ## for (uri, date) in new_results:
- ## print "Checking dates of <%s>" % uri
+ metadata = get_tracker_extract_output(filename, "")
+ self.assertIn(self.favorite, metadata["nao:hasTag"],
+ "Tag hasn't been written in the file")
+
+ # Now check the modification date of the files and it should be the
+ # same :)
+ new_results = self.tracker.query(query_images)
+ # for (uri, date) in new_results:
+ # print "Checking dates of <%s>" % uri
## previous_date = convenience_dict[uri]
- ## print "Before: %s \nAfter : %s" % (previous_date, date)
+ # print "Before: %s \nAfter : %s" % (previous_date, date)
## self.assertEquals (date, previous_date, "File <%s> has change its contentCreated date!" % uri)
# Indeed the order of the results should be the same
- for i in range (0, len (results)):
- self.assertEquals (results[i][0], new_results[i][0], "Order of the files is different")
- self.assertEquals (results[i][1], new_results[i][1], "Date has change in file <%s>" % results[i][0])
-
+ for i in range(0, len(results)):
+ self.assertEquals(results[i][0], new_results[
+ i][0], "Order of the files is different")
+ self.assertEquals(results[i][1], new_results[i][
+ 1], "Date has change in file <%s>" % results[i][0])
+
if __name__ == "__main__":
- ut.main ()
+ ut.main()