From c698a1c15899b7f1306f6cd701c99cda14f5c200 Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Wed, 20 Nov 2024 15:58:40 +0100 Subject: [PATCH] fix: e2e test --- .../001-list-ok/expected-response.json | 30 ++--------------- .../expected-response.json | 5 ++- .../expected-http-code | 0 .../expected-response.json | 32 +++---------------- .../request.json | 2 +- .../004-list-ok-wrong-id/expected-http-code | 2 +- .../expected-response.json | 13 ++++++-- .../repository/.keboola/repository.json | 18 +++++++++-- 8 files changed, 35 insertions(+), 67 deletions(-) rename test/templates/api/repositories/template-list-filter/{003-list-ok-components-only => 003-list-keboola-sheet-only}/expected-http-code (100%) rename test/templates/api/repositories/template-list-filter/{003-list-ok-components-only => 003-list-keboola-sheet-only}/expected-response.json (52%) rename test/templates/api/repositories/template-list-filter/{003-list-ok-components-only => 003-list-keboola-sheet-only}/request.json (65%) diff --git a/test/templates/api/repositories/template-list-filter/001-list-ok/expected-response.json b/test/templates/api/repositories/template-list-filter/001-list-ok/expected-response.json index 610793ae1f..064ad8f3cf 100644 --- a/test/templates/api/repositories/template-list-filter/001-list-ok/expected-response.json +++ b/test/templates/api/repositories/template-list-filter/001-list-ok/expected-response.json @@ -49,7 +49,6 @@ ], "components": [ "keboola.wr-%s", - "foo.bar", "keboola.data-apps" ], "versions": [ @@ -60,31 +59,6 @@ } ] }, - { - "id": "my-template-id-6", - "name": "My Template-snowflake-6", - "deprecated": false, - "author": { - "name": "Example Author", - "url": "https://example.com" - }, - "description": "Full workflow to ...", - "defaultVersion": "1.2.3", - "categories": [ - "Other" - ], - "components": [ - "keboola.wr-%s", - "foo.bar" - ], - "versions": [ - { - "version": "1.2.3", - "stable": false, - "description": "" - } - ] - }, { "id": "my-template-id-7", "name": "My Template-snowflake-7", @@ -100,8 +74,8 @@ ], "components": [ "keboola.wr-%s", - "foo.bar", - "keboola.data-apps" + "keboola.data-apps", + "keboola.wr-google-sheets" ], "versions": [ { diff --git a/test/templates/api/repositories/template-list-filter/002-list-ok-data-apps-only/expected-response.json b/test/templates/api/repositories/template-list-filter/002-list-ok-data-apps-only/expected-response.json index bcfbca7d16..0ebe3406bf 100644 --- a/test/templates/api/repositories/template-list-filter/002-list-ok-data-apps-only/expected-response.json +++ b/test/templates/api/repositories/template-list-filter/002-list-ok-data-apps-only/expected-response.json @@ -24,7 +24,6 @@ ], "components": [ "keboola.wr-%s", - "foo.bar", "keboola.data-apps" ], "versions": [ @@ -50,8 +49,8 @@ ], "components": [ "keboola.wr-%s", - "foo.bar", - "keboola.data-apps" + "keboola.data-apps", + "keboola.wr-google-sheets" ], "versions": [ { diff --git a/test/templates/api/repositories/template-list-filter/003-list-ok-components-only/expected-http-code b/test/templates/api/repositories/template-list-filter/003-list-keboola-sheet-only/expected-http-code similarity index 100% rename from test/templates/api/repositories/template-list-filter/003-list-ok-components-only/expected-http-code rename to test/templates/api/repositories/template-list-filter/003-list-keboola-sheet-only/expected-http-code diff --git a/test/templates/api/repositories/template-list-filter/003-list-ok-components-only/expected-response.json b/test/templates/api/repositories/template-list-filter/003-list-keboola-sheet-only/expected-response.json similarity index 52% rename from test/templates/api/repositories/template-list-filter/003-list-ok-components-only/expected-response.json rename to test/templates/api/repositories/template-list-filter/003-list-keboola-sheet-only/expected-response.json index d27b17d61c..81b6b351f0 100644 --- a/test/templates/api/repositories/template-list-filter/003-list-ok-components-only/expected-response.json +++ b/test/templates/api/repositories/template-list-filter/003-list-keboola-sheet-only/expected-response.json @@ -10,8 +10,8 @@ }, "templates": [ { - "id": "my-template-id-3", - "name": "My Template-snowflake-3", + "id": "my-template-id-7", + "name": "My Template-snowflake-7", "deprecated": false, "author": { "name": "Example Author", @@ -24,32 +24,8 @@ ], "components": [ "keboola.wr-%s", - "foo.bar" - ], - "versions": [ - { - "version": "1.2.3", - "stable": false, - "description": "" - } - ] - }, - { - "id": "my-template-id-6", - "name": "My Template-snowflake-6", - "deprecated": false, - "author": { - "name": "Example Author", - "url": "https://example.com" - }, - "description": "Full workflow to ...", - "defaultVersion": "1.2.3", - "categories": [ - "Other" - ], - "components": [ - "keboola.wr-%s", - "foo.bar" + "keboola.data-apps", + "keboola.wr-google-sheets" ], "versions": [ { diff --git a/test/templates/api/repositories/template-list-filter/003-list-ok-components-only/request.json b/test/templates/api/repositories/template-list-filter/003-list-keboola-sheet-only/request.json similarity index 65% rename from test/templates/api/repositories/template-list-filter/003-list-ok-components-only/request.json rename to test/templates/api/repositories/template-list-filter/003-list-keboola-sheet-only/request.json index 8090a62559..272c689bfc 100644 --- a/test/templates/api/repositories/template-list-filter/003-list-ok-components-only/request.json +++ b/test/templates/api/repositories/template-list-filter/003-list-keboola-sheet-only/request.json @@ -1,5 +1,5 @@ { - "path": "/v1/repositories/keboola/templates?filter=keboola.components", + "path": "/v1/repositories/keboola/templates?filter=keboola.wr-google-sheets", "method": "GET", "headers": { "Content-Type": "application/json", diff --git a/test/templates/api/repositories/template-list-filter/004-list-ok-wrong-id/expected-http-code b/test/templates/api/repositories/template-list-filter/004-list-ok-wrong-id/expected-http-code index d411bb7c1a..08839f6bb2 100644 --- a/test/templates/api/repositories/template-list-filter/004-list-ok-wrong-id/expected-http-code +++ b/test/templates/api/repositories/template-list-filter/004-list-ok-wrong-id/expected-http-code @@ -1 +1 @@ -400 +200 diff --git a/test/templates/api/repositories/template-list-filter/004-list-ok-wrong-id/expected-response.json b/test/templates/api/repositories/template-list-filter/004-list-ok-wrong-id/expected-response.json index 24cd685dfa..de19b90074 100644 --- a/test/templates/api/repositories/template-list-filter/004-list-ok-wrong-id/expected-response.json +++ b/test/templates/api/repositories/template-list-filter/004-list-ok-wrong-id/expected-response.json @@ -1,5 +1,12 @@ { - "statusCode": 400, - "error": "templates.invalidEnumValue", - "message": "Value of filter must be one of \"keboola.components\", \"keboola.data-apps\" but got value \"312312\"." + "repository": { + "name": "keboola", + "url": "%s/test/templates/api/repositories/template-list-filter/repository", + "ref": "", + "author": { + "name": "Example Author", + "url": "https://example.com" + } + }, + "templates": [] } diff --git a/test/templates/api/repositories/template-list-filter/repository/.keboola/repository.json b/test/templates/api/repositories/template-list-filter/repository/.keboola/repository.json index 8a4c7f4eb6..509e94f90c 100644 --- a/test/templates/api/repositories/template-list-filter/repository/.keboola/repository.json +++ b/test/templates/api/repositories/template-list-filter/repository/.keboola/repository.json @@ -103,6 +103,9 @@ "requirements": { "backends":[ "bigquery" + ], + "components": [ + "keboola.data-apps" ] }, "versions": [ @@ -127,6 +130,9 @@ "requirements": { "backends":[ "snowflake" + ], + "components": [ + "keboola.data-apps" ] }, "versions": [ @@ -137,7 +143,6 @@ "path": "v1", "components": [ "", - "foo.bar", "keboola.data-apps" ] } @@ -151,6 +156,9 @@ "requirements": { "backends":[ "snowflake" + ], + "components": [ + "" ] }, "versions": [ @@ -174,6 +182,10 @@ "requirements": { "backends":[ "snowflake" + ], + "components": [ + "keboola.data-apps", + "keboola.wr-google-sheets" ] }, "versions": [ @@ -184,8 +196,8 @@ "path": "v1", "components": [ "", - "foo.bar", - "keboola.data-apps" + "keboola.data-apps", + "keboola.wr-google-sheets" ] } ]