From 0787f7b5feb1aff929ba64b7f41c029f08e65677 Mon Sep 17 00:00:00 2001 From: Rolf Krahl Date: Fri, 11 Oct 2024 12:54:12 +0200 Subject: [PATCH] Fixup 8950735: old ICAT versions do not support selecting related object's attributes in JPQL queries --- tests/test_06_ingest.py | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/tests/test_06_ingest.py b/tests/test_06_ingest.py index 9001642..0e04d6a 100644 --- a/tests/test_06_ingest.py +++ b/tests/test_06_ingest.py @@ -113,7 +113,8 @@ class MyIngestReader(IngestReader): "testingest_inl_1": [ ("SELECT ds.complete FROM Dataset ds WHERE ds.id = %d", False), - ("SELECT ds.type.name FROM Dataset ds WHERE ds.id = %d", + (("SELECT t.name FROM DatasetType t JOIN t.datasets AS ds " + "WHERE ds.id = %d"), "raw"), ("SELECT ds.description FROM Dataset ds WHERE ds.id = %d", "Dy01Cp02 at 2.7 K"), @@ -133,7 +134,8 @@ class MyIngestReader(IngestReader): "testingest_inl_2": [ ("SELECT ds.complete FROM Dataset ds WHERE ds.id = %d", False), - ("SELECT ds.type.name FROM Dataset ds WHERE ds.id = %d", + (("SELECT t.name FROM DatasetType t JOIN t.datasets AS ds " + "WHERE ds.id = %d"), "raw"), ("SELECT ds.description FROM Dataset ds WHERE ds.id = %d", "Dy01Cp02 at 5.1 K"), @@ -160,7 +162,8 @@ class MyIngestReader(IngestReader): "testingest_inl5_1": [ ("SELECT ds.complete FROM Dataset ds WHERE ds.id = %d", False), - ("SELECT ds.type.name FROM Dataset ds WHERE ds.id = %d", + (("SELECT t.name FROM DatasetType t JOIN t.datasets AS ds " + "WHERE ds.id = %d"), "raw"), ("SELECT ds.description FROM Dataset ds WHERE ds.id = %d", "Dy01Cp02 at 2.7 K"), @@ -188,7 +191,8 @@ class MyIngestReader(IngestReader): "testingest_inl5_2": [ ("SELECT ds.complete FROM Dataset ds WHERE ds.id = %d", False), - ("SELECT ds.type.name FROM Dataset ds WHERE ds.id = %d", + (("SELECT t.name FROM DatasetType t JOIN t.datasets AS ds " + "WHERE ds.id = %d"), "raw"), ("SELECT ds.description FROM Dataset ds WHERE ds.id = %d", "Dy01Cp02 at 5.1 K"), @@ -226,7 +230,8 @@ class MyIngestReader(IngestReader): "testingest_sep_1": [ ("SELECT ds.complete FROM Dataset ds WHERE ds.id = %d", False), - ("SELECT ds.type.name FROM Dataset ds WHERE ds.id = %d", + (("SELECT t.name FROM DatasetType t JOIN t.datasets AS ds " + "WHERE ds.id = %d"), "raw"), ("SELECT ds.description FROM Dataset ds WHERE ds.id = %d", "Dy01Cp02 at 2.7 K"), @@ -246,7 +251,8 @@ class MyIngestReader(IngestReader): "testingest_sep_2": [ ("SELECT ds.complete FROM Dataset ds WHERE ds.id = %d", False), - ("SELECT ds.type.name FROM Dataset ds WHERE ds.id = %d", + (("SELECT t.name FROM DatasetType t JOIN t.datasets AS ds " + "WHERE ds.id = %d"), "raw"), ("SELECT ds.description FROM Dataset ds WHERE ds.id = %d", "Dy01Cp02 at 5.1 K"), @@ -273,7 +279,8 @@ class MyIngestReader(IngestReader): "testingest_sep5_1": [ ("SELECT ds.complete FROM Dataset ds WHERE ds.id = %d", False), - ("SELECT ds.type.name FROM Dataset ds WHERE ds.id = %d", + (("SELECT t.name FROM DatasetType t JOIN t.datasets AS ds " + "WHERE ds.id = %d"), "raw"), ("SELECT ds.description FROM Dataset ds WHERE ds.id = %d", "Dy01Cp02 at 2.7 K"), @@ -301,7 +308,8 @@ class MyIngestReader(IngestReader): "testingest_sep5_2": [ ("SELECT ds.complete FROM Dataset ds WHERE ds.id = %d", False), - ("SELECT ds.type.name FROM Dataset ds WHERE ds.id = %d", + (("SELECT t.name FROM DatasetType t JOIN t.datasets AS ds " + "WHERE ds.id = %d"), "raw"), ("SELECT ds.description FROM Dataset ds WHERE ds.id = %d", "Dy01Cp02 at 5.1 K"), @@ -340,7 +348,8 @@ class MyIngestReader(IngestReader): "testingest_sample_1": [ ("SELECT ds.complete FROM Dataset ds WHERE ds.id = %d", False), - ("SELECT ds.type.name FROM Dataset ds WHERE ds.id = %d", + (("SELECT t.name FROM DatasetType t JOIN t.datasets AS ds " + "WHERE ds.id = %d"), "raw"), ("SELECT ds.description FROM Dataset ds WHERE ds.id = %d", "ab3465 at 2.7 K"), @@ -358,7 +367,8 @@ class MyIngestReader(IngestReader): "testingest_sample_2": [ ("SELECT ds.complete FROM Dataset ds WHERE ds.id = %d", False), - ("SELECT ds.type.name FROM Dataset ds WHERE ds.id = %d", + (("SELECT t.name FROM DatasetType t JOIN t.datasets AS ds " + "WHERE ds.id = %d"), "raw"), ("SELECT ds.description FROM Dataset ds WHERE ds.id = %d", "ab3465 at 5.1 K"), @@ -376,7 +386,8 @@ class MyIngestReader(IngestReader): "testingest_sample_3": [ ("SELECT ds.complete FROM Dataset ds WHERE ds.id = %d", False), - ("SELECT ds.type.name FROM Dataset ds WHERE ds.id = %d", + (("SELECT t.name FROM DatasetType t JOIN t.datasets AS ds " + "WHERE ds.id = %d"), "raw"), ("SELECT ds.description FROM Dataset ds WHERE ds.id = %d", "ab3466 at 2.7 K"), @@ -394,7 +405,8 @@ class MyIngestReader(IngestReader): "testingest_sample_4": [ ("SELECT ds.complete FROM Dataset ds WHERE ds.id = %d", False), - ("SELECT ds.type.name FROM Dataset ds WHERE ds.id = %d", + (("SELECT t.name FROM DatasetType t JOIN t.datasets AS ds " + "WHERE ds.id = %d"), "raw"), ("SELECT ds.description FROM Dataset ds WHERE ds.id = %d", "reference"), @@ -723,7 +735,8 @@ def test_ingest_error_searcherr(client, investigation, schemadir, case): "testingest_classattr_1": [ ("SELECT ds.complete FROM Dataset ds WHERE ds.id = %d", True), - ("SELECT ds.type.name FROM Dataset ds WHERE ds.id = %d", + (("SELECT t.name FROM DatasetType t JOIN t.datasets AS ds " + "WHERE ds.id = %d"), "other"), ], },