From 2827cb3229b8b37370caa355b805497a6ffba637 Mon Sep 17 00:00:00 2001 From: Paul Vaneveld Date: Thu, 11 Jul 2024 16:26:32 +0200 Subject: [PATCH] test: add test --- internal/assets/asset_folder.yaml | 36 ++++++++--------- internal/assets/component.yaml | 44 ++++++++++---------- internal/assets/component_group.yaml | 34 ++++++++-------- internal/assets/space_role.yaml | 34 ++++++++-------- internal/component_resource_test.go | 60 +++++++++++++++++++--------- 5 files changed, 116 insertions(+), 92 deletions(-) diff --git a/internal/assets/asset_folder.yaml b/internal/assets/asset_folder.yaml index 4361fe4..9d9ad77 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":576397,"name":"asset-folder-name","parent_id":null,"uuid":"fa69a52f-3dd1-420b-8e2c-1b30bdef162c","parent_uuid":null}}' + body: '{"asset_folder":{"id":604728,"name":"asset-folder-name","parent_id":null,"uuid":"3092d6ba-5c74-416b-be9a-f2de95c64cd4","parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 103.60975ms + duration: 253.17725ms - 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/576397 + url: https://mapi.storyblok.com/v1/spaces/233252/asset_folders/604728 method: GET response: proto: HTTP/2.0 @@ -56,13 +56,13 @@ interactions: trailer: {} content_length: 139 uncompressed: false - body: '{"asset_folder":{"id":576397,"name":"asset-folder-name","parent_id":null,"uuid":"fa69a52f-3dd1-420b-8e2c-1b30bdef162c","parent_uuid":null}}' + body: '{"asset_folder":{"id":604728,"name":"asset-folder-name","parent_id":null,"uuid":"3092d6ba-5c74-416b-be9a-f2de95c64cd4","parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 39.288459ms + duration: 102.269667ms - 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/576397 + url: https://mapi.storyblok.com/v1/spaces/233252/asset_folders/604728 method: GET response: proto: HTTP/2.0 @@ -87,13 +87,13 @@ interactions: trailer: {} content_length: 139 uncompressed: false - body: '{"asset_folder":{"id":576397,"name":"asset-folder-name","parent_id":null,"uuid":"fa69a52f-3dd1-420b-8e2c-1b30bdef162c","parent_uuid":null}}' + body: '{"asset_folder":{"id":604728,"name":"asset-folder-name","parent_id":null,"uuid":"3092d6ba-5c74-416b-be9a-f2de95c64cd4","parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 262.893583ms + duration: 107.813083ms - 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/576397 + url: https://mapi.storyblok.com/v1/spaces/233252/asset_folders/604728 method: PUT response: proto: HTTP/2.0 @@ -122,7 +122,7 @@ interactions: headers: {} status: 204 No Content code: 204 - duration: 146.615459ms + duration: 152.376458ms - 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/576397 + url: https://mapi.storyblok.com/v1/spaces/233252/asset_folders/604728 method: GET response: proto: HTTP/2.0 @@ -147,13 +147,13 @@ interactions: trailer: {} content_length: 143 uncompressed: false - body: '{"asset_folder":{"id":576397,"name":"new-asset-folder-name","parent_id":null,"uuid":"fa69a52f-3dd1-420b-8e2c-1b30bdef162c","parent_uuid":null}}' + body: '{"asset_folder":{"id":604728,"name":"new-asset-folder-name","parent_id":null,"uuid":"3092d6ba-5c74-416b-be9a-f2de95c64cd4","parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 40.777416ms + duration: 86.802167ms - 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/576397 + url: https://mapi.storyblok.com/v1/spaces/233252/asset_folders/604728 method: GET response: proto: HTTP/2.0 @@ -178,13 +178,13 @@ interactions: trailer: {} content_length: 143 uncompressed: false - body: '{"asset_folder":{"id":576397,"name":"new-asset-folder-name","parent_id":null,"uuid":"fa69a52f-3dd1-420b-8e2c-1b30bdef162c","parent_uuid":null}}' + body: '{"asset_folder":{"id":604728,"name":"new-asset-folder-name","parent_id":null,"uuid":"3092d6ba-5c74-416b-be9a-f2de95c64cd4","parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 40.8615ms + duration: 80.509792ms - 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/576397 + url: https://mapi.storyblok.com/v1/spaces/233252/asset_folders/604728 method: DELETE response: proto: HTTP/2.0 @@ -213,4 +213,4 @@ interactions: headers: {} status: 204 No Content code: 204 - duration: 174.791209ms + duration: 240.006791ms diff --git a/internal/assets/component.yaml b/internal/assets/component.yaml index 147b60a..cfa6381 100644 --- a/internal/assets/component.yaml +++ b/internal/assets/component.yaml @@ -6,13 +6,13 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 229 + content_length: 447 transfer_encoding: [] trailer: {} host: mapi.storyblok.com remote_addr: "" request_uri: "" - body: '{"component":{"is_nestable":false,"is_root":false,"name":"test-banner","preview_tmpl":"\u003cdiv\u003e\u003c/div\u003e","schema":{"title":{"pos":1,"type":"text"},"intro":{"pos":2,"type":"text"},"image":{"pos":3,"type":"image"}}}}' + body: '{"component":{"is_nestable":false,"is_root":false,"name":"test-banner","preview_tmpl":"\u003cdiv\u003e\u003c/div\u003e","schema":{"title":{"pos":1,"type":"text"},"intro":{"pos":2,"type":"text"},"image":{"conditional_settings":[{"modifications":[{"required":true}],"rule_conditions":[{"validated_object":{"field_attr":"value","field_key":"intro","type":"field"},"validation":"empty","value":"empty"}],"rule_match":"all"}],"pos":3,"type":"image"}}}}' form: {} headers: {} url: https://mapi.storyblok.com/v1/spaces/233252/components/ @@ -23,15 +23,15 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 569 + content_length: 787 uncompressed: false - 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}}' + body: '{"component":{"name":"test-banner","display_name":null,"created_at":"2024-07-11T14:25:04.047Z","updated_at":"2024-07-11T14:25:04.047Z","id":6038934,"schema":{"title":{"pos":1,"type":"text"},"intro":{"pos":2,"type":"text"},"image":{"conditional_settings":[{"modifications":[{"required":true}],"rule_conditions":[{"validated_object":{"field_attr":"value","field_key":"intro","type":"field"},"validation":"empty","value":"empty"}],"rule_match":"all"}],"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: 129.956416ms + duration: 104.29925ms - id: 1 request: proto: HTTP/1.1 @@ -46,7 +46,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/components/5949850 + url: https://mapi.storyblok.com/v1/spaces/233252/components/6038934 method: GET response: proto: HTTP/2.0 @@ -54,15 +54,15 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 569 + content_length: 787 uncompressed: false - 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}}' + body: '{"component":{"name":"test-banner","display_name":null,"created_at":"2024-07-11T14:25:04.047Z","updated_at":"2024-07-11T14:25:04.047Z","id":6038934,"schema":{"title":{"pos":1,"type":"text"},"intro":{"pos":2,"type":"text"},"image":{"conditional_settings":[{"modifications":[{"required":true}],"rule_conditions":[{"validated_object":{"field_attr":"value","field_key":"intro","type":"field"},"validation":"empty","value":"empty"}],"rule_match":"all"}],"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: 106.954542ms + duration: 77.601416ms - id: 2 request: proto: HTTP/1.1 @@ -77,7 +77,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/components/5949850 + url: https://mapi.storyblok.com/v1/spaces/233252/components/6038934 method: GET response: proto: HTTP/2.0 @@ -85,15 +85,15 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 569 + content_length: 787 uncompressed: false - 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}}' + body: '{"component":{"name":"test-banner","display_name":null,"created_at":"2024-07-11T14:25:04.047Z","updated_at":"2024-07-11T14:25:04.047Z","id":6038934,"schema":{"title":{"pos":1,"type":"text"},"intro":{"pos":2,"type":"text"},"image":{"conditional_settings":[{"modifications":[{"required":true}],"rule_conditions":[{"validated_object":{"field_attr":"value","field_key":"intro","type":"field"},"validation":"empty","value":"empty"}],"rule_match":"all"}],"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: 43.386ms + duration: 78.886416ms - id: 3 request: proto: HTTP/1.1 @@ -108,7 +108,7 @@ interactions: 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/5949850 + url: https://mapi.storyblok.com/v1/spaces/233252/components/6038934 method: PUT response: proto: HTTP/2.0 @@ -118,13 +118,13 @@ interactions: trailer: {} content_length: 642 uncompressed: false - 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}}' + body: '{"component":{"name":"new-test-banner","display_name":null,"created_at":"2024-07-11T14:25:04.047Z","updated_at":"2024-07-11T14:25:04.914Z","id":6038934,"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: 128.283917ms + duration: 115.851583ms - id: 4 request: proto: HTTP/1.1 @@ -139,7 +139,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/components/5949850 + url: https://mapi.storyblok.com/v1/spaces/233252/components/6038934 method: GET response: proto: HTTP/2.0 @@ -149,13 +149,13 @@ interactions: trailer: {} content_length: 642 uncompressed: false - 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}}' + body: '{"component":{"name":"new-test-banner","display_name":null,"created_at":"2024-07-11T14:25:04.047Z","updated_at":"2024-07-11T14:25:04.914Z","id":6038934,"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: 35.870375ms + duration: 82.617166ms - id: 5 request: proto: HTTP/1.1 @@ -170,7 +170,7 @@ interactions: body: "" form: {} headers: {} - url: https://mapi.storyblok.com/v1/spaces/233252/components/5949850 + url: https://mapi.storyblok.com/v1/spaces/233252/components/6038934 method: DELETE response: proto: HTTP/2.0 @@ -180,10 +180,10 @@ interactions: trailer: {} content_length: 642 uncompressed: false - 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}}' + body: '{"component":{"name":"new-test-banner","display_name":null,"created_at":"2024-07-11T14:25:04.047Z","updated_at":"2024-07-11T14:25:04.914Z","id":6038934,"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: 109.515709ms + duration: 146.879375ms diff --git a/internal/assets/component_group.yaml b/internal/assets/component_group.yaml index 052c215..740a6fa 100644 --- a/internal/assets/component_group.yaml +++ b/internal/assets/component_group.yaml @@ -25,13 +25,13 @@ interactions: trailer: {} content_length: 145 uncompressed: false - body: '{"component_group":{"name":"test-component-group","id":357445,"uuid":"39b2bedd-508c-445c-abd0-2424bbb3ee16","parent_id":null,"parent_uuid":null}}' + body: '{"component_group":{"name":"test-component-group","id":368529,"uuid":"7a856dbd-c9f8-46cc-8f1a-ff5a1e97085b","parent_id":null,"parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 147.508ms + duration: 101.948459ms - 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/357445 + url: https://mapi.storyblok.com/v1/spaces/233252/component_groups/368529 method: GET response: proto: HTTP/2.0 @@ -56,13 +56,13 @@ interactions: trailer: {} content_length: 145 uncompressed: false - body: '{"component_group":{"name":"test-component-group","id":357445,"uuid":"39b2bedd-508c-445c-abd0-2424bbb3ee16","parent_id":null,"parent_uuid":null}}' + body: '{"component_group":{"name":"test-component-group","id":368529,"uuid":"7a856dbd-c9f8-46cc-8f1a-ff5a1e97085b","parent_id":null,"parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 59.843792ms + duration: 236.725792ms - 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/357445 + url: https://mapi.storyblok.com/v1/spaces/233252/component_groups/368529 method: GET response: proto: HTTP/2.0 @@ -87,13 +87,13 @@ interactions: trailer: {} content_length: 145 uncompressed: false - body: '{"component_group":{"name":"test-component-group","id":357445,"uuid":"39b2bedd-508c-445c-abd0-2424bbb3ee16","parent_id":null,"parent_uuid":null}}' + body: '{"component_group":{"name":"test-component-group","id":368529,"uuid":"7a856dbd-c9f8-46cc-8f1a-ff5a1e97085b","parent_id":null,"parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 40.950458ms + duration: 82.279125ms - 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/357445 + url: https://mapi.storyblok.com/v1/spaces/233252/component_groups/368529 method: PUT response: proto: HTTP/2.0 @@ -118,13 +118,13 @@ interactions: trailer: {} content_length: 149 uncompressed: false - body: '{"component_group":{"name":"new-test-component-group","id":357445,"uuid":"39b2bedd-508c-445c-abd0-2424bbb3ee16","parent_id":null,"parent_uuid":null}}' + body: '{"component_group":{"name":"new-test-component-group","id":368529,"uuid":"7a856dbd-c9f8-46cc-8f1a-ff5a1e97085b","parent_id":null,"parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 53.853041ms + duration: 142.881417ms - 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/357445 + url: https://mapi.storyblok.com/v1/spaces/233252/component_groups/368529 method: GET response: proto: HTTP/2.0 @@ -149,13 +149,13 @@ interactions: trailer: {} content_length: 149 uncompressed: false - body: '{"component_group":{"name":"new-test-component-group","id":357445,"uuid":"39b2bedd-508c-445c-abd0-2424bbb3ee16","parent_id":null,"parent_uuid":null}}' + body: '{"component_group":{"name":"new-test-component-group","id":368529,"uuid":"7a856dbd-c9f8-46cc-8f1a-ff5a1e97085b","parent_id":null,"parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 90.631875ms + duration: 84.502167ms - 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/357445 + url: https://mapi.storyblok.com/v1/spaces/233252/component_groups/368529 method: DELETE response: proto: HTTP/2.0 @@ -180,10 +180,10 @@ interactions: trailer: {} content_length: 149 uncompressed: false - body: '{"component_group":{"name":"new-test-component-group","id":357445,"uuid":"39b2bedd-508c-445c-abd0-2424bbb3ee16","parent_id":null,"parent_uuid":null}}' + body: '{"component_group":{"name":"new-test-component-group","id":368529,"uuid":"7a856dbd-c9f8-46cc-8f1a-ff5a1e97085b","parent_id":null,"parent_uuid":null}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1.759588959s + duration: 1.86876175s diff --git a/internal/assets/space_role.yaml b/internal/assets/space_role.yaml index b43ecd2..259056e 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":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"}}' + body: '{"space_role":{"id":67553,"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: 133.641292ms + duration: 125.047042ms - 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/67200 + url: https://mapi.storyblok.com/v1/spaces/233252/space_roles/67553 method: GET response: proto: HTTP/2.0 @@ -56,13 +56,13 @@ interactions: trailer: {} content_length: 359 uncompressed: false - 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"}}' + body: '{"space_role":{"id":67553,"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: 38.298ms + duration: 86.834792ms - 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/67200 + url: https://mapi.storyblok.com/v1/spaces/233252/space_roles/67553 method: GET response: proto: HTTP/2.0 @@ -87,13 +87,13 @@ interactions: trailer: {} content_length: 359 uncompressed: false - 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"}}' + body: '{"space_role":{"id":67553,"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: 44.116541ms + duration: 90.119083ms - id: 3 request: proto: HTTP/1.1 @@ -108,7 +108,7 @@ interactions: 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/67200 + url: https://mapi.storyblok.com/v1/spaces/233252/space_roles/67553 method: PUT response: proto: HTTP/2.0 @@ -118,13 +118,13 @@ interactions: trailer: {} content_length: 367 uncompressed: false - 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"}}' + body: '{"space_role":{"id":67553,"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: 83.993708ms + duration: 174.415375ms - 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/67200 + url: https://mapi.storyblok.com/v1/spaces/233252/space_roles/67553 method: GET response: proto: HTTP/2.0 @@ -149,13 +149,13 @@ interactions: trailer: {} content_length: 367 uncompressed: false - 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"}}' + body: '{"space_role":{"id":67553,"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: 46.350167ms + duration: 93.840708ms - 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/67200 + url: https://mapi.storyblok.com/v1/spaces/233252/space_roles/67553 method: DELETE response: proto: HTTP/2.0 @@ -180,10 +180,10 @@ interactions: trailer: {} content_length: 367 uncompressed: false - 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"}}' + body: '{"space_role":{"id":67553,"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: 86.8515ms + duration: 121.799292ms diff --git a/internal/component_resource_test.go b/internal/component_resource_test.go index dae9b9c..142e7b3 100644 --- a/internal/component_resource_test.go +++ b/internal/component_resource_test.go @@ -29,6 +29,10 @@ func TestComponentResourceBasic(t *testing.T) { resource.TestCheckResourceAttr(rn, "schema.intro.type", "text"), resource.TestCheckResourceAttr(rn, "schema.image.position", "3"), resource.TestCheckResourceAttr(rn, "schema.image.type", "image"), + resource.TestCheckResourceAttr(rn, "schema.image.conditional_settings.0.modifications.0.required", "true"), + resource.TestCheckResourceAttr(rn, "schema.image.conditional_settings.0.rule_match", "all"), + resource.TestCheckResourceAttr(rn, "schema.image.conditional_settings.0.rule_conditions.0.validation", "empty"), + resource.TestCheckResourceAttr(rn, "schema.image.conditional_settings.0.rule_conditions.0.validated_object.field_key", "intro"), ), }, { @@ -51,25 +55,45 @@ func TestComponentResourceBasic(t *testing.T) { func testComponentConfig(identifier string, spaceId int) string { return HCLTemplate(` resource "storyblok_component" "{{ .identifier }}" { - name = "test-banner" - space_id = "{{ .spaceId }}" - schema = { - title = { - type = "text" - position = 1 - } - - intro = { - type = "text" - position = 2 - } - - image = { - type = "image" - position = 3 + name = "test-banner" + space_id = "{{ .spaceId }}" + schema = { + title = { + type = "text" + position = 1 + } + + intro = { + type = "text" + position = 2 + } + + image = { + type = "image" + position = 3 + + conditional_settings = [ + { + modifications = [ + { + required = true + } + ] + + rule_match = "all" + rule_conditions = [ + { + validation = "empty" + validated_object = { + field_key = "intro" + } + } + ] + } + ] } - } - preview_tmpl = "
" + } + preview_tmpl = "
" } `, map[string]any{ "identifier": identifier,