[tracker-miners/wip/carlosg/cue-guess: 5/6] tests: Check JSON-LD @type values in extractor tests
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/cue-guess: 5/6] tests: Check JSON-LD @type values in extractor tests
- Date: Sun, 14 Feb 2021 17:01:59 +0000 (UTC)
commit d3b878f419dcda312d75d9b0025b48fe98ba8653
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Feb 14 15:22:43 2021 +0100
tests: Check JSON-LD @type values in extractor tests
Test that all RDF types specified in the expected.json file are
there in the tracker-extract output. This already spotted some
typos in our expected JSON data, so fix these along the way.
tests/functional-tests/fixtures.py | 5 +++++
.../test-extraction-data/audio/flac-musicbrainz.expected.json | 2 +-
.../test-extraction-data/audio/mp3-id3v2.4-1.expected.json | 2 +-
.../test-extraction-data/audio/mp3-id3v2.4-2.expected.json | 2 +-
.../test-extraction-data/desktop/application.expected.json | 2 +-
.../images/gif-comment-extension-block.expected.json | 4 ++--
6 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/tests/functional-tests/fixtures.py b/tests/functional-tests/fixtures.py
index a118cd17c..4e3a66bd5 100644
--- a/tests/functional-tests/fixtures.py
+++ b/tests/functional-tests/fixtures.py
@@ -404,6 +404,11 @@ class TrackerExtractTestCase(ut.TestCase):
for prop in expected_keys:
self.assertDictHasKey(result, prop,
error_missing_prop % (prop, filename, spec_filename))
+ if isinstance(spec[prop], list):
+ for value in spec[prop]:
+ self.assertIn(value, result[prop])
+ else:
+ self.assertIn(spec[prop], result[prop])
TEST_FILE_JPEG = "writeback-test-1.jpeg"
diff --git a/tests/functional-tests/test-extraction-data/audio/flac-musicbrainz.expected.json
b/tests/functional-tests/test-extraction-data/audio/flac-musicbrainz.expected.json
index d568a2afc..2dc8fd1d7 100644
--- a/tests/functional-tests/test-extraction-data/audio/flac-musicbrainz.expected.json
+++ b/tests/functional-tests/test-extraction-data/audio/flac-musicbrainz.expected.json
@@ -82,7 +82,7 @@
"nie:isStoredAs": {
"nfo:hasHash": [
{
- "@type": "nfo:hasHash",
+ "@type": "nfo:FileHash",
"nfo:hashAlgorithm": "chromaprint",
"nfo:hashValue": "123453215"
}
diff --git a/tests/functional-tests/test-extraction-data/audio/mp3-id3v2.4-1.expected.json
b/tests/functional-tests/test-extraction-data/audio/mp3-id3v2.4-1.expected.json
index 1476ad627..8179e37cf 100644
--- a/tests/functional-tests/test-extraction-data/audio/mp3-id3v2.4-1.expected.json
+++ b/tests/functional-tests/test-extraction-data/audio/mp3-id3v2.4-1.expected.json
@@ -82,7 +82,7 @@
"nie:isStoredAs": [
{
"nfo:hasHash": {
- "@type": "nfo:hasHash",
+ "@type": "nfo:FileHash",
"nfo:hashAlgorithm": "chromaprint",
"nfo:hashValue": "111222"
}
diff --git a/tests/functional-tests/test-extraction-data/audio/mp3-id3v2.4-2.expected.json
b/tests/functional-tests/test-extraction-data/audio/mp3-id3v2.4-2.expected.json
index 541c86f32..4519abfee 100644
--- a/tests/functional-tests/test-extraction-data/audio/mp3-id3v2.4-2.expected.json
+++ b/tests/functional-tests/test-extraction-data/audio/mp3-id3v2.4-2.expected.json
@@ -79,7 +79,7 @@
"nie:isStoredAs": [
{
"nfo:hasHash": {
- "@type": "nfo:hasHash",
+ "@type": "nfo:FileHash",
"nfo:hashAlgorithm": "chromaprint",
"nfo:hashValue": "111222"
}
diff --git a/tests/functional-tests/test-extraction-data/desktop/application.expected.json
b/tests/functional-tests/test-extraction-data/desktop/application.expected.json
index 13bfafb41..4ff587fe5 100644
--- a/tests/functional-tests/test-extraction-data/desktop/application.expected.json
+++ b/tests/functional-tests/test-extraction-data/desktop/application.expected.json
@@ -11,7 +11,7 @@
"nfo:softwareIcon": {
"@id": "urn:theme-icon:foo",
"@type": [
- "nfo:Website"
+ "nfo:Image"
]
},
"nie:comment": "my awesome application",
diff --git a/tests/functional-tests/test-extraction-data/images/gif-comment-extension-block.expected.json
b/tests/functional-tests/test-extraction-data/images/gif-comment-extension-block.expected.json
index 885efdf1d..70caa2db9 100644
--- a/tests/functional-tests/test-extraction-data/images/gif-comment-extension-block.expected.json
+++ b/tests/functional-tests/test-extraction-data/images/gif-comment-extension-block.expected.json
@@ -6,11 +6,11 @@
},
"metadata": {
"@type": [
- "nfo:Image ",
+ "nfo:Image",
"nmm:Photo"
],
"nfo:width": "600",
"nfo:height": "450",
"nie:comment": "GIF image format only supports comments in 7-bit ASCII encoding!"
}
-}
\ No newline at end of file
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]