From 91b531fb992d4d24062781860a8359a538957191 Mon Sep 17 00:00:00 2001 From: Paul Vaneveld Date: Wed, 19 Jun 2024 13:56:19 +0200 Subject: [PATCH] test: add test case for `filter_content_type` * update api record * add test case --- internal/acctest.go | 5 +-- internal/assets/asset_folder.yaml | 36 +++++++++++----------- internal/assets/component.yaml | 44 +++++++++++++------------- internal/assets/component_group.yaml | 46 ++++++++++++++-------------- internal/assets/space_role.yaml | 44 +++++++++++++------------- internal/component_resource_test.go | 11 +++++++ 6 files changed, 99 insertions(+), 87 deletions(-) diff --git a/internal/acctest.go b/internal/acctest.go index 341dc87..9b3c729 100644 --- a/internal/acctest.go +++ b/internal/acctest.go @@ -1,11 +1,12 @@ package internal import ( + "os" + "testing" + "github.com/hashicorp/terraform-plugin-framework/providerserver" "github.com/hashicorp/terraform-plugin-go/tfprotov6" "gopkg.in/dnaeon/go-vcr.v3/recorder" - "os" - "testing" ) var ( diff --git a/internal/assets/asset_folder.yaml b/internal/assets/asset_folder.yaml index 7a559ec..4361fe4 100644 --- a/internal/assets/asset_folder.yaml +++ b/internal/assets/asset_folder.yaml @@ -25,13 +25,13 @@ interactions: trailer: {} content_length: 139 uncompressed: false - body: '{"asset_folder":{"id":304158,"name":"asset-folder-name","parent_id":null,"uuid":"fd4e5a06-b168-4789-910f-95e053229e87","parent_uuid":null}}' + body: '{"asset_folder":{"id":576397,"name":"asset-folder-name","parent_id":null,"uuid":"fa69a52f-3dd1-420b-8e2c-1b30bdef162c","parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 145.384494ms + duration: 103.60975ms - id: 1 request: proto: HTTP/1.1 @@ -46,7 +46,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/asset_folders/304158 + url: https://mapi.storyblok.com/v1/spaces/233252/asset_folders/576397 method: GET response: proto: HTTP/2.0 @@ -56,13 +56,13 @@ interactions: trailer: {} content_length: 139 uncompressed: false - body: '{"asset_folder":{"id":304158,"name":"asset-folder-name","parent_id":null,"uuid":"fd4e5a06-b168-4789-910f-95e053229e87","parent_uuid":null}}' + body: '{"asset_folder":{"id":576397,"name":"asset-folder-name","parent_id":null,"uuid":"fa69a52f-3dd1-420b-8e2c-1b30bdef162c","parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 58.71125ms + duration: 39.288459ms - id: 2 request: proto: HTTP/1.1 @@ -77,7 +77,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/asset_folders/304158 + url: https://mapi.storyblok.com/v1/spaces/233252/asset_folders/576397 method: GET response: proto: HTTP/2.0 @@ -87,13 +87,13 @@ interactions: trailer: {} content_length: 139 uncompressed: false - body: '{"asset_folder":{"id":304158,"name":"asset-folder-name","parent_id":null,"uuid":"fd4e5a06-b168-4789-910f-95e053229e87","parent_uuid":null}}' + body: '{"asset_folder":{"id":576397,"name":"asset-folder-name","parent_id":null,"uuid":"fa69a52f-3dd1-420b-8e2c-1b30bdef162c","parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 53.687495ms + duration: 262.893583ms - id: 3 request: proto: HTTP/1.1 @@ -108,7 +108,7 @@ interactions: body: '{"asset_folder":{"name":"new-asset-folder-name"}}' form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/asset_folders/304158 + url: https://mapi.storyblok.com/v1/spaces/233252/asset_folders/576397 method: PUT response: proto: HTTP/2.0 @@ -122,7 +122,7 @@ interactions: headers: {} status: 204 No Content code: 204 - duration: 61.682219ms + duration: 146.615459ms - id: 4 request: proto: HTTP/1.1 @@ -137,7 +137,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/asset_folders/304158 + url: https://mapi.storyblok.com/v1/spaces/233252/asset_folders/576397 method: GET response: proto: HTTP/2.0 @@ -147,13 +147,13 @@ interactions: trailer: {} content_length: 143 uncompressed: false - body: '{"asset_folder":{"id":304158,"name":"new-asset-folder-name","parent_id":null,"uuid":"fd4e5a06-b168-4789-910f-95e053229e87","parent_uuid":null}}' + body: '{"asset_folder":{"id":576397,"name":"new-asset-folder-name","parent_id":null,"uuid":"fa69a52f-3dd1-420b-8e2c-1b30bdef162c","parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 55.908121ms + duration: 40.777416ms - id: 5 request: proto: HTTP/1.1 @@ -168,7 +168,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/asset_folders/304158 + url: https://mapi.storyblok.com/v1/spaces/233252/asset_folders/576397 method: GET response: proto: HTTP/2.0 @@ -178,13 +178,13 @@ interactions: trailer: {} content_length: 143 uncompressed: false - body: '{"asset_folder":{"id":304158,"name":"new-asset-folder-name","parent_id":null,"uuid":"fd4e5a06-b168-4789-910f-95e053229e87","parent_uuid":null}}' + body: '{"asset_folder":{"id":576397,"name":"new-asset-folder-name","parent_id":null,"uuid":"fa69a52f-3dd1-420b-8e2c-1b30bdef162c","parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 53.375039ms + duration: 40.8615ms - id: 6 request: proto: HTTP/1.1 @@ -199,7 +199,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/asset_folders/304158 + url: https://mapi.storyblok.com/v1/spaces/233252/asset_folders/576397 method: DELETE response: proto: HTTP/2.0 @@ -213,4 +213,4 @@ interactions: headers: {} status: 204 No Content code: 204 - duration: 98.791678ms + duration: 174.791209ms diff --git a/internal/assets/component.yaml b/internal/assets/component.yaml index 6943d01..147b60a 100644 --- a/internal/assets/component.yaml +++ b/internal/assets/component.yaml @@ -25,13 +25,13 @@ interactions: trailer: {} content_length: 569 uncompressed: false - body: '{"component":{"name":"test-banner","display_name":null,"created_at":"2024-04-19T07:48:23.688Z","updated_at":"2024-04-19T07:48:23.688Z","id":5678041,"schema":{"title":{"pos":1,"type":"text"},"intro":{"pos":2,"type":"text"},"image":{"pos":3,"type":"image"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":"\u003cdiv\u003e\u003c/div\u003e","is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"test-banner","component_group_uuid":null,"color":null,"icon":null,"internal_tags_list":[],"internal_tag_ids":[],"content_type_asset_preview":null}}' + body: '{"component":{"name":"test-banner","display_name":null,"created_at":"2024-06-19T11:49:36.374Z","updated_at":"2024-06-19T11:49:36.374Z","id":5949850,"schema":{"title":{"pos":1,"type":"text"},"intro":{"pos":2,"type":"text"},"image":{"pos":3,"type":"image"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":"\u003cdiv\u003e\u003c/div\u003e","is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"test-banner","component_group_uuid":null,"color":null,"icon":null,"internal_tags_list":[],"internal_tag_ids":[],"content_type_asset_preview":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 148.817321ms + duration: 129.956416ms - id: 1 request: proto: HTTP/1.1 @@ -46,7 +46,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/components/5678041 + url: https://mapi.storyblok.com/v1/spaces/233252/components/5949850 method: GET response: proto: HTTP/2.0 @@ -56,13 +56,13 @@ interactions: trailer: {} content_length: 569 uncompressed: false - body: '{"component":{"name":"test-banner","display_name":null,"created_at":"2024-04-19T07:48:23.688Z","updated_at":"2024-04-19T07:48:23.688Z","id":5678041,"schema":{"title":{"pos":1,"type":"text"},"intro":{"pos":2,"type":"text"},"image":{"pos":3,"type":"image"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":"\u003cdiv\u003e\u003c/div\u003e","is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"test-banner","component_group_uuid":null,"color":null,"icon":null,"internal_tags_list":[],"internal_tag_ids":[],"content_type_asset_preview":null}}' + body: '{"component":{"name":"test-banner","display_name":null,"created_at":"2024-06-19T11:49:36.374Z","updated_at":"2024-06-19T11:49:36.374Z","id":5949850,"schema":{"title":{"pos":1,"type":"text"},"intro":{"pos":2,"type":"text"},"image":{"pos":3,"type":"image"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":"\u003cdiv\u003e\u003c/div\u003e","is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"test-banner","component_group_uuid":null,"color":null,"icon":null,"internal_tags_list":[],"internal_tag_ids":[],"content_type_asset_preview":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 48.717671ms + duration: 106.954542ms - id: 2 request: proto: HTTP/1.1 @@ -77,7 +77,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/components/5678041 + url: https://mapi.storyblok.com/v1/spaces/233252/components/5949850 method: GET response: proto: HTTP/2.0 @@ -87,28 +87,28 @@ interactions: trailer: {} content_length: 569 uncompressed: false - body: '{"component":{"name":"test-banner","display_name":null,"created_at":"2024-04-19T07:48:23.688Z","updated_at":"2024-04-19T07:48:23.688Z","id":5678041,"schema":{"title":{"pos":1,"type":"text"},"intro":{"pos":2,"type":"text"},"image":{"pos":3,"type":"image"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":"\u003cdiv\u003e\u003c/div\u003e","is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"test-banner","component_group_uuid":null,"color":null,"icon":null,"internal_tags_list":[],"internal_tag_ids":[],"content_type_asset_preview":null}}' + body: '{"component":{"name":"test-banner","display_name":null,"created_at":"2024-06-19T11:49:36.374Z","updated_at":"2024-06-19T11:49:36.374Z","id":5949850,"schema":{"title":{"pos":1,"type":"text"},"intro":{"pos":2,"type":"text"},"image":{"pos":3,"type":"image"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":"\u003cdiv\u003e\u003c/div\u003e","is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"test-banner","component_group_uuid":null,"color":null,"icon":null,"internal_tags_list":[],"internal_tag_ids":[],"content_type_asset_preview":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 49.537143ms + duration: 43.386ms - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 171 + content_length: 298 transfer_encoding: [] trailer: {} host: mapi.storyblok.com remote_addr: "" request_uri: "" - body: '{"component":{"is_nestable":false,"is_root":false,"name":"new-test-banner","preview_tmpl":null,"schema":{"intro":{"pos":1,"type":"text"},"title":{"pos":2,"type":"text"}}}}' + body: '{"component":{"is_nestable":false,"is_root":false,"name":"new-test-banner","preview_tmpl":"\u003cdiv\u003e\u003c/div\u003e","schema":{"intro":{"pos":1,"type":"text"},"title":{"pos":2,"type":"text"},"buttons":{"filter_content_type":["button"],"pos":3,"source":"internal_stories","type":"options"}}}}' form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/components/5678041 + url: https://mapi.storyblok.com/v1/spaces/233252/components/5949850 method: PUT response: proto: HTTP/2.0 @@ -116,15 +116,15 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 515 + content_length: 642 uncompressed: false - body: '{"component":{"name":"new-test-banner","display_name":null,"created_at":"2024-04-19T07:48:23.688Z","updated_at":"2024-04-19T07:48:24.442Z","id":5678041,"schema":{"intro":{"pos":1,"type":"text"},"title":{"pos":2,"type":"text"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":null,"is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"new-test-banner","component_group_uuid":null,"color":null,"icon":null,"internal_tags_list":[],"internal_tag_ids":[],"content_type_asset_preview":null}}' + body: '{"component":{"name":"new-test-banner","display_name":null,"created_at":"2024-06-19T11:49:36.374Z","updated_at":"2024-06-19T11:49:37.276Z","id":5949850,"schema":{"intro":{"pos":1,"type":"text"},"title":{"pos":2,"type":"text"},"buttons":{"filter_content_type":["button"],"pos":3,"source":"internal_stories","type":"options"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":"\u003cdiv\u003e\u003c/div\u003e","is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"new-test-banner","component_group_uuid":null,"color":null,"icon":null,"internal_tags_list":[],"internal_tag_ids":[],"content_type_asset_preview":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 84.046017ms + duration: 128.283917ms - id: 4 request: proto: HTTP/1.1 @@ -139,7 +139,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/components/5678041 + url: https://mapi.storyblok.com/v1/spaces/233252/components/5949850 method: GET response: proto: HTTP/2.0 @@ -147,15 +147,15 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 515 + content_length: 642 uncompressed: false - body: '{"component":{"name":"new-test-banner","display_name":null,"created_at":"2024-04-19T07:48:23.688Z","updated_at":"2024-04-19T07:48:24.442Z","id":5678041,"schema":{"intro":{"pos":1,"type":"text"},"title":{"pos":2,"type":"text"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":null,"is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"new-test-banner","component_group_uuid":null,"color":null,"icon":null,"internal_tags_list":[],"internal_tag_ids":[],"content_type_asset_preview":null}}' + body: '{"component":{"name":"new-test-banner","display_name":null,"created_at":"2024-06-19T11:49:36.374Z","updated_at":"2024-06-19T11:49:37.276Z","id":5949850,"schema":{"intro":{"pos":1,"type":"text"},"title":{"pos":2,"type":"text"},"buttons":{"filter_content_type":["button"],"pos":3,"source":"internal_stories","type":"options"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":"\u003cdiv\u003e\u003c/div\u003e","is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"new-test-banner","component_group_uuid":null,"color":null,"icon":null,"internal_tags_list":[],"internal_tag_ids":[],"content_type_asset_preview":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 80.854674ms + duration: 35.870375ms - id: 5 request: proto: HTTP/1.1 @@ -170,7 +170,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/components/5678041 + url: https://mapi.storyblok.com/v1/spaces/233252/components/5949850 method: DELETE response: proto: HTTP/2.0 @@ -178,12 +178,12 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 515 + content_length: 642 uncompressed: false - body: '{"component":{"name":"new-test-banner","display_name":null,"created_at":"2024-04-19T07:48:23.688Z","updated_at":"2024-04-19T07:48:24.442Z","id":5678041,"schema":{"intro":{"pos":1,"type":"text"},"title":{"pos":2,"type":"text"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":null,"is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"new-test-banner","component_group_uuid":null,"color":null,"icon":null,"internal_tags_list":[],"internal_tag_ids":[],"content_type_asset_preview":null}}' + body: '{"component":{"name":"new-test-banner","display_name":null,"created_at":"2024-06-19T11:49:36.374Z","updated_at":"2024-06-19T11:49:37.276Z","id":5949850,"schema":{"intro":{"pos":1,"type":"text"},"title":{"pos":2,"type":"text"},"buttons":{"filter_content_type":["button"],"pos":3,"source":"internal_stories","type":"options"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":"\u003cdiv\u003e\u003c/div\u003e","is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"new-test-banner","component_group_uuid":null,"color":null,"icon":null,"internal_tags_list":[],"internal_tag_ids":[],"content_type_asset_preview":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 89.156546ms + duration: 109.515709ms diff --git a/internal/assets/component_group.yaml b/internal/assets/component_group.yaml index a6dcb58..052c215 100644 --- a/internal/assets/component_group.yaml +++ b/internal/assets/component_group.yaml @@ -23,15 +23,15 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 109 + content_length: 145 uncompressed: false - body: '{"component_group":{"name":"test-component-group","id":197390,"uuid":"a3ef226f-4bd4-4778-8cc3-b1807d980b67"}}' + body: '{"component_group":{"name":"test-component-group","id":357445,"uuid":"39b2bedd-508c-445c-abd0-2424bbb3ee16","parent_id":null,"parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 316.757963ms + duration: 147.508ms - id: 1 request: proto: HTTP/1.1 @@ -46,7 +46,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/component_groups/197390 + url: https://mapi.storyblok.com/v1/spaces/233252/component_groups/357445 method: GET response: proto: HTTP/2.0 @@ -54,15 +54,15 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 109 + content_length: 145 uncompressed: false - body: '{"component_group":{"name":"test-component-group","id":197390,"uuid":"a3ef226f-4bd4-4778-8cc3-b1807d980b67"}}' + body: '{"component_group":{"name":"test-component-group","id":357445,"uuid":"39b2bedd-508c-445c-abd0-2424bbb3ee16","parent_id":null,"parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 92.387616ms + duration: 59.843792ms - id: 2 request: proto: HTTP/1.1 @@ -77,7 +77,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/component_groups/197390 + url: https://mapi.storyblok.com/v1/spaces/233252/component_groups/357445 method: GET response: proto: HTTP/2.0 @@ -85,15 +85,15 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 109 + content_length: 145 uncompressed: false - body: '{"component_group":{"name":"test-component-group","id":197390,"uuid":"a3ef226f-4bd4-4778-8cc3-b1807d980b67"}}' + body: '{"component_group":{"name":"test-component-group","id":357445,"uuid":"39b2bedd-508c-445c-abd0-2424bbb3ee16","parent_id":null,"parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 53.431163ms + duration: 40.950458ms - id: 3 request: proto: HTTP/1.1 @@ -108,7 +108,7 @@ interactions: body: '{"component_group":{"name":"new-test-component-group"}}' form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/component_groups/197390 + url: https://mapi.storyblok.com/v1/spaces/233252/component_groups/357445 method: PUT response: proto: HTTP/2.0 @@ -116,15 +116,15 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 113 + content_length: 149 uncompressed: false - body: '{"component_group":{"name":"new-test-component-group","id":197390,"uuid":"a3ef226f-4bd4-4778-8cc3-b1807d980b67"}}' + body: '{"component_group":{"name":"new-test-component-group","id":357445,"uuid":"39b2bedd-508c-445c-abd0-2424bbb3ee16","parent_id":null,"parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 94.815882ms + duration: 53.853041ms - id: 4 request: proto: HTTP/1.1 @@ -139,7 +139,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/component_groups/197390 + url: https://mapi.storyblok.com/v1/spaces/233252/component_groups/357445 method: GET response: proto: HTTP/2.0 @@ -147,15 +147,15 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 113 + content_length: 149 uncompressed: false - body: '{"component_group":{"name":"new-test-component-group","id":197390,"uuid":"a3ef226f-4bd4-4778-8cc3-b1807d980b67"}}' + body: '{"component_group":{"name":"new-test-component-group","id":357445,"uuid":"39b2bedd-508c-445c-abd0-2424bbb3ee16","parent_id":null,"parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 55.321853ms + duration: 90.631875ms - id: 5 request: proto: HTTP/1.1 @@ -170,7 +170,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/component_groups/197390 + url: https://mapi.storyblok.com/v1/spaces/233252/component_groups/357445 method: DELETE response: proto: HTTP/2.0 @@ -178,12 +178,12 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 113 + content_length: 149 uncompressed: false - body: '{"component_group":{"name":"new-test-component-group","id":197390,"uuid":"a3ef226f-4bd4-4778-8cc3-b1807d980b67"}}' + body: '{"component_group":{"name":"new-test-component-group","id":357445,"uuid":"39b2bedd-508c-445c-abd0-2424bbb3ee16","parent_id":null,"parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1.216751814s + duration: 1.759588959s diff --git a/internal/assets/space_role.yaml b/internal/assets/space_role.yaml index 30b2ae9..b43ecd2 100644 --- a/internal/assets/space_role.yaml +++ b/internal/assets/space_role.yaml @@ -25,13 +25,13 @@ interactions: trailer: {} content_length: 359 uncompressed: false - body: '{"space_role":{"id":62325,"resolved_allowed_paths":[],"allowed_paths":["1"],"field_permissions":["component_name.field_name"],"readonly_field_permissions":[],"permissions":["access_tasks"],"role":"tester","subtitle":"A test group","datasource_ids":[],"component_ids":[],"branch_ids":[],"allowed_languages":["default"],"asset_folder_ids":[],"ext_id":"FizBuz"}}' + body: '{"space_role":{"id":67200,"resolved_allowed_paths":[],"allowed_paths":["1"],"field_permissions":["component_name.field_name"],"readonly_field_permissions":[],"permissions":["access_tasks"],"role":"tester","subtitle":"A test group","datasource_ids":[],"component_ids":[],"branch_ids":[],"allowed_languages":["default"],"asset_folder_ids":[],"ext_id":"FizBuz"}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 164.322798ms + duration: 133.641292ms - id: 1 request: proto: HTTP/1.1 @@ -46,7 +46,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/space_roles/62325 + url: https://mapi.storyblok.com/v1/spaces/233252/space_roles/67200 method: GET response: proto: HTTP/2.0 @@ -56,13 +56,13 @@ interactions: trailer: {} content_length: 359 uncompressed: false - body: '{"space_role":{"id":62325,"resolved_allowed_paths":[],"allowed_paths":["1"],"field_permissions":["component_name.field_name"],"readonly_field_permissions":[],"permissions":["access_tasks"],"role":"tester","subtitle":"A test group","datasource_ids":[],"component_ids":[],"branch_ids":[],"allowed_languages":["default"],"asset_folder_ids":[],"ext_id":"FizBuz"}}' + body: '{"space_role":{"id":67200,"resolved_allowed_paths":[],"allowed_paths":["1"],"field_permissions":["component_name.field_name"],"readonly_field_permissions":[],"permissions":["access_tasks"],"role":"tester","subtitle":"A test group","datasource_ids":[],"component_ids":[],"branch_ids":[],"allowed_languages":["default"],"asset_folder_ids":[],"ext_id":"FizBuz"}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 64.142974ms + duration: 38.298ms - id: 2 request: proto: HTTP/1.1 @@ -77,7 +77,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/space_roles/62325 + url: https://mapi.storyblok.com/v1/spaces/233252/space_roles/67200 method: GET response: proto: HTTP/2.0 @@ -87,28 +87,28 @@ interactions: trailer: {} content_length: 359 uncompressed: false - body: '{"space_role":{"id":62325,"resolved_allowed_paths":[],"allowed_paths":["1"],"field_permissions":["component_name.field_name"],"readonly_field_permissions":[],"permissions":["access_tasks"],"role":"tester","subtitle":"A test group","datasource_ids":[],"component_ids":[],"branch_ids":[],"allowed_languages":["default"],"asset_folder_ids":[],"ext_id":"FizBuz"}}' + body: '{"space_role":{"id":67200,"resolved_allowed_paths":[],"allowed_paths":["1"],"field_permissions":["component_name.field_name"],"readonly_field_permissions":[],"permissions":["access_tasks"],"role":"tester","subtitle":"A test group","datasource_ids":[],"component_ids":[],"branch_ids":[],"allowed_languages":["default"],"asset_folder_ids":[],"ext_id":"FizBuz"}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 56.283498ms + duration: 44.116541ms - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 215 + content_length: 219 transfer_encoding: [] trailer: {} host: mapi.storyblok.com remote_addr: "" request_uri: "" - body: '{"space_role":{"allowed_languages":["default"],"allowed_paths":["1"],"ext_id":"FizBuz","field_permissions":["component_name.field_name"],"permissions":["access_tasks"],"role":"new-tester","subtitle":"A test group"}}' + body: '{"space_role":{"allowed_languages":["default"],"allowed_paths":["1"],"ext_id":"BuzFiz","field_permissions":["component_name.field_name"],"permissions":["access_tasks"],"role":"new-tester","subtitle":"A new test group"}}' form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/space_roles/62325 + url: https://mapi.storyblok.com/v1/spaces/233252/space_roles/67200 method: PUT response: proto: HTTP/2.0 @@ -116,15 +116,15 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 363 + content_length: 367 uncompressed: false - body: '{"space_role":{"id":62325,"resolved_allowed_paths":[],"allowed_paths":["1"],"field_permissions":["component_name.field_name"],"readonly_field_permissions":[],"permissions":["access_tasks"],"role":"new-tester","subtitle":"A test group","datasource_ids":[],"component_ids":[],"branch_ids":[],"allowed_languages":["default"],"asset_folder_ids":[],"ext_id":"FizBuz"}}' + body: '{"space_role":{"id":67200,"resolved_allowed_paths":[],"allowed_paths":["1"],"field_permissions":["component_name.field_name"],"readonly_field_permissions":[],"permissions":["access_tasks"],"role":"new-tester","subtitle":"A new test group","datasource_ids":[],"component_ids":[],"branch_ids":[],"allowed_languages":["default"],"asset_folder_ids":[],"ext_id":"BuzFiz"}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 209.388625ms + duration: 83.993708ms - id: 4 request: proto: HTTP/1.1 @@ -139,7 +139,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/space_roles/62325 + url: https://mapi.storyblok.com/v1/spaces/233252/space_roles/67200 method: GET response: proto: HTTP/2.0 @@ -147,15 +147,15 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 363 + content_length: 367 uncompressed: false - body: '{"space_role":{"id":62325,"resolved_allowed_paths":[],"allowed_paths":["1"],"field_permissions":["component_name.field_name"],"readonly_field_permissions":[],"permissions":["access_tasks"],"role":"new-tester","subtitle":"A test group","datasource_ids":[],"component_ids":[],"branch_ids":[],"allowed_languages":["default"],"asset_folder_ids":[],"ext_id":"FizBuz"}}' + body: '{"space_role":{"id":67200,"resolved_allowed_paths":[],"allowed_paths":["1"],"field_permissions":["component_name.field_name"],"readonly_field_permissions":[],"permissions":["access_tasks"],"role":"new-tester","subtitle":"A new test group","datasource_ids":[],"component_ids":[],"branch_ids":[],"allowed_languages":["default"],"asset_folder_ids":[],"ext_id":"BuzFiz"}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 58.870415ms + duration: 46.350167ms - id: 5 request: proto: HTTP/1.1 @@ -170,7 +170,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/space_roles/62325 + url: https://mapi.storyblok.com/v1/spaces/233252/space_roles/67200 method: DELETE response: proto: HTTP/2.0 @@ -178,12 +178,12 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 363 + content_length: 367 uncompressed: false - body: '{"space_role":{"id":62325,"resolved_allowed_paths":[],"allowed_paths":["1"],"field_permissions":["component_name.field_name"],"readonly_field_permissions":[],"permissions":["access_tasks"],"role":"new-tester","subtitle":"A test group","datasource_ids":[],"component_ids":[],"branch_ids":[],"allowed_languages":["default"],"asset_folder_ids":[],"ext_id":"FizBuz"}}' + body: '{"space_role":{"id":67200,"resolved_allowed_paths":[],"allowed_paths":["1"],"field_permissions":["component_name.field_name"],"readonly_field_permissions":[],"permissions":["access_tasks"],"role":"new-tester","subtitle":"A new test group","datasource_ids":[],"component_ids":[],"branch_ids":[],"allowed_languages":["default"],"asset_folder_ids":[],"ext_id":"BuzFiz"}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 95.255057ms + duration: 86.8515ms diff --git a/internal/component_resource_test.go b/internal/component_resource_test.go index 8f8cf92..dae9b9c 100644 --- a/internal/component_resource_test.go +++ b/internal/component_resource_test.go @@ -39,6 +39,9 @@ func TestComponentResourceBasic(t *testing.T) { resource.TestCheckResourceAttr(rn, "schema.intro.type", "text"), resource.TestCheckResourceAttr(rn, "schema.title.position", "2"), resource.TestCheckResourceAttr(rn, "schema.title.type", "text"), + resource.TestCheckResourceAttr(rn, "schema.buttons.filter_content_type.0", "button"), + resource.TestCheckResourceAttr(rn, "schema.buttons.type", "options"), + resource.TestCheckResourceAttr(rn, "schema.buttons.position", "3"), ), }, }, @@ -89,7 +92,15 @@ func testComponentConfigUpdate(identifier string, spaceId int) string { type = "text" position = 1 } + + buttons = { + type = "options" + source = "internal_stories" + position = 3 + filter_content_type = ["button"] + } } + preview_tmpl = "
" } `, map[string]any{ "identifier": identifier,