From 891811a226ac5306e06a5b4bbc297cc4b59e2e18 Mon Sep 17 00:00:00 2001 From: jdotcms Date: Tue, 10 Jun 2025 09:53:15 -0600 Subject: [PATCH 01/24] #32238 adding new endpoint --- .../v1/contenttype/ContentTypeResource.java | 226 ++++++++++++++++++ 1 file changed, 226 insertions(+) diff --git a/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java b/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java index f84d2563f8ce..1f746bc6101f 100644 --- a/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java +++ b/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java @@ -13,6 +13,7 @@ import com.dotcms.contenttype.model.type.ContentType; import com.dotcms.contenttype.transform.contenttype.ContentTypeInternationalization; import com.dotcms.exception.ExceptionUtil; +import com.dotcms.rendering.velocity.services.PageRenderUtil; import com.dotcms.repackage.com.google.common.annotations.VisibleForTesting; import com.dotcms.rest.InitDataObject; import com.dotcms.rest.ResponseEntityView; @@ -29,14 +30,20 @@ import com.dotcms.util.pagination.ContentTypesPaginator; import com.dotcms.util.pagination.OrderDirection; import com.dotcms.workflow.helper.WorkflowHelper; +import com.dotmarketing.beans.ContainerStructure; import com.dotmarketing.beans.Host; import com.dotmarketing.business.APILocator; import com.dotmarketing.business.DotStateException; import com.dotmarketing.business.PermissionAPI; import com.dotmarketing.exception.DotDataException; import com.dotmarketing.exception.DotSecurityException; +import com.dotmarketing.portlets.contentlet.model.Contentlet; +import com.dotmarketing.portlets.contentlet.model.ContentletVersionInfo; +import com.dotmarketing.portlets.htmlpageasset.business.render.ContainerRaw; +import com.dotmarketing.portlets.htmlpageasset.model.IHTMLPage; import com.dotmarketing.portlets.workflows.business.WorkflowAPI; import com.dotmarketing.portlets.workflows.model.SystemActionWorkflowActionMapping; +import com.dotmarketing.util.Config; import com.dotmarketing.util.Logger; import com.dotmarketing.util.PageMode; import com.dotmarketing.util.UUIDUtil; @@ -44,6 +51,7 @@ import com.dotmarketing.util.json.JSONException; import com.dotmarketing.util.json.JSONObject; import com.google.common.collect.ImmutableMap; +import com.liferay.portal.language.LanguageUtil; import com.liferay.portal.model.User; import com.liferay.util.StringPool; import io.swagger.v3.oas.annotations.ExternalDocumentation; @@ -55,6 +63,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; +import io.vavr.Lazy; import io.vavr.Tuple; import io.vavr.Tuple2; import io.vavr.control.Try; @@ -80,10 +89,14 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; +import java.util.Optional; import java.util.Set; +import java.util.function.Predicate; import java.util.stream.Collectors; import static com.dotcms.util.DotPreconditions.checkNotEmpty; @@ -113,6 +126,8 @@ public class ContentTypeResource implements Serializable { private final WorkflowHelper workflowHelper; private final PermissionAPI permissionAPI; + private final Lazy> contentPaletteHiddenTypes = Lazy.of(()->Set.of(Config.getStringArrayProperty("CONTENT_PALETTE_HIDDEN_CONTENT_TYPES", new String[]{}))); + public ContentTypeResource() { this(ContentTypeHelper.getInstance(), new WebResource(), new PaginationUtil(new ContentTypesPaginator()), @@ -1554,4 +1569,215 @@ private T getFilterValue(final FilteredContentTypesForm form, final String p return UtilMethods.isSet(form.getFilter().get(param)) ? (T) form.getFilter().get(param) : defaultValue; } + /** + * Returns a list of {@link ContentType} objects based on the filtering criteria. This is how + * you can call this endpoint: + *
{@code
+	 * GET http://localhost:8080/api/v1/contenttype?sites=48190c8c-42c4-46af-8d1a-0cd5db894797,SYSTEM_HOST,&per_page=40&&orderby=variabledirection=DESC
+	 * }
+ *

If you want results composed of 10 items per page and you want the third page, and you + * don't have the Site's Identifier, you can call this URL:

+ *
{@code
+	 * GET http://localhost:8080/api/v1/contenttype?sites=demo.dotcms.com&page=3&per_page=10
+	 * }
+ * + * @param httpRequest The current instance of the {@link HttpServletRequest}. + * @param httpResponse The current instance of the {@link HttpServletResponse}. + * @param filter Filtering parameter used to pass down the Content Types name, Velocity + * Variable Name, or Inode. You can pass down part of the characters. + * @param page The selected results page, for pagination purposes. + * @param perPage The number of results to return per page, for pagination purposes. + * @param orderByParam The column name that will be used to sort the paginated results. For + * reference, please check + * {@link com.dotmarketing.common.util.SQLUtil#ORDERBY_WHITELIST}. + * @param direction The direction of the sorting. It can be either "ASC" or "DESC". + * @param type The Velocity variable name of the Content Type to retrieve. + * @param siteId The identifier of the Site where the requested Content Types live. + * @param sites A comma-separated list of Site identifiers or Site Keys where the + * requested Content Types live. + * + * @return A JSON response with the paginated list of Content Types. + * + * @throws DotDataException An error occurred when retrieving information from the database. + */ + @GET + @Path("/page") + @JSONP + @NoCache + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.APPLICATION_JSON, "application/javascript"}) + @Operation( + operationId = "getPagesContentTypes", + summary = "Retrieves a list of content types for a page", + description = "Returns a list of content type objects based on the filtering criteria.", + tags = {"Content Type"}, + responses = { + @ApiResponse(responseCode = "200", description = "Content types retrieved successfully", + content = @Content( + mediaType = "application/json", + examples = { + @ExampleObject( + value = "{\n" + + " \"entity\": [\n" + + " {\n" + + " \"baseType\": \"string\",\n" + + " \"clazz\": \"string\",\n" + + " \"defaultType\": true,\n" + + " \"description\": \"string\",\n" + + " \"fixed\": true,\n" + + " \"folder\": \"string\",\n" + + " \"folderPath\": \"string\",\n" + + " \"host\": \"string\",\n" + + " \"iDate\": 0,\n" + + " \"icon\": \"string\",\n" + + " \"id\": \"string\",\n" + + " \"layout\": [],\n" + + " \"metadata\": {},\n" + + " \"modDate\": 0,\n" + + " \"multilingualable\": true,\n" + + " \"nEntries\": 0,\n" + + " \"name\": \"string\",\n" + + " \"siteName\": \"string\",\n" + + " \"sortOrder\": 0,\n" + + " \"system\": true,\n" + + " \"variable\": \"string\",\n" + + " \"versionable\": true,\n" + + " \"workflows\": []\n" + + " }\n" + + " ],\n" + + " \"errors\": [],\n" + + " \"i18nMessagesMap\": {},\n" + + " \"messages\": [],\n" + + " \"pagination\": {\n" + + " \"currentPage\": 0,\n" + + " \"perPage\": 0,\n" + + " \"totalEntries\": 0\n" + + " },\n" + + " \"permissions\": []\n" + + "}\n" + ) + } + ) + ), + @ApiResponse(responseCode = "403", description = "Forbidden"), + @ApiResponse(responseCode = "500", description = "Internal Server Error") + } + ) + public final Response getPagesContentTypes(@Context final HttpServletRequest httpRequest, + @Context final HttpServletResponse httpResponse, + + @QueryParam("pagePathOrId") @Parameter(schema = @Schema(type = "string"), + description = "The URL or Identifier of the page to filter content types for the palette" + ) final String pagePathOrId, + @DefaultValue("-1") @QueryParam("language") @Parameter( + schema = @Schema(type = "string"), + description = "Optional Language id" + ) String language, + @QueryParam(PaginationUtil.FILTER) @Parameter(schema = @Schema(type = "string"), + description = "String to filter/search for specific content types; leave blank to return all." + ) final String filter, + @QueryParam(PaginationUtil.PAGE) @Parameter(schema = @Schema(type = "integer"), + description = "Page number in response pagination.\n\nDefault: `1`" + ) final int page, + @QueryParam(PaginationUtil.PER_PAGE) @Parameter(schema = @Schema(type = "integer"), + description = "Number of results per page for pagination.\n\nDefault: `10`" + ) final int perPage, + @DefaultValue("upper(name)") @QueryParam(PaginationUtil.ORDER_BY) @Parameter( + schema = @Schema(type = "string"), + description = "Column(s) to sort the results. Multiple columns can be " + + "combined in a comma-separated list. Column names can also be set " + + "within a SQL string function, such as `upper()`.\n\n" + + "Some possible values:\n\n" + + "`name`, `velocity_var_name`, `mod_date`, `sort_order`\n\n" + + "`description`, `structuretype`, `category`, `inode`" + ) String orderByParam, + @DefaultValue("ASC") @QueryParam(PaginationUtil.DIRECTION) @Parameter( + schema = @Schema( + type = "string", + allowableValues = {"ASC", "DESC"}, + defaultValue = "ASC", + required = true + ), + description = "Sort direction: choose between ascending or descending." + ) String direction, + @QueryParam(ContentTypesPaginator.HOST_PARAMETER_ID) @Parameter(schema = @Schema(type = "string"), + description = "Filter by site identifier." + ) final String siteId) throws DotDataException, DotSecurityException { + + final User user = new WebResource.InitBuilder(this.webResource) + .requestAndResponse(httpRequest, httpResponse) + .rejectWhenNoUser(true) + .init().getUser(); + + if (Objects.isNull(pagePathOrId)) { + + throw new BadRequestException("The 'pagePathOrId' parameter is required."); + } + + Logger.debug(this, ()-> "Getting Content Types for page: " + pagePathOrId); + + final PageMode pageMode = PageMode.get(httpRequest); + final long userLanguageId = LanguageUtil.getLanguageId(language); + final long languageId = userLanguageId > 0 ? userLanguageId : APILocator.getLanguageAPI().getDefaultLanguage().getId(); + final Host site = UtilMethods.isSet(siteId) ? + APILocator.getHostAPI().find(siteId, user, pageMode.respectAnonPerms) : + APILocator.getHostAPI().findDefaultHost(user, pageMode.respectAnonPerms); // wondering if this should be current or default + final String orderBy = this.getOrderByRealName(orderByParam); + final List typeVarNames = findPageContainersContentTypesVarnamesByPathOrId(pagePathOrId, site, languageId, pageMode, user); + + final Map extraParams = new HashMap<>(); + if (null != siteId) { + extraParams.put(ContentTypesPaginator.HOST_PARAMETER_ID,siteId); + } + if (UtilMethods.isSet(typeVarNames)) { + + Logger.debug(this, ()-> "Found Content Types for page: " + pagePathOrId + + " in site: " + (Objects.nonNull(site) ? site.getHostname() : "null") + + " with languageId: " + languageId + " and pageMode: " + pageMode + + " with types: " + typeVarNames); + extraParams.put(ContentTypesPaginator.TYPES_PARAMETER_NAME, typeVarNames); + } + final PaginationUtil paginationUtil = new PaginationUtil(new ContentTypesPaginator(APILocator.getContentTypeAPI(user))); + return paginationUtil.getPage(httpRequest, user, filter, page, perPage, orderBy, + OrderDirection.valueOf(direction), extraParams); + } // getPagesContentTypes. + + private List findPageContainersContentTypesVarnamesByPathOrId(final String pagePathOrId, + final Host site, + final long languageId, + final PageMode pageMode, + final User user) throws DotDataException, DotSecurityException { + + Logger.debug(this, ()-> "Getting Content Types for page: " + pagePathOrId + + " in site: " + (Objects.nonNull(site) ? site.getHostname() : "null") + + " with languageId: " + languageId + " and pageMode: " + pageMode); + + IHTMLPage htmlPage = Try.of(()->APILocator.getHTMLPageAssetAPI().getPageByPath( + pagePathOrId, site, languageId, pageMode.showLive)).getOrNull(); + + if (Objects.isNull(htmlPage)) { // try fallback + + final Optional contentletVersionInfoOpt = APILocator.getVersionableAPI().getContentletVersionInfo(pagePathOrId, languageId); + if (contentletVersionInfoOpt.isPresent()) { + htmlPage = APILocator.getHTMLPageAssetAPI().findPage(pageMode.showLive? + contentletVersionInfoOpt.get().getLiveInode(): contentletVersionInfoOpt.get().getWorkingInode(), + user, pageMode.respectAnonPerms); + } else { + // try as an inode. + htmlPage = APILocator.getHTMLPageAssetAPI().findPage(pagePathOrId, user, pageMode.respectAnonPerms); + } + } + + if (Objects.isNull(htmlPage)) { // still null, so the page does not exist + + throw new BadRequestException( + String.format("Page with path or ID '%s' was not found", pagePathOrId)); + } + + // Retrieves the containers associated to the page, then extracts the content types for each container filtering the ones do not allowed + return new PageRenderUtil(htmlPage, user, pageMode, languageId, site) + .getContainersRaw().stream().map(containerRaw -> containerRaw.getContainerStructures()) + .flatMap(Collection::stream).map(ContainerStructure::getContentTypeVar) + .filter(Predicate.not(this.contentPaletteHiddenTypes.get()::contains)).collect(Collectors.toList()); + } } From 6b3ce60561cc96f47cb1bb6b97fe39309644abc1 Mon Sep 17 00:00:00 2001 From: jdotcms Date: Fri, 13 Jun 2025 15:39:31 -0600 Subject: [PATCH 02/24] #32238 adding final fixes after smoke qa, just about to do the postman test --- .../contenttype/business/ContentTypeAPIImpl.java | 2 +- .../api/v1/contenttype/ContentTypeResource.java | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/dotCMS/src/main/java/com/dotcms/contenttype/business/ContentTypeAPIImpl.java b/dotCMS/src/main/java/com/dotcms/contenttype/business/ContentTypeAPIImpl.java index adec005bc5d7..65e492e2785f 100644 --- a/dotCMS/src/main/java/com/dotcms/contenttype/business/ContentTypeAPIImpl.java +++ b/dotCMS/src/main/java/com/dotcms/contenttype/business/ContentTypeAPIImpl.java @@ -389,7 +389,7 @@ public Optional> find(final List varNames, final Strin contentTypeList = this.contentTypeFactory.find(lowercaseVarNames, filter.toLowerCase(), offset, limit, orderBy); } else if (offset > 0 || limit > 0) { int adjustedLimit = offset + limit; - adjustedLimit = adjustedLimit > lowercaseVarNames.size() ? lowercaseVarNames.size() : limit; + adjustedLimit = adjustedLimit > lowercaseVarNames.size() ? lowercaseVarNames.size() : adjustedLimit; final List varNamesSubList = lowercaseVarNames.subList(offset, adjustedLimit); contentTypeList = this.contentTypeFactory.find(varNamesSubList, null, internalOffset, internalLimit, orderBy); } else { diff --git a/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java b/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java index 1f746bc6101f..0c2f5cc87fe6 100644 --- a/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java +++ b/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java @@ -1723,7 +1723,8 @@ public final Response getPagesContentTypes(@Context final HttpServletRequest htt APILocator.getHostAPI().find(siteId, user, pageMode.respectAnonPerms) : APILocator.getHostAPI().findDefaultHost(user, pageMode.respectAnonPerms); // wondering if this should be current or default final String orderBy = this.getOrderByRealName(orderByParam); - final List typeVarNames = findPageContainersContentTypesVarnamesByPathOrId(pagePathOrId, site, languageId, pageMode, user); + final List typeVarNames = findPageContainersContentTypesVarnamesByPathOrId(pagePathOrId, site, + languageId, pageMode, user, filter); final Map extraParams = new HashMap<>(); if (null != siteId) { @@ -1746,7 +1747,8 @@ private List findPageContainersContentTypesVarnamesByPathOrId(final Stri final Host site, final long languageId, final PageMode pageMode, - final User user) throws DotDataException, DotSecurityException { + final User user, + final String filter) throws DotDataException, DotSecurityException { Logger.debug(this, ()-> "Getting Content Types for page: " + pagePathOrId + " in site: " + (Objects.nonNull(site) ? site.getHostname() : "null") + @@ -1777,7 +1779,10 @@ private List findPageContainersContentTypesVarnamesByPathOrId(final Stri // Retrieves the containers associated to the page, then extracts the content types for each container filtering the ones do not allowed return new PageRenderUtil(htmlPage, user, pageMode, languageId, site) .getContainersRaw().stream().map(containerRaw -> containerRaw.getContainerStructures()) - .flatMap(Collection::stream).map(ContainerStructure::getContentTypeVar) - .filter(Predicate.not(this.contentPaletteHiddenTypes.get()::contains)).collect(Collectors.toList()); - } + .flatMap(Collection::stream) + .map(ContainerStructure::getContentTypeVar) + .filter(Predicate.not(this.contentPaletteHiddenTypes.get()::contains)) + .filter(varname -> filter == null || varname.toLowerCase().contains(filter.toLowerCase())) + .collect(Collectors.toList()); + } // findPageContainersContentTypesVarnamesByPathOrId } From 32c02de917c2efb19920fb639e86bfae772804fd Mon Sep 17 00:00:00 2001 From: jdotcms Date: Fri, 13 Jun 2025 15:41:16 -0600 Subject: [PATCH 03/24] #32238 adding final fixes after smoke qa, just about to do the postman test --- .../com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java b/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java index 0c2f5cc87fe6..a1c9c4c3136c 100644 --- a/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java +++ b/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java @@ -37,9 +37,7 @@ import com.dotmarketing.business.PermissionAPI; import com.dotmarketing.exception.DotDataException; import com.dotmarketing.exception.DotSecurityException; -import com.dotmarketing.portlets.contentlet.model.Contentlet; import com.dotmarketing.portlets.contentlet.model.ContentletVersionInfo; -import com.dotmarketing.portlets.htmlpageasset.business.render.ContainerRaw; import com.dotmarketing.portlets.htmlpageasset.model.IHTMLPage; import com.dotmarketing.portlets.workflows.business.WorkflowAPI; import com.dotmarketing.portlets.workflows.model.SystemActionWorkflowActionMapping; From ef0e62a36b9ce9de0097048f032b367d5b33fbac Mon Sep 17 00:00:00 2001 From: jdotcms Date: Wed, 18 Jun 2025 11:48:21 -0600 Subject: [PATCH 04/24] #32238 adding postmans --- .../postman/ContentTypeResourceTests.json | 5802 +++++------------ 1 file changed, 1552 insertions(+), 4250 deletions(-) diff --git a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json index c493aa5937da..0282b9443752 100644 --- a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json +++ b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json @@ -1,9 +1,9 @@ { "info": { - "_postman_id": "173bf579-93b9-497b-baee-8f9c48e58b71", + "_postman_id": "4eaa447a-cad4-46a5-ba2d-0cd107dfbc79", "name": "ContentType Resource", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "36604690" + "_exporter_id": "781456" }, "item": [ { @@ -20,7 +20,7 @@ "", "pm.collectionVariables.set(\"contentTypeID\", jsonData.entity[0].id);", "pm.collectionVariables.set(\"contentTypeVAR\", jsonData.entity[0].variable);", - "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[2].id);", + "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[0].id);", "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", @@ -34,8 +34,7 @@ " pm.expect(jsonData.entity[0].sortOrder).to.eql(3);", "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], @@ -380,547 +379,157 @@ "name": "Test CRUD Fields", "item": [ { - "name": "Filtering Fields", - "item": [ + "name": "Create ContentType", + "event": [ { - "name": "Generate Test Data", - "item": [ + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.collectionVariables.set(\"contentTypeID\", jsonData.entity[0].id);", + "pm.collectionVariables.set(\"contentTypeVAR\", jsonData.entity[0].variable);", + "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[0].id);", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"fields check\", function () {", + " pm.expect(jsonData.entity[0].fields.length).to.eql(2);", + "});", + "", + "pm.test(\"description check\", function () {", + " pm.expect(jsonData.entity[0].description).to.eql('THE DESCRIPTION');", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "name": "Create Test Content Type", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.collectionVariables.set(\"typeNameWithMetadata\", \"test-type-\" + \"{{$randomInt}}\");" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Test Content Type was created successfully\", function () {", - " const jsonData = pm.response.json();", - " const entity = jsonData.entity[0];", - " pm.expect(jsonData.errors.length).to.eql(0);", - " pm.collectionVariables.set(\"contentTypeId\", entity.id);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"defaultType\": false,\n \"icon\": null,\n \"fixed\": false,\n \"system\": false,\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\": \"\",\n \"host\": \"48190c8c-42c4-46af-8d1a-0cd5db894797\",\n \"name\": \"My Test CT\",\n \"metadata\": {\n \"edit_mode\": true\n },\n \"systemActionMappings\": {\n \"NEW\": \"\"\n },\n \"workflow\": [\n \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - } - }, - "response": [] + "key": "password", + "value": "admin", + "type": "string" }, { - "name": "Add Fields to Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Test Content Type Fields were created successfully\", function () {", - " const jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"layout\": [\n {\n \"divider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"iDate\": 1705078587000,\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1705078587000,\n \"name\": \"Row Field\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": -1,\n \"unique\": false\n },\n \"columns\": [\n {\n \"columnDivider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"iDate\": 1705078587000,\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1705078587000,\n \"name\": \"Column Field\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": -1,\n \"unique\": false\n },\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"name\": \"Title\",\n \"dataType\": \"TEXT\",\n \"regexCheck\": \"\",\n \"defaultValue\": \"\",\n \"hint\": \"\",\n \"required\": true,\n \"searchable\": true,\n \"listed\": true,\n \"unique\": false,\n \"id\": null\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"name\": \"Description\",\n \"dataType\": \"TEXT\",\n \"regexCheck\": \"\",\n \"defaultValue\": \"\",\n \"hint\": \"\",\n \"required\": false,\n \"searchable\": true,\n \"listed\": false,\n \"unique\": false,\n \"id\": null\n }\n ]\n }\n ]\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/move", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v3", - "contenttype", - "{{contentTypeId}}", - "fields", - "move" - ] - } - }, - "response": [] - } - ], - "event": [ + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } + "key": "saveHelperData", + "type": "any" }, { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "pm.test(\"HTTP Status code must be successful\", function () {", - " pm.response.to.have.status(200);", - "});", - "" - ] - } + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\", \n \"defaultType\": false, \n \"name\": \"Test Content Type\", \n \"description\": \"THE DESCRIPTION\", \n \"host\": \"SYSTEM_HOST\", \n \"owner\": \"dotcms.org.1\", \n \"fixed\": false, \n \"system\": false, \n \"folder\": \"SYSTEM_FOLDER\",\n \"fields\": [\n {\n \"dataType\": \"SYSTEM\",\n \"dbColumn\": \"system_field1\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Host/Folder\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n },\n {\n \"dataType\": \"LONG_TEXT\",\n \"dbColumn\": \"text_area2\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1453474468000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTagField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Tags\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"tags\"\n }],\n \"workflow\": [\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}\n" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ { - "name": "Success", - "item": [ + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "", + "pm.test(\"fields check\", function () {", + " pm.expect(jsonData.entity.fields.length).to.eql(2);", + "});", + "", + "pm.test(\"description check\", function () {", + " pm.expect(jsonData.entity.description).to.eql('THE DESCRIPTION');", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "name": "Filter By Required Fields", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Data was returned successfully\", function () {", - " const jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});", - "", - "pm.test(\"There must be only one 'Required' field\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.equal(1, \"Just one field must be marked as 'Required'\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=REQUIRED", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v3", - "contenttype", - "{{contentTypeId}}", - "fields", - "allfields" - ], - "query": [ - { - "key": "filter", - "value": "REQUIRED" - } - ] - } - }, - "response": [] + "key": "password", + "value": "admin", + "type": "string" }, { - "name": "Filter By Indexed Fields", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Data was returned successfully\", function () {", - " const jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});", - "", - "pm.test(\"There must be two 'System Indexed' fields\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.equal(2, \"Two fields must be marked as 'System Indexed'\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=SYSTEM_INDEXED", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v3", - "contenttype", - "{{contentTypeId}}", - "fields", - "allfields" - ], - "query": [ - { - "key": "filter", - "value": "SYSTEM_INDEXED" - } - ] - } - }, - "response": [] - }, - { - "name": "Filter By Several Criteria", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Data was returned successfully\", function () {", - " const jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});", - "", - "pm.test(\"There must be only one 'Required', 'User Searchable', and 'Show in List' field\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.equal(1, \"Just one field must be marked as 'Required', 'User Searchable', and 'Show in List' field\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=REQUIRED&filter=USER_SEARCHABLE&filter=SHOW_IN_LIST", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v3", - "contenttype", - "{{contentTypeId}}", - "fields", - "allfields" - ], - "query": [ - { - "key": "filter", - "value": "REQUIRED" - }, - { - "key": "filter", - "value": "USER_SEARCHABLE" - }, - { - "key": "filter", - "value": "SHOW_IN_LIST" - } - ] - } - }, - "response": [] + "key": "username", + "value": "admin@dotcms.com", + "type": "string" }, { - "name": "Filter By Non-met Criteria", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Data was returned successfully\", function () {", - " const jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});", - "", - "pm.test(\"No field must match 'Required', 'User Searchable', 'Show in List' and 'Unique'\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.equal(0, \"No field must match the four specified filters\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=REQUIRED&filter=USER_SEARCHABLE&filter=SHOW_IN_LIST&filter=UNIQUE", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v3", - "contenttype", - "{{contentTypeId}}", - "fields", - "allfields" - ], - "query": [ - { - "key": "filter", - "value": "REQUIRED" - }, - { - "key": "filter", - "value": "USER_SEARCHABLE" - }, - { - "key": "filter", - "value": "SHOW_IN_LIST" - }, - { - "key": "filter", - "value": "UNIQUE" - } - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } + "key": "saveHelperData", + "type": "any" }, { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "pm.test(\"HTTP Status code must be successful\", function () {", - " pm.response.to.have.status(200);", - "});", - "" - ] - } + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, - { - "name": "Failure", - "item": [ - { - "name": "Log User out", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/dotAdmin/logout", - "host": [ - "{{serverURL}}" - ], - "path": [ - "dotAdmin", - "logout" - ] - }, - "description": "This request just makes sure that the next request does NOT have an authenticated User." - }, - "response": [] - }, - { - "name": "No Authentication", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 'Unauthorized'\", function () {", - " pm.response.to.have.status(401);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=REQUIRED", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v3", - "contenttype", - "{{contentTypeId}}", - "fields", - "allfields" - ], - "query": [ - { - "key": "filter", - "value": "REQUIRED" - } - ] - } - }, - "response": [] - }, - { - "name": "Using Invalid Filter", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 'Bad Request'\", function () {", - " pm.response.to.have.status(400);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=INVALID_FILTER", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v3", - "contenttype", - "{{contentTypeId}}", - "fields", - "allfields" - ], - "query": [ - { - "key": "filter", - "value": "INVALID_FILTER" - } - ] - } - }, - "response": [] - }, - { - "name": "Using Invalid Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 'Not Found'\", function () {", - " pm.response.to.have.status(404);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v3/contenttype/INVALID_CONTENT_TYPE/fields/allfields?filter=REQUIRED", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v3", - "contenttype", - "INVALID_CONTENT_TYPE", - "fields", - "allfields" - ], - "query": [ - { - "key": "filter", - "value": "REQUIRED" - } - ] - } - }, - "response": [] - } + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeID}}" ] - } - ] + }, + "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." + }, + "response": [] }, { - "name": "Create ContentType", + "name": "Update Content Type without sending variable success", "event": [ { "listen": "test", @@ -928,24 +537,19 @@ "exec": [ "var jsonData = pm.response.json();", "", - "pm.collectionVariables.set(\"contentTypeID\", jsonData.entity[0].id);", - "pm.collectionVariables.set(\"contentTypeVAR\", jsonData.entity[0].variable);", - "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[2].id);", - "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"fields check\", function () {", - " pm.expect(jsonData.entity[0].fields.length).to.eql(4);", + " pm.expect(jsonData.entity.fields.length).to.eql(3);", "});", "", "pm.test(\"description check\", function () {", - " pm.expect(jsonData.entity[0].description).to.eql('THE DESCRIPTION');", + " pm.expect(jsonData.entity.description).to.eql('THE DESCRIPTION');", "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], @@ -974,56 +578,46 @@ } ] }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\", \n \"defaultType\": false, \n \"name\": \"Test Content Type\", \n \"description\": \"THE DESCRIPTION\", \n \"host\": \"SYSTEM_HOST\", \n \"owner\": \"dotcms.org.1\", \n \"fixed\": false, \n \"system\": false, \n \"folder\": \"SYSTEM_FOLDER\",\n \"fields\": [\n {\n \"dataType\": \"SYSTEM\",\n \"dbColumn\": \"system_field1\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Host/Folder\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n },\n {\n \"dataType\": \"LONG_TEXT\",\n \"dbColumn\": \"text_area2\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1453474468000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTagField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Tags\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"tags\"\n }],\n \"workflow\": [\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}\n" + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"THE DESCRIPTION\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"contentTypeId\": \"{{contentTypeID}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Host-Folder\",\n \"fieldTypeLabel\": \"Site or Folder\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"id\": \"{{contentTypeFieldID}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1632506750000,\n \"name\": \"Host/Folder CHANGED\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n }\n ],\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"Test Content Type\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeID}}" ] }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." }, "response": [] }, { - "name": "Get Content Type", + "name": "Delete ContentType", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", - "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "", - "pm.test(\"fields check\", function () {", - " pm.expect(jsonData.entity.fields.length).to.eql(4);", - "});", - "", - "pm.test(\"description check\", function () {", - " pm.expect(jsonData.entity.description).to.eql('THE DESCRIPTION');", "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], @@ -1052,7 +646,7 @@ } ] }, - "method": "GET", + "method": "DELETE", "header": [], "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", @@ -1067,29 +661,33 @@ "{{contentTypeID}}" ] }, - "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." + "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." }, "response": [] - }, + } + ] + }, + { + "name": "Tests For New StoryBlockField", + "item": [ { - "name": "Update Content Type without sending variable success", + "name": "Create ContentType with StoryBlockField Success", "event": [ { "listen": "test", "script": { "exec": [ "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", + "var contentType = jsonData.entity[0];", + "pm.collectionVariables.set(\"contentTypeIdWithStoryBlock\", contentType.id);", + "pm.test(\"Status code should be 200\", function() {", " pm.response.to.have.status(200);", "});", - "", - "pm.test(\"fields check\", function () {", - " pm.expect(jsonData.entity.fields.length).to.eql(3);", + "pm.test(\"Content Type should have 2 fields\", function() {", + " pm.expect(contentType.fields.length).to.eql(2);", "});", - "", - "pm.test(\"description check\", function () {", - " pm.expect(jsonData.entity.description).to.eql('THE DESCRIPTION');", + "pm.test(\"Content Type has a Story_block_field\", function() {", + " pm.expect(contentType.fields[1].fieldType).to.eql(\"Story-Block\");", "});" ], "type": "text/javascript" @@ -1121,11 +719,11 @@ } ] }, - "method": "PUT", + "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"THE DESCRIPTION\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"contentTypeId\": \"{{contentTypeID}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Host-Folder\",\n \"fieldTypeLabel\": \"Site or Folder\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"id\": \"{{contentTypeFieldID}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1632506750000,\n \"name\": \"Host/Folder CHANGED\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n }\n ],\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"Test Content Type\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", + "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"system\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"\",\n \"host\": \"SYSTEM_HOST\",\n \"folder\":\"SYSTEM_FOLDER\",\n \"name\":\"TestContentTypeWithStoryBlockField\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t},\n {\n \"clazz\":\"com.dotcms.contenttype.model.field.ImmutableStoryBlockField\",\n \"required\":false,\n \"name\":\"block\",\n \"defaultValue\":\"\",\n \"hint\":\"\",\n \"searchable\":true\n }\n ]\n}", "options": { "raw": { "language": "json" @@ -1133,31 +731,33 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeID}}" + "contenttype" ] }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." + "description": "Creates a contentType with 2 fields:\n- A text field named Title\n- A story block field named block" }, "response": [] }, { - "name": "Delete ContentType", + "name": "Create contentlet with StoryBlockField", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", + "var jsonData = pm.response.json();", + "pm.test(\"Status code should be 200\", function() {", " pm.response.to.have.status(200);", + "});", + "pm.test(\"Contentlet StoryBlock has value\", function() {", + " pm.expect(jsonData.entity.block.content[0].content[0].text).contains(\"Wow, this editor instance exports its content as JSON\");", "});" ], "type": "text/javascript" @@ -1189,47 +789,52 @@ } ] }, - "method": "DELETE", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"contentlet\": {\n \"contentType\": \"{{contentTypeIdWithStoryBlock}}\",\n \"name\": \"test with data block field\",\n \"title\": \"test with data block field\",\n \"block\": \"{\\\"type\\\": \\\"doc\\\",\\\"content\\\": [{\\\"type\\\": \\\"paragraph\\\",\\\"content\\\": [{\\\"type\\\": \\\"text\\\",\\\"text\\\": \\\"Wow, this editor instance exports its content as JSON.\\\"}]}]}\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeID}}" + "workflow", + "actions", + "default", + "fire", + "PUBLISH" ] - }, - "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." + } }, "response": [] - }, + } + ] + }, + { + "name": "Test Get ContentTypes", + "item": [ { - "name": "Create ContentType Unsupported Media Type", + "name": "Get ContentTypes sending HostID", "event": [ { "listen": "test", "script": { "exec": [ - "// Validate the response status is 415", - "pm.test(\"Response status is 415\", function () {", - " pm.response.to.have.status(415);", - "});", - "", - "// Validate that the response body contains the 'message' property and it is not empty", - "pm.test(\"Response should have an error message\", function () {", - " const responseBody = pm.response.json();", - " pm.expect(responseBody).to.have.property('message').that.is.not.empty;", - " pm.expect(responseBody.message).to.equal('HTTP 415 Unsupported Media Type');", - "});", - "" + "pm.test(\"Status code should be 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], @@ -1258,19 +863,10 @@ } ] }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/javascript" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\", \n \"defaultType\": false, \n \"name\": \"Test Content Type\", \n \"description\": \"THE DESCRIPTION\", \n \"host\": \"SYSTEM_HOST\", \n \"owner\": \"dotcms.org.1\", \n \"fixed\": false, \n \"system\": false, \n \"folder\": \"SYSTEM_FOLDER\",\n \"fields\": [\n {\n \"dataType\": \"SYSTEM\",\n \"dbColumn\": \"system_field1\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Host/Folder\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n },\n {\n \"dataType\": \"LONG_TEXT\",\n \"dbColumn\": \"text_area2\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1453474468000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTagField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Tags\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"tags\"\n }],\n \"workflow\": [\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}\n" - }, + "method": "GET", + "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype?host=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d", "host": [ "{{serverURL}}" ], @@ -1278,268 +874,119 @@ "api", "v1", "contenttype" + ], + "query": [ + { + "key": "host", + "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d" + } ] - }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." + } }, "response": [] }, { - "name": "Filter ContentType Unsupported Media Type", + "name": "Get ContentTypes sending SYSTEM_HOST", "event": [ { "listen": "test", "script": { "exec": [ - "// Validate the response status is 415", - "pm.test(\"Response status is 415\", function () {", - " pm.response.to.have.status(415);", - "});", + "var jsonData = pm.response.json();", "", - "// Validate that the response body contains the 'message' property and it is not empty", - "pm.test(\"Response should have an error message\", function () {", - " const responseBody = pm.response.json();", - " pm.expect(responseBody).to.have.property('message').that.is.not.empty;", - " pm.expect(responseBody.message).to.equal('HTTP 415 Unsupported Media Type');", + "pm.test(\"Amount of ContentTypes could be greather or eql than 10\", function () {", + " pm.expect(jsonData.entity.length).to.be.gte(10);", "});", - "" + "", + "pm.test(\"Status code should be 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/javascript" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\", \n \"defaultType\": false, \n \"name\": \"Test Content Type\", \n \"description\": \"THE DESCRIPTION\", \n \"host\": \"SYSTEM_HOST\", \n \"owner\": \"dotcms.org.1\", \n \"fixed\": false, \n \"system\": false, \n \"folder\": \"SYSTEM_FOLDER\",\n \"fields\": [\n {\n \"dataType\": \"SYSTEM\",\n \"dbColumn\": \"system_field1\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Host/Folder\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n },\n {\n \"dataType\": \"LONG_TEXT\",\n \"dbColumn\": \"text_area2\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1453474468000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTagField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Tags\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"tags\"\n }],\n \"workflow\": [\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}\n" - }, + "method": "GET", + "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "raw": "{{serverURL}}/api/v1/contenttype?host=SYSTEM_HOST", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "_filter" + "contenttype" + ], + "query": [ + { + "key": "host", + "value": "SYSTEM_HOST" + } ] - }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." + } }, "response": [] }, { - "name": "Update Content Type Unsupported Media Type", + "name": "Get ContentTypes without any param", "event": [ { "listen": "test", "script": { "exec": [ - "// Validate the response status is 415", - "pm.test(\"Response status is 415\", function () {", - " pm.response.to.have.status(415);", - "});", + "var jsonData = pm.response.json();", "", - "// Validate that the response body contains the 'message' property and it is not empty", - "pm.test(\"Response should have an error message\", function () {", - " const responseBody = pm.response.json();", - " pm.expect(responseBody).to.have.property('message').that.is.not.empty;", - " pm.expect(responseBody.message).to.equal('HTTP 415 Unsupported Media Type');", + "pm.test(\"Amount of ContentTypes could be greather or eql than 10\", function () {", + " pm.expect(jsonData.entity.length).to.be.gte(10);", "});", - "" + "", + "pm.test(\"Status code should be 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], - "protocolProfileBehavior": { - "disabledSystemHeaders": { - "content-type": true + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] } }, - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/javascript", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"THE DESCRIPTION\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"contentTypeId\": \"{{contentTypeID}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Host-Folder\",\n \"fieldTypeLabel\": \"Site or Folder\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"id\": \"{{contentTypeFieldID}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1632506750000,\n \"name\": \"Host/Folder CHANGED\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n }\n ],\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"Test Content Type\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeID}}" - ] - }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." - }, "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } }, { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Tests For New StoryBlockField", - "item": [ - { - "name": "Create ContentType with StoryBlockField Success", + "name": "Get ContentTypes sending not existing hostID", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", - "var contentType = jsonData.entity[0];", - "pm.collectionVariables.set(\"contentTypeIdWithStoryBlock\", contentType.id);", - "pm.test(\"Status code should be 200\", function() {", + "pm.test(\"Status code should be 200\", function () {", " pm.response.to.have.status(200);", - "});", - "pm.test(\"Content Type should have 4 fields\", function() {", - " pm.expect(contentType.fields.length).to.eql(4);", - "});", - "pm.test(\"Content Type has a Story_block_field\", function() {", - " pm.expect(contentType.fields[3].fieldType).to.eql(\"Story-Block\");", "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"system\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"\",\n \"host\": \"SYSTEM_HOST\",\n \"folder\":\"SYSTEM_FOLDER\",\n \"name\":\"TestContentTypeWithStoryBlockField\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t},\n {\n \"clazz\":\"com.dotcms.contenttype.model.field.ImmutableStoryBlockField\",\n \"required\":false,\n \"name\":\"block\",\n \"defaultValue\":\"\",\n \"hint\":\"\",\n \"searchable\":true\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype?host=aaaaa-aaaa-aaaa-aaaaaa", "host": [ "{{serverURL}}" ], @@ -1547,26 +994,33 @@ "api", "v1", "contenttype" + ], + "query": [ + { + "key": "host", + "value": "aaaaa-aaaa-aaaa-aaaaaa" + } ] - }, - "description": "Creates a contentType with 2 fields:\n- A text field named Title\n- A story block field named block" + } }, "response": [] }, { - "name": "Create contentlet with StoryBlockField", + "name": "Get existing Base Content Type", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", - "pm.test(\"Status code should be 200\", function() {", + "pm.test(\"HTTP Status code must be 200\", function () {", " pm.response.to.have.status(200);", "});", - "pm.test(\"Contentlet StoryBlock has value\", function() {", - " pm.expect(jsonData.entity.block.content[0].content[0].text).contains(\"Wow, this editor instance exports its content as JSON\");", - "});" + "", + "pm.test(\"Checking that there are at least 1 Content Type of Base Type 'dotAsset'\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.gte(1, \"There MUST be at least one Content Type of Base Type 'dotAsset'\");", + "});", + "" ], "type": "text/javascript" } @@ -1576,71 +1030,61 @@ "auth": { "type": "basic", "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, { "key": "username", "value": "admin@dotcms.com", "type": "string" }, { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" + "key": "password", + "value": "admin", + "type": "string" } ] }, - "method": "PUT", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"contentlet\": {\n \"contentType\": \"{{contentTypeIdWithStoryBlock}}\",\n \"name\": \"test with data block field\",\n \"title\": \"test with data block field\",\n \"block\": \"{\\\"type\\\": \\\"doc\\\",\\\"content\\\": [{\\\"type\\\": \\\"paragraph\\\",\\\"content\\\": [{\\\"type\\\": \\\"text\\\",\\\"text\\\": \\\"Wow, this editor instance exports its content as JSON.\\\"}]}]}\"\n }\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "raw": "{{serverURL}}/api/v1/contenttype?type=DOTASSET&orderby=name", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "workflow", - "actions", - "default", - "fire", - "PUBLISH" + "contenttype" + ], + "query": [ + { + "key": "type", + "value": "DOTASSET" + }, + { + "key": "orderby", + "value": "name" + } ] - } + }, + "description": "Returns all Content Types whose Base Type is 'dotAsset'. **There must be AT LEAST one Content Type of such a Base Type.**" }, "response": [] - } - ] - }, - { - "name": "Test Get ContentTypes", - "item": [ + }, { - "name": "Get ContentTypes sending HostID", + "name": "Get non-existing Base Content Type", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 200\", function () {", - " pm.response.to.have.status(200);", - "});" + "pm.test(\"HTTP Status code must be 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Checking that the error message is present\", function () {", + " const message = pm.response.json().message;", + " pm.expect(message).to.contain(\"FORM2\", \"The returned error message may not be\")", + "});", + "" ], "type": "text/javascript" } @@ -1650,31 +1094,22 @@ "auth": { "type": "basic", "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, { "key": "username", "value": "admin@dotcms.com", "type": "string" }, { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" + "key": "password", + "value": "admin", + "type": "string" } ] }, "method": "GET", "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype?host=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d", + "raw": "{{serverURL}}/api/v1/contenttype?filter=filter&page=3&per_page=4&type=FORM2&orderby=name", "host": [ "{{serverURL}}" ], @@ -1685,355 +1120,112 @@ ], "query": [ { - "key": "host", - "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d" + "key": "filter", + "value": "filter" + }, + { + "key": "page", + "value": "3" + }, + { + "key": "per_page", + "value": "4" + }, + { + "key": "type", + "value": "FORM2" + }, + { + "key": "orderby", + "value": "name" } ] - } + }, + "description": "Requesting an invalid Base Content Type will return an error message and an HTTP Status 400." }, "response": [] - }, - { - "name": "Get ContentTypes sending SYSTEM_HOST", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Amount of ContentTypes could be greather or eql than 10\", function () {", - " pm.expect(jsonData.entity.length).to.be.gte(10);", - "});", - "", - "pm.test(\"Status code should be 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?host=SYSTEM_HOST", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ], - "query": [ - { - "key": "host", - "value": "SYSTEM_HOST" - } - ] - } - }, - "response": [] - }, - { - "name": "Get ContentTypes without any param", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Amount of ContentTypes could be greather or eql than 10\", function () {", - " pm.expect(jsonData.entity.length).to.be.gte(10);", - "});", - "", - "pm.test(\"Status code should be 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - } - }, - "response": [] - }, - { - "name": "Get ContentTypes sending not existing hostID", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?host=aaaaa-aaaa-aaaa-aaaaaa", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ], - "query": [ - { - "key": "host", - "value": "aaaaa-aaaa-aaaa-aaaaaa" - } - ] - } - }, - "response": [] - }, + } + ] + }, + { + "name": "Test ContentType With Field Variables", + "item": [ { - "name": "Get existing Base Content Type", - "event": [ + "name": "Create Test Data", + "item": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there are at least 1 Content Type of Base Type 'dotAsset'\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.gte(1, \"There MUST be at least one Content Type of Base Type 'dotAsset'\");", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Create ContentType with field variables", + "event": [ { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "var contentType = jsonData.entity[0];", + "pm.collectionVariables.set(\"contentTypeId\", contentType.id);", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200);", + "});", + "pm.test(\"Content Type has the provided name\", function() {", + " pm.expect(contentType.name).to.eql(\"WYSIWYG-Content\");", + "});", + "pm.test(\"Content Type should have 4 fields\", function() {", + " pm.expect(contentType.fields.length).to.eql(4);", + "});", + "pm.collectionVariables.set(\"contentType.host\", contentType.host);", + "pm.collectionVariables.set(\"contentType.field1\", contentType.fields[0].id);", + "pm.collectionVariables.set(\"contentType.field2\", contentType.fields[1].id);", + "pm.collectionVariables.set(\"contentType.field3\", contentType.fields[2].id);", + "pm.collectionVariables.set(\"contentType.field4\", contentType.fields[3].id);", + "pm.collectionVariables.set(\"contentType.field4.varName\", contentType.fields[3].variable);", + "pm.collectionVariables.set(\"contentType.divider\", contentType.layout[0].divider.id);", + "pm.collectionVariables.set(\"contentType.columnDivider\", contentType.layout[0].columns[0].columnDivider.id);", + "var wysigygField = contentType.fields[3];", + "var secondVar = wysigygField.fieldVariables[1];", + "pm.test(\"Variable should have its key and value with hello:world\", function() {", + " pm.expect(secondVar.key).to.eql(\"hello\");", + " pm.expect(secondVar.value).to.eql(\"world\");", + "});", + "pm.test(\"WYSIWYG must exist and have 3 variables\", function() {", + " pm.expect(wysigygField.fieldType).to.eql(\"WYSIWYG\");", + " pm.expect(wysigygField.fieldVariables.length).to.eql(3);", + "});", + "var tinyMcePropsVar = wysigygField.fieldVariables[2];", + "pm.test(\"WYSIWYG tinymceoprops variable is present with value\", function() {", + " pm.expect(tinyMcePropsVar.key).to.eql(\"tinymceprops\");", + " pm.expect(tinyMcePropsVar.value).to.eql(\"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "password", - "value": "admin", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?type=DOTASSET&orderby=name", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype" - ], - "query": [ - { - "key": "type", - "value": "DOTASSET" - }, - { - "key": "orderby", - "value": "name" - } - ] - }, - "description": "Returns all Content Types whose Base Type is 'dotAsset'. **There must be AT LEAST one Content Type of such a Base Type.**" - }, - "response": [] - }, - { - "name": "Get non-existing Base Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 400\", function () {", - " pm.response.to.have.status(400);", - "});", - "", - "pm.test(\"Checking that the error message is present\", function () {", - " const message = pm.response.json().message;", - " pm.expect(message).to.contain(\"FORM2\", \"The returned error message may not be\")", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "password", - "value": "admin", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?filter=filter&page=3&per_page=4&type=FORM2&orderby=name", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ], - "query": [ - { - "key": "filter", - "value": "filter" - }, - { - "key": "page", - "value": "3" - }, - { - "key": "per_page", - "value": "4" - }, - { - "key": "type", - "value": "FORM2" - }, - { - "key": "orderby", - "value": "name" - } - ] - }, - "description": "Requesting an invalid Base Content Type will return an error message and an HTTP Status 400." - }, - "response": [] - } - ] - }, - { - "name": "Test ContentType With Field Variables", - "item": [ - { - "name": "Create Test Data", - "item": [ - { - "name": "Create ContentType with field variables", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "var contentType = jsonData.entity[0];", - "pm.collectionVariables.set(\"contentTypeId\", contentType.id);", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200);", - "});", - "pm.test(\"Content Type has the provided name\", function() {", - " pm.expect(contentType.name).to.eql(\"WYSIWYG-Content\");", - "});", - "pm.test(\"Content Type should have 4 fields\", function() {", - " pm.expect(contentType.fields.length).to.eql(4);", - "});", - "pm.collectionVariables.set(\"contentType.host\", contentType.host);", - "pm.collectionVariables.set(\"contentType.field1\", contentType.fields[0].id);", - "pm.collectionVariables.set(\"contentType.field2\", contentType.fields[1].id);", - "pm.collectionVariables.set(\"contentType.field3\", contentType.fields[2].id);", - "pm.collectionVariables.set(\"contentType.field4\", contentType.fields[3].id);", - "pm.collectionVariables.set(\"contentType.field4.varName\", contentType.fields[3].variable);", - "pm.collectionVariables.set(\"contentType.divider\", contentType.layout[0].divider.id);", - "pm.collectionVariables.set(\"contentType.columnDivider\", contentType.layout[0].columns[0].columnDivider.id);", - "var wysigygField = contentType.fields[3];", - "var secondVar = wysigygField.fieldVariables[1];", - "pm.test(\"Variable should have its key and value with hello:world\", function() {", - " pm.expect(secondVar.key).to.eql(\"hello\");", - " pm.expect(secondVar.value).to.eql(\"world\");", - "});", - "pm.test(\"WYSIWYG must exist and have 3 variables\", function() {", - " pm.expect(wysigygField.fieldType).to.eql(\"WYSIWYG\");", - " pm.expect(wysigygField.fieldVariables.length).to.eql(3);", - "});", - "var tinyMcePropsVar = wysigygField.fieldVariables[2];", - "pm.test(\"WYSIWYG tinymceoprops variable is present with value\", function() {", - " pm.expect(tinyMcePropsVar.key).to.eql(\"tinymceprops\");", - " pm.expect(tinyMcePropsVar.value).to.eql(\"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "password", - "value": "admin", - "type": "string" - } - ] + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "password", + "value": "admin", + "type": "string" + } + ] }, "method": "POST", "header": [ @@ -3720,85 +2912,6 @@ } }, "response": [] - }, - { - "name": "Copy FileAsset Unsupported Media Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Validate the response status is 415", - "pm.test(\"Response status is 415\", function () {", - " pm.response.to.have.status(415);", - "});", - "", - "// Validate that the response body contains the 'message' property and it is not empty", - "pm.test(\"Response should have an error message\", function () {", - " const responseBody = pm.response.json();", - " pm.expect(responseBody).to.have.property('message').that.is.not.empty;", - " pm.expect(responseBody.message).to.equal('HTTP 415 Unsupported Media Type');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "protocolProfileBehavior": { - "disabledSystemHeaders": { - "content-type": true - } - }, - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/javascript", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"File Asset Copy\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "fileAsset", - "_copy" - ] - } - }, - "response": [] } ] }, @@ -4920,7 +4033,7 @@ "", "pm.collectionVariables.set(\"contentTypeID\", jsonData.entity[0].id);", "pm.collectionVariables.set(\"contentTypeVAR\", jsonData.entity[0].variable);", - "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[2].id);", + "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[0].id);", "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", @@ -4931,11 +4044,10 @@ "});", "", "pm.test(\"Fields check\", function () {", - " pm.expect(jsonData.entity[0].fields.length).to.eql(4);", + " pm.expect(jsonData.entity[0].fields.length).to.eql(2);", "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], @@ -7778,7 +6890,7 @@ " var jsonData = pm.response.json();", " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[2].id);", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", "});" ], "type": "text/javascript", @@ -8519,8 +7631,8 @@ " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", "", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[2].id);", - " pm.collectionVariables.set(\"contentTypeField1Variable\", jsonData.entity[0].fields[2].variable);", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", + " pm.collectionVariables.set(\"contentTypeField1Variable\", jsonData.entity[0].fields[0].variable);", "});" ], "type": "text/javascript", @@ -8574,8 +7686,8 @@ " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", "", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", + " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -8643,7 +7755,7 @@ "description": "This test creates the Content Type with a field with a not existing field id in the body." }, { - "name": "Multiple update permutations", + "name": "Multiple update permutations Copy", "item": [ { "name": "Create ContentType", @@ -8660,8 +7772,8 @@ " var jsonData = pm.response.json();", " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[2].id);", - " pm.collectionVariables.set(\"contentTypeField1Variable\", jsonData.entity[0].fields[2].variable);", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", + " pm.collectionVariables.set(\"contentTypeField1Variable\", jsonData.entity[0].fields[0].variable);", "});" ], "type": "text/javascript", @@ -8715,8 +7827,8 @@ " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", "", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", + " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -8761,8 +7873,8 @@ " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", "", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", + " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -8817,9 +7929,9 @@ " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", "", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", - " pm.expect(jsonData.entity.fields[2].contentTypeId).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", + " pm.expect(jsonData.entity.fields[0].contentTypeId).to.eql(contentTypeId);", "});" ], "type": "text/javascript", @@ -8873,8 +7985,8 @@ " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", "", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", + " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -8928,8 +8040,8 @@ " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", "", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", + " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -8983,8 +8095,8 @@ " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", "", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", + " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -9038,8 +8150,8 @@ " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", "", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", + " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -9898,7 +9010,7 @@ " var jsonData = pm.response.json();", " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[2].id);", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", "});", "", "pm.test(\"Validate response\", function () {", @@ -11262,3018 +10374,1102 @@ "api", "v1", "workflow", - "schemes", - "{{schemeId}}" - ] - } - }, - "response": [] - } - ], - "description": "Covering different save scenarios for saving workflows in a content type.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Update", - "item": [ - { - "name": "Create Scheme", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200 \", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing workflow data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"schemeId\", jsonData.entity.id);", - " pm.collectionVariables.set(\"schemeName\", jsonData.entity.name);", - " pm.collectionVariables.set(\"schemeVariableName\", jsonData.entity.variableName);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\"schemeName\": \"Test Schema {{$timestamp}}\", \"schemeDescription\": \"Test sechema\", \"schemeArchived\": \"false\"}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "schemes" - ] - }, - "description": "Creates a test scheme" - }, - "response": [] - }, - { - "name": "Create ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[2].id);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a content type with a workflow using an id and variable name." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - } - }, - "response": [] - }, - { - "name": "Update Content Type with workflow id and variable name", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var jsonData = pm.response.json();", - "", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type using a workflow with id and variable name." - }, - "response": [] - }, - { - "name": "Update Content Type with workflow variable name", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var jsonData = pm.response.json();", - "", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type using a workflow with just a variable name." - }, - "response": [] - }, - { - "name": "Update Content Type with workflow id", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var jsonData = pm.response.json();", - "", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type using a workflow with just an id." - }, - "response": [] - }, - { - "name": "Update Content Type with with multiple workflows", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", - " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", - "", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity.workflows;", - " workflows = workflows.sort(compareBy);", - " pm.expect(2).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - " pm.expect(workflows[1].id).to.eql(testSchemeId);", - " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", - "});", - "", - "function compareBy(a, b) {", - " if (a.variableName < b.variableName) { return -1; }", - " if (a.variableName > b.variableName) { return 1; }", - " return 0;", - "}" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n },\n {\n \"id\": \"{{schemeId}}\",\n \"variableName\": \"{{schemeVariableName}}\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type with multiple workflow." - }, - "response": [] - }, - { - "name": "Update Content Type with non existing id but valid variable", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var jsonData = pm.response.json();", - "", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bf12345\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type with a workflow where the id is invalid but with a valid variable name." - }, - "response": [] - }, - { - "name": "Update Content Type with non existing variable but valid id", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var jsonData = pm.response.json();", - "", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"doesNotExit\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type with a workflow where the id valid but with an invalid variable name." - }, - "response": [] - }, - { - "name": "Update Content Type with wrong workflow #1", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"doesNotExist\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Validates the proper error handling when a wrong workflow id is used." - }, - "response": [] - }, - { - "name": "Update Content Type with wrong workflow #2", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"doesNotExist\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Validates the proper error handling when a wrong workflow variable name is used." - }, - "response": [] - }, - { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - } - }, - "response": [] - }, - { - "name": "Archive Scheme", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200 \", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\"schemeName\": \"{{schemeName}}\", \"schemeArchived\": \"true\"}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "schemes", - "{{schemeId}}" - ] - } - }, - "response": [] - }, - { - "name": "Delete Scheme", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200 \", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "schemes", - "{{schemeId}}" - ] - } - }, - "response": [] - } - ], - "description": "Covering different update scenarios for saving workflows in a content type.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - } - ] - } - ], - "description": "The content type allows to pass also a more estructured array of workflows where you can specify the id and variable for each workflow, these tests cases will cover diferent escenarios for this workflows list." - } - ], - "description": "Testing the diferent scenarios for saving workflows in a Content Type", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Layout fields", - "item": [ - { - "name": "Create", - "item": [ - { - "name": "Create ContentType without layout fields", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity[0].fields;", - " pm.expect(3).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity[0].fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Test to validate the layout fields are created even if not layout fields are sent." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(3).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Validates the content type and fields were created as expected." - }, - "response": [] - }, - { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Cleanup" - }, - "response": [] - }, - { - "name": "Create ContentType with layout fields", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity[0].fields;", - " pm.expect(3).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity[0].fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"testContentType{{$timestamp}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fixed\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name\"\n }\n ],\n \"workflow\": [\n \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Test to validate the layout fields are respected when sent in the request." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(3).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Validates the content type and fields were created as expected." - }, - "response": [] - }, - { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Cleanup" - }, - "response": [] - }, - { - "name": "Create ContentType with wrong layout", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity[0].fields;", - " pm.expect(4).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity[0].fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"testContentType{{$timestamp}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 10,\n \"unique\": false\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name\"\n }\n ],\n \"workflow\": [\n \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Test to validate the layout is fixed even if the layout in the body is wrong." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(4).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Validates the content type and fields were created as expected." - }, - "response": [] - }, - { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Cleanup" - }, - "response": [] - } - ], - "description": "Folder to encapsulate multiple tests to validate the proper creation and handling of layout fields." - }, - { - "name": "Update", - "item": [ - { - "name": "Create ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", - " pm.collectionVariables.set(\"contentTypeField1Variable\", jsonData.entity[0].fields[0].variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Simple creation to sep up the data for the update tests." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(3).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Validates the content type and fields were created as expected." - }, - "response": [] - }, - { - "name": "Update fields exceeding maximum columns", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(11).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[7].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[10].clazz);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field4\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 7,\n \"unique\": false,\n \"variable\": \"columnField4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field5\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"columnField5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field6\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 11,\n \"unique\": false,\n \"variable\": \"columnField6\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 12,\n \"unique\": false,\n \"variable\": \"name6\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates the fields exceeding maximum ammounts of columns per row." - }, - "response": [] - }, - { - "name": "Update fields exceeding maximum columns with multiple rows", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(22).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[7].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[10].clazz);", - "", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[11].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[12].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[13].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[14].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[15].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[16].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[17].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[18].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[19].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[20].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[21].clazz); ", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field4\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 7,\n \"unique\": false,\n \"variable\": \"columnField4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field5\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"columnField5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field6\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 11,\n \"unique\": false,\n \"variable\": \"columnField6\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 12,\n \"unique\": false,\n \"variable\": \"name6\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 13,\n \"unique\": false,\n \"variable\": \"rowField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field11\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 14,\n \"unique\": false,\n \"variable\": \"columnField11\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name11\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 15,\n \"unique\": false,\n \"variable\": \"name11\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field22\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 16,\n \"unique\": false,\n \"variable\": \"columnField22\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name22\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 17,\n \"unique\": false,\n \"variable\": \"name22\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field33\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 18,\n \"unique\": false,\n \"variable\": \"columnField33\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name33\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 19,\n \"unique\": false,\n \"variable\": \"name33\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field44\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 20,\n \"unique\": false,\n \"variable\": \"columnField44\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name44\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 21,\n \"unique\": false,\n \"variable\": \"name44\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field55\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 22,\n \"unique\": false,\n \"variable\": \"columnField55\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name55\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 23,\n \"unique\": false,\n \"variable\": \"name55\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field66\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 24,\n \"unique\": false,\n \"variable\": \"columnField66\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name66\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 25,\n \"unique\": false,\n \"variable\": \"name66\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates the fields exceeding maximum ammounts of columns per row." - }, - "response": [] - }, - { - "name": "Update fields validating order is respected", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(11).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields type order\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[7].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[10].clazz);", - "});", - "", - "pm.test(\"Validate fields order\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"rowField1\").to.eql(fields[0].variable);", - " pm.expect(\"columnField1\").to.eql(fields[1].variable);", - " pm.expect(\"name1\").to.eql(fields[2].variable);", - " pm.expect(\"columnField2\").to.eql(fields[3].variable);", - " pm.expect(\"name2\").to.eql(fields[4].variable);", - " pm.expect(\"columnField3\").to.eql(fields[5].variable);", - " pm.expect(\"name3\").to.eql(fields[6].variable);", - " pm.expect(\"columnField4\").to.eql(fields[7].variable);", - " pm.expect(\"name4\").to.eql(fields[8].variable);", - " pm.expect(\"name5\").to.eql(fields[9].variable);", - " pm.expect(\"name6\").to.eql(fields[10].variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field4\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 7,\n \"unique\": false,\n \"variable\": \"columnField4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name6\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates the fields validating the given order is respected." - }, - "response": [] - }, - { - "name": "Update fields changing order", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(11).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields type order\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[7].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[10].clazz);", - "});", - "", - "pm.test(\"Validate fields order\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"rowField1\").to.eql(fields[0].variable);", - " pm.expect(\"columnField1\").to.eql(fields[1].variable);", - " pm.expect(\"name1\").to.eql(fields[2].variable);", - " pm.expect(\"columnField2\").to.eql(fields[3].variable);", - " pm.expect(\"name2\").to.eql(fields[4].variable);", - " pm.expect(\"columnField3\").to.eql(fields[5].variable);", - " pm.expect(\"name3\").to.eql(fields[6].variable);", - " pm.expect(\"columnField4\").to.eql(fields[7].variable);", - " pm.expect(\"name6\").to.eql(fields[8].variable);", - " pm.expect(\"name4\").to.eql(fields[9].variable);", - " pm.expect(\"name5\").to.eql(fields[10].variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field4\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 7,\n \"unique\": false,\n \"variable\": \"columnField4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name6\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates the fields changing the order of the fields" - }, - "response": [] - }, - { - "name": "Update fields changing order again", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(11).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields type order\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[7].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[10].clazz);", - "});", - "", - "pm.test(\"Validate fields order\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"rowField1\").to.eql(fields[0].variable);", - " pm.expect(\"columnField1\").to.eql(fields[1].variable);", - " pm.expect(\"name1\").to.eql(fields[2].variable);", - " pm.expect(\"columnField2\").to.eql(fields[3].variable);", - " pm.expect(\"name3\").to.eql(fields[4].variable);", - " pm.expect(\"columnField3\").to.eql(fields[5].variable);", - " pm.expect(\"name2\").to.eql(fields[6].variable);", - " pm.expect(\"columnField4\").to.eql(fields[7].variable);", - " pm.expect(\"name6\").to.eql(fields[8].variable);", - " pm.expect(\"name4\").to.eql(fields[9].variable);", - " pm.expect(\"name5\").to.eql(fields[10].variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field4\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 7,\n \"unique\": false,\n \"variable\": \"columnField4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name6\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates the fields changing the order of the fields" - }, - "response": [] - }, - { - "name": "Update fields removing column", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(10).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields type order\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[7].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", - "});", - "", - "pm.test(\"Validate fields order\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"rowField1\").to.eql(fields[0].variable);", - " pm.expect(\"columnField1\").to.eql(fields[1].variable);", - " pm.expect(\"name1\").to.eql(fields[2].variable);", - " pm.expect(\"columnField2\").to.eql(fields[3].variable);", - " pm.expect(\"name3\").to.eql(fields[4].variable);", - " pm.expect(\"columnField3\").to.eql(fields[5].variable);", - " pm.expect(\"name2\").to.eql(fields[6].variable);", - " pm.expect(\"name6\").to.eql(fields[7].variable);", - " pm.expect(\"name4\").to.eql(fields[8].variable);", - " pm.expect(\"name5\").to.eql(fields[9].variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name6\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates the fields removing a column an validating the layout is correct." - }, - "response": [] - }, - { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Cleanup" - }, - "response": [] - } - ], - "description": "Folder to encapsulate multiple tests to validate the proper update and handling of layout fields." - } - ], - "description": "Multiple tests validating the proper handling of layout fields when saving content types", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "System Action Mappings", - "item": [ - { - "name": "Create", - "item": [ - { - "name": "Create ContentType without systemActionMappings", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate systemActionMappings is empty\", function () {", - " var systemActionMappings = pm.response.json().entity[0].systemActionMappings;", - " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "schemes", + "{{schemeId}}" + ] + } + }, + "response": [] } ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType1{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Test to validate the content type is created without `systemActionMappings`." - }, - "response": [] - }, - { - "name": "Get Content Type", + "description": "Covering different save scenarios for saving workflows in a content type.", "event": [ { - "listen": "test", + "listen": "prerequest", "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings is empty\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", - "});" - ], "type": "text/javascript", - "packages": {} + "packages": {}, + "exec": [ + "" + ] } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] }, - "description": "Validates the content type and `systemActionMappings` were created as expected." - }, - "response": [] - }, - { - "name": "Delete ContentType", - "event": [ { "listen": "test", "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], "type": "text/javascript", - "packages": {} + "packages": {}, + "exec": [ + "" + ] } } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Cleanup" - }, - "response": [] + ] }, { - "name": "Create ContentType with empty systemActionMappings", - "event": [ + "name": "Update", + "item": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate systemActionMappings is empty\", function () {", - " var systemActionMappings = pm.response.json().entity[0].systemActionMappings;", - " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", - "});" + "name": "Create Scheme", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing workflow data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"schemeId\", jsonData.entity.id);", + " pm.collectionVariables.set(\"schemeName\", jsonData.entity.name);", + " pm.collectionVariables.set(\"schemeVariableName\", jsonData.entity.variableName);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType2{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"systemActionMappings\": {},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + "body": { + "mode": "raw", + "raw": "{\"schemeName\": \"Test Schema {{$timestamp}}\", \"schemeDescription\": \"Test sechema\", \"schemeArchived\": \"false\"}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/schemes", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "schemes" + ] + }, + "description": "Creates a test scheme" + }, + "response": [] + }, + { + "name": "Create ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Creates a content type with a workflow using an id and variable name." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + } + }, + "response": [] }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" + { + "name": "Update Content Type with workflow id and variable name", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var jsonData = pm.response.json();", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type using a workflow with id and variable name." + }, + "response": [] }, - "description": "Test to validate the content type is created with empty `systemActionMappings`." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings is empty\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" + "name": "Update Content Type with workflow variable name", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var jsonData = pm.response.json();", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type using a workflow with just a variable name." + }, + "response": [] }, - "description": "Validates the content type and `systemActionMappings` were created as expected." - }, - "response": [] - }, - { - "name": "Delete ContentType", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" + "name": "Update Content Type with workflow id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var jsonData = pm.response.json();", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type using a workflow with just an id." + }, + "response": [] }, - "description": "Cleanup" - }, - "response": [] - }, - { - "name": "Create ContentType with systemActionMappings", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate systemActionMappings exist\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity[0]).to.have.property('systemActionMappings');", - "});", - "", - "pm.test(\"Validate systemActionMappings contain 'NEW' and 'ARCHIVE'\", function () {", - " var systemActionMappings = pm.response.json().entity[0].systemActionMappings;", - " pm.expect(systemActionMappings).to.have.property('NEW');", - " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", - "});", - "", - "pm.test(\"Validate workflowAction.id inside 'NEW' and 'ARCHIVE'\", function () {", - " var systemActionMappings = pm.response.json().entity[0].systemActionMappings;", - " ", - " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", - " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType3{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"systemActionMappings\" : {\n \"NEW\" : \"b9d89c80-3d88-4311-8365-187323c96436\",\n \"ARCHIVE\": \"4da13a42-5d59-480c-ad8f-94a3adf809fe\"\n },\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" + "name": "Update Content Type with with multiple workflows", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", + " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", + "", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity.workflows;", + " workflows = workflows.sort(compareBy);", + " pm.expect(2).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + " pm.expect(workflows[1].id).to.eql(testSchemeId);", + " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", + "});", + "", + "function compareBy(a, b) {", + " if (a.variableName < b.variableName) { return -1; }", + " if (a.variableName > b.variableName) { return 1; }", + " return 0;", + "}" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n },\n {\n \"id\": \"{{schemeId}}\",\n \"variableName\": \"{{schemeVariableName}}\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type with multiple workflow." + }, + "response": [] }, - "description": "Test to validate the content type is created with `systemActionMappings`." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings exist\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", - "});", - "", - "pm.test(\"Validate systemActionMappings contain 'NEW' and 'ARCHIVE'\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.have.property('NEW');", - " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", - "});", - "", - "pm.test(\"Validate workflowAction.id inside 'NEW' and 'ARCHIVE'\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " ", - " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", - " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" + "name": "Update Content Type with non existing id but valid variable", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var jsonData = pm.response.json();", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bf12345\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type with a workflow where the id is invalid but with a valid variable name." + }, + "response": [] }, - "description": "Validates the content type and `systemActionMappings` were created as expected." - }, - "response": [] - }, - { - "name": "Delete ContentType", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" + "name": "Update Content Type with non existing variable but valid id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var jsonData = pm.response.json();", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"doesNotExit\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type with a workflow where the id valid but with an invalid variable name." + }, + "response": [] }, - "description": "Cleanup" - }, - "response": [] - } - ], - "description": "Folder to encapsulate multiple tests to validate the proper creation and handling of `systemActionMappings`." - }, - { - "name": "Update", - "item": [ - { - "name": "Create ContentType", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate systemActionMappings is empty\", function () {", - " var systemActionMappings = pm.response.json().entity[0].systemActionMappings;", - " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType1{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" + "name": "Update Content Type with wrong workflow #1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"doesNotExist\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Validates the proper error handling when a wrong workflow id is used." + }, + "response": [] }, - "description": "Simple creation to sep up the data for the update tests." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings is empty\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" + "name": "Update Content Type with wrong workflow #2", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"doesNotExist\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Validates the proper error handling when a wrong workflow variable name is used." + }, + "response": [] }, - "description": "Validates the content type and `systemActionMappings` were created as expected." - }, - "response": [] - }, - { - "name": "Update without systemActionMappings", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings is empty\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", - "options": { - "raw": { - "language": "json" + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + }, + "response": [] }, - "description": "Updates a content type without `systemActionMappings`." - }, - "response": [] - }, - { - "name": "Update with empty systemActionMappings", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings is empty\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\": {},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", - "options": { - "raw": { - "language": "json" + "name": "Archive Scheme", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type with emtpy `systemActionMappings`." - }, - "response": [] - }, - { - "name": "Update with systemActionMappings", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings exist\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", - "});", - "", - "pm.test(\"Validate systemActionMappings\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.have.property('NEW');", - " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", - "});", - "", - "pm.test(\"Validate workflowAction.id\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " ", - " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", - " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", - "});" + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\" : {\n \"NEW\" : \"b9d89c80-3d88-4311-8365-187323c96436\",\n \"ARCHIVE\": \"4da13a42-5d59-480c-ad8f-94a3adf809fe\"\n },\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", - "options": { - "raw": { - "language": "json" + "body": { + "mode": "raw", + "raw": "{\"schemeName\": \"{{schemeName}}\", \"schemeArchived\": \"true\"}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "schemes", + "{{schemeId}}" + ] } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + }, + "response": [] }, - "description": "Updates a content type with `systemActionMappings`." - }, - "response": [] - }, - { - "name": "Update without systemActionMappings again", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings exist\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", - "});", - "", - "pm.test(\"Validate systemActionMappings\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.have.property('NEW');", - " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", - "});", - "", - "pm.test(\"Validate workflowAction.id\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " ", - " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", - " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", - "options": { - "raw": { - "language": "json" + "name": "Delete Scheme", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type without `systemActionMappings` existing mappings should be unaffected." - }, - "response": [] - }, - { - "name": "Update with empty systemActionMappings again", + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "schemes", + "{{schemeId}}" + ] + } + }, + "response": [] + } + ], + "description": "Covering different update scenarios for saving workflows in a content type.", "event": [ { - "listen": "test", + "listen": "prerequest", "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings is empty\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", - "});" - ], "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\": {},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", - "options": { - "raw": { - "language": "json" - } + "packages": {}, + "exec": [ + "" + ] } }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type with empty `systemActionMappings` removing all existing mappings." - }, - "response": [] - }, - { - "name": "Update with systemActionMappings adding mappings again", - "event": [ { "listen": "test", "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings exist\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", - "});", - "", - "pm.test(\"Validate systemActionMappings\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.have.property('NEW');", - " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", - "});", - "", - "pm.test(\"Validate workflowAction.id\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " ", - " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", - " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", - "});" - ], "type": "text/javascript", - "packages": {} + "packages": {}, + "exec": [ + "" + ] } } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\" : {\n \"NEW\" : \"b9d89c80-3d88-4311-8365-187323c96436\",\n \"ARCHIVE\": \"4da13a42-5d59-480c-ad8f-94a3adf809fe\"\n },\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type with `systemActionMappings` adding mappings again as previous test deleted existing mappings." - }, - "response": [] + ] + } + ], + "description": "The content type allows to pass also a more estructured array of workflows where you can specify the id and variable for each workflow, these tests cases will cover diferent escenarios for this workflows list." + } + ], + "description": "Testing the diferent scenarios for saving workflows in a Content Type", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "ContentTypeForPages", + "item": [ + { + "name": "GetCurrentSite", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing workflow data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"currentSiteJost\", jsonData.entity.hostname);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "name": "Update with systemActionMappings adding more mappings", - "event": [ + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings exist\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", - "});", - "", - "pm.test(\"Validate systemActionMappings\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.have.property('NEW');", - " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", - " pm.expect(systemActionMappings).to.have.property('PUBLISH');", - "});", - "", - "pm.test(\"Validate workflowAction.id\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " ", - " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", - " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", - " pm.expect(systemActionMappings.PUBLISH.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "token", + "value": "{{jwt}}", + "type": "string" } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\" : {\n \"NEW\" : \"b9d89c80-3d88-4311-8365-187323c96436\",\n \"ARCHIVE\": \"4da13a42-5d59-480c-ad8f-94a3adf809fe\",\n \"PUBLISH\": \"b9d89c80-3d88-4311-8365-187323c96436\"\n },\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type with `systemActionMappings` adding extra mappings to the existing ones." - }, - "response": [] + ] }, - { - "name": "Update by removing systemActionMappings", - "event": [ + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/site/currentSite", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "site", + "currentSite" + ] + } + }, + "response": [] + }, + { + "name": "CreatePageWithSystemTemplate", + "request": { + "auth": { + "type": "bearer", + "bearer": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings exist\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", - "});", - "", - "pm.test(\"Validate systemActionMappings\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.not.have.property('NEW');", - " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", - " pm.expect(systemActionMappings).to.have.property('PUBLISH');", - "});", - "", - "pm.test(\"Validate workflowAction.id\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " ", - " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", - " pm.expect(systemActionMappings.PUBLISH.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \n}", + "options": { + "raw": { + "language": "json" } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\" : {\n \"ARCHIVE\": \"4da13a42-5d59-480c-ad8f-94a3adf809fe\",\n \"PUBLISH\": \"b9d89c80-3d88-4311-8365-187323c96436\"\n },\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type by removing one `systemActionMappings`." - }, - "response": [] + } }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] + } + }, + "response": [] + }, + { + "name": "CheckContentTypeForPages", + "event": [ { - "name": "Delete ContentType", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing workflow data\", function () {", + " let jsonData = pm.response.json();", + " let length = jsonData.entity.length;", + " let currentPage = jsonData.pagination.currentPage;", + " let perPage = jsonData.pagination.perPage;", + " let totalEntries = jsonData.pagination.totalEntries;", + " ", + " pm.expect(length).to.greaterThan(0)", + " pm.expect(totalEntries).to.greaterThan(0)", + " pm.expect(perPage).to.eql(10)", + " pm.expect(currentPage).to.eql(1)", + "", + "});", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/page?pagePathOrId={{currentPageId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "page" + ], + "query": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "pagePathOrId", + "value": "{{currentPageId}}" } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Cleanup" - }, - "response": [] + ] } - ], - "description": "Folder to encapsulate multiple tests to validate the proper update and handling of `systemActionMappings`." - } - ], - "description": "Group of tests to cover the most common operations on the content type `systemActionMappings`.", - "event": [ + }, + "response": [] + }, { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } + "name": "CheckContentTypeForPagesByUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing workflow data\", function () {", + " let jsonData = pm.response.json();", + " let length = jsonData.entity.length;", + " let currentPage = jsonData.pagination.currentPage;", + " let perPage = jsonData.pagination.perPage;", + " let totalEntries = jsonData.pagination.totalEntries;", + " ", + " pm.expect(length).to.greaterThan(0)", + " pm.expect(totalEntries).to.greaterThan(0)", + " pm.expect(perPage).to.eql(10)", + " pm.expect(currentPage).to.eql(1)", + "", + "});", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/page?pagePathOrId={{currentPageUrl}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "page" + ], + "query": [ + { + "key": "pagePathOrId", + "value": "{{currentPageUrl}}" + } + ] + } + }, + "response": [] }, { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } + "name": "CheckContentTypeForPagesBadRequest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400 \", function () {", + " pm.response.to.have.status(400);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/page?pagePathOrId=NONEXIST", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "page" + ], + "query": [ + { + "key": "pagePathOrId", + "value": "NONEXIST" + } + ] + } + }, + "response": [] } ] } @@ -14347,5 +11543,111 @@ ] } } + ], + "variable": [ + { + "key": "testDetailPagePageId1", + "value": "" + }, + { + "key": "testDetailPagePageURL1", + "value": "" + }, + { + "key": "testDetailPagePageId2", + "value": "" + }, + { + "key": "testDetailPagePageURL2", + "value": "" + }, + { + "key": "testDetailPagePageInode1", + "value": "" + }, + { + "key": "testDetailPagePageInode2", + "value": "" + }, + { + "key": "contentTypeID", + "value": "" + }, + { + "key": "contentTypeVAR", + "value": "" + }, + { + "key": "contentTypeFieldID", + "value": "" + }, + { + "key": "pageDetailSiteId", + "value": "" + }, + { + "key": "pageDetailSiteName", + "value": "" + }, + { + "key": "contentTypeId", + "value": "" + }, + { + "key": "pageDetailPageId1", + "value": "" + }, + { + "key": "pageDetailPageInode1", + "value": "" + }, + { + "key": "pageDetailPageURL1", + "value": "" + }, + { + "key": "pageDetailPageId2", + "value": "" + }, + { + "key": "pageDetailPageInode2", + "value": "" + }, + { + "key": "pageDetailPageURL2", + "value": "" + }, + { + "key": "contentTypeVariable", + "value": "" + }, + { + "key": "contentTypeField1Id", + "value": "" + }, + { + "key": "contentTypeField1Variable", + "value": "" + }, + { + "key": "skipPreResquest", + "value": "" + }, + { + "key": "currentSiteJost", + "value": "" + }, + { + "key": "currentPageId", + "value": "" + }, + { + "key": "url", + "value": "" + }, + { + "key": "currentPageUrl", + "value": "" + } ] } \ No newline at end of file From c8721c7b0935bede348c5ff84d758d64939a693a Mon Sep 17 00:00:00 2001 From: jdotcms Date: Thu, 19 Jun 2025 15:33:03 -0600 Subject: [PATCH 05/24] #32238 on usage filtering, pagination and sort is done in java --- .../business/ContentTypeFactoryImpl.java | 2 +- .../v1/contenttype/ContentTypeResource.java | 68 +++++++++++++++++-- .../pagination/ContentTypesPaginator.java | 17 +++-- .../com/dotmarketing/common/util/SQLUtil.java | 2 + 4 files changed, 76 insertions(+), 13 deletions(-) diff --git a/dotCMS/src/main/java/com/dotcms/contenttype/business/ContentTypeFactoryImpl.java b/dotCMS/src/main/java/com/dotcms/contenttype/business/ContentTypeFactoryImpl.java index 63286fee4376..23f97a2c65f8 100644 --- a/dotCMS/src/main/java/com/dotcms/contenttype/business/ContentTypeFactoryImpl.java +++ b/dotCMS/src/main/java/com/dotcms/contenttype/business/ContentTypeFactoryImpl.java @@ -170,7 +170,7 @@ public List find(final Collection varNames, final String fi final DotConnect dc = new DotConnect(); String sql = UtilMethods.isSet(filter) ? ContentTypeSql.SELECT_BY_VAR_NAMES_FILTERED : ContentTypeSql.SELECT_BY_VAR_NAMES; sql = String.format(sql, String.join(COMMA, Collections.nCopies(varNames.size(), "?"))); - if (UtilMethods.isSet(orderBy)) { + if (UtilMethods.isSet(orderBy) && !orderBy.contains(SQLUtil.DOT_NOT_SORT)) { // dotNONE is used to indicate no order by sql = UtilMethods.isSet(orderBy) ? sql + ContentTypeSql.ORDER_BY : sql; final String sanitizedOrderBy = SQLUtil.sanitizeSortBy(orderBy); sql = String.format(sql, sanitizedOrderBy); diff --git a/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java b/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java index a1c9c4c3136c..48f606e60a20 100644 --- a/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java +++ b/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java @@ -24,6 +24,7 @@ import com.dotcms.rest.exception.BadRequestException; import com.dotcms.rest.exception.ForbiddenException; import com.dotcms.rest.exception.mapper.ExceptionMapperUtil; +import com.dotcms.util.ConversionUtils; import com.dotcms.util.PaginationUtil; import com.dotcms.util.diff.DiffItem; import com.dotcms.util.diff.DiffResult; @@ -35,6 +36,7 @@ import com.dotmarketing.business.APILocator; import com.dotmarketing.business.DotStateException; import com.dotmarketing.business.PermissionAPI; +import com.dotmarketing.common.util.SQLUtil; import com.dotmarketing.exception.DotDataException; import com.dotmarketing.exception.DotSecurityException; import com.dotmarketing.portlets.contentlet.model.ContentletVersionInfo; @@ -88,7 +90,10 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Objects; @@ -1674,13 +1679,13 @@ public final Response getPagesContentTypes(@Context final HttpServletRequest htt @QueryParam(PaginationUtil.FILTER) @Parameter(schema = @Schema(type = "string"), description = "String to filter/search for specific content types; leave blank to return all." ) final String filter, - @QueryParam(PaginationUtil.PAGE) @Parameter(schema = @Schema(type = "integer"), + @DefaultValue("1") @QueryParam(PaginationUtil.PAGE) @Parameter(schema = @Schema(type = "integer"), description = "Page number in response pagination.\n\nDefault: `1`" ) final int page, - @QueryParam(PaginationUtil.PER_PAGE) @Parameter(schema = @Schema(type = "integer"), + @DefaultValue("10") @QueryParam(PaginationUtil.PER_PAGE) @Parameter(schema = @Schema(type = "integer"), description = "Number of results per page for pagination.\n\nDefault: `10`" ) final int perPage, - @DefaultValue("upper(name)") @QueryParam(PaginationUtil.ORDER_BY) @Parameter( + @DefaultValue("usage") @QueryParam(PaginationUtil.ORDER_BY) @Parameter( schema = @Schema(type = "string"), description = "Column(s) to sort the results. Multiple columns can be " + "combined in a comma-separated list. Column names can also be set " + @@ -1721,26 +1726,71 @@ public final Response getPagesContentTypes(@Context final HttpServletRequest htt APILocator.getHostAPI().find(siteId, user, pageMode.respectAnonPerms) : APILocator.getHostAPI().findDefaultHost(user, pageMode.respectAnonPerms); // wondering if this should be current or default final String orderBy = this.getOrderByRealName(orderByParam); - final List typeVarNames = findPageContainersContentTypesVarnamesByPathOrId(pagePathOrId, site, + List typeVarNames = findPageContainersContentTypesVarnamesByPathOrId(pagePathOrId, site, languageId, pageMode, user, filter); final Map extraParams = new HashMap<>(); + final boolean isUsage = "usage".equalsIgnoreCase(orderBy); if (null != siteId) { extraParams.put(ContentTypesPaginator.HOST_PARAMETER_ID,siteId); } + + if (isUsage) { + + final boolean isAscending = "ASC".equalsIgnoreCase(direction); + final Map entriesByContentTypes = APILocator.getContentTypeAPI + (user, true).getEntriesByContentTypes(); + // here are filtered and sorted, but we need to paginate them. + this.sort(typeVarNames, isAscending, user, entriesByContentTypes); + typeVarNames = this.paginate(typeVarNames, page, perPage); + extraParams.put("entriesByContentTypes", entriesByContentTypes); + final Comparator> comparator = Comparator + .comparing((Map contentTypeMap) -> + ConversionUtils.toLong(contentTypeMap.getOrDefault("nEntries", -1l),-1l)); + extraParams.put("comparator", isAscending?comparator:comparator.reversed()); + } + if (UtilMethods.isSet(typeVarNames)) { - Logger.debug(this, ()-> "Found Content Types for page: " + pagePathOrId + + Logger.debug(this, "Found Content Types for page: " + pagePathOrId + " in site: " + (Objects.nonNull(site) ? site.getHostname() : "null") + " with languageId: " + languageId + " and pageMode: " + pageMode + " with types: " + typeVarNames); extraParams.put(ContentTypesPaginator.TYPES_PARAMETER_NAME, typeVarNames); } + final PaginationUtil paginationUtil = new PaginationUtil(new ContentTypesPaginator(APILocator.getContentTypeAPI(user))); - return paginationUtil.getPage(httpRequest, user, filter, page, perPage, orderBy, - OrderDirection.valueOf(direction), extraParams); + return isUsage? + paginationUtil.getPage(httpRequest, user, filter, PaginationUtil.FIRST_PAGE_INDEX, // we already paginate the results, so we start at page 1. + perPage, SQLUtil.DOT_NOT_SORT , // if usage is set, I do not want sort on the db, so use dotNONE. + OrderDirection.valueOf(direction), extraParams): + paginationUtil.getPage(httpRequest, user, filter, page, perPage, orderBy, + OrderDirection.valueOf(direction), extraParams); } // getPagesContentTypes. + public List paginate(final List typeVarNames, final int page, final int perPage) { + + if (typeVarNames == null || typeVarNames.isEmpty() || perPage <= 0 || page <= 0) { + return Collections.emptyList(); + } + + int total = typeVarNames.size(); + int fromIndex = Math.min((page - 1) * perPage, total); + int toIndex = Math.min(fromIndex + perPage, total); + + return typeVarNames.subList(fromIndex, toIndex); + } + + private void sort(final List typeVarNames, final boolean ascending, + final User user, final Map entriesByContentTypes) { + + final Comparator comparator = Comparator + .comparing((String contentTypeVarName) -> + entriesByContentTypes.getOrDefault(contentTypeVarName.toLowerCase(), -1l)); + + typeVarNames.sort(ascending ? comparator : comparator.reversed()); + } + private List findPageContainersContentTypesVarnamesByPathOrId(final String pagePathOrId, final Host site, final long languageId, @@ -1774,12 +1824,16 @@ private List findPageContainersContentTypesVarnamesByPathOrId(final Stri String.format("Page with path or ID '%s' was not found", pagePathOrId)); } + final Set repeatedTypes = new HashSet<>(); + // Retrieves the containers associated to the page, then extracts the content types for each container filtering the ones do not allowed return new PageRenderUtil(htmlPage, user, pageMode, languageId, site) .getContainersRaw().stream().map(containerRaw -> containerRaw.getContainerStructures()) .flatMap(Collection::stream) .map(ContainerStructure::getContentTypeVar) + .filter(Objects::nonNull) .filter(Predicate.not(this.contentPaletteHiddenTypes.get()::contains)) + .filter(repeatedTypes::add) .filter(varname -> filter == null || varname.toLowerCase().contains(filter.toLowerCase())) .collect(Collectors.toList()); } // findPageContainersContentTypesVarnamesByPathOrId diff --git a/dotCMS/src/main/java/com/dotcms/util/pagination/ContentTypesPaginator.java b/dotCMS/src/main/java/com/dotcms/util/pagination/ContentTypesPaginator.java index 7ec15b6f98d5..0f0f0963bc57 100644 --- a/dotCMS/src/main/java/com/dotcms/util/pagination/ContentTypesPaginator.java +++ b/dotCMS/src/main/java/com/dotcms/util/pagination/ContentTypesPaginator.java @@ -23,6 +23,7 @@ import io.vavr.control.Try; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.Optional; @@ -102,8 +103,12 @@ public PaginatedArrayList> getItems(final User user, final S final List> contentTypesTransform = transformContentTypesToMap(contentTypes); setEntriesAttribute(user, contentTypesTransform, this.workflowAPI.findSchemesMapForContentType(contentTypes), - this.workflowAPI.findSystemActionsMapByContentType(contentTypes, user)); - result.addAll(contentTypesTransform); + this.workflowAPI.findSystemActionsMapByContentType(contentTypes, user), + extraParams); + + result.addAll(extraParams.containsKey("comparator")? + contentTypesTransform.stream().sorted((Comparator>) extraParams.get("comparator")).collect(Collectors.toList()) + :contentTypesTransform); return result; } catch (final DotDataException | DotSecurityException e) { final String errorMsg = String.format("An error occurred when retrieving paginated Content Types: " + @@ -127,13 +132,15 @@ public PaginatedArrayList> getItems(final User user, final S */ private void setEntriesAttribute(final User user, final List> contentTypesTransform, final Map> workflowSchemes, - final Map> systemActionMappings) { + final Map> systemActionMappings, + final Map extraParams) { Map entriesByContentTypes = null; try { - entriesByContentTypes = APILocator.getContentTypeAPI - (user, true).getEntriesByContentTypes(); + entriesByContentTypes = extraParams.containsKey("entriesByContentTypes")? + (Map)extraParams.get("entriesByContentTypes"): + APILocator.getContentTypeAPI(user, true).getEntriesByContentTypes(); } catch (final DotStateException | DotDataException e) { final String errorMsg = String.format("Error trying to retrieve total entries by Content Type: %s", e.getMessage()); Logger.error(ContentTypesPaginator.class, errorMsg, e); diff --git a/dotCMS/src/main/java/com/dotmarketing/common/util/SQLUtil.java b/dotCMS/src/main/java/com/dotmarketing/common/util/SQLUtil.java index 064642cd17bc..69ba474c4f5d 100644 --- a/dotCMS/src/main/java/com/dotmarketing/common/util/SQLUtil.java +++ b/dotCMS/src/main/java/com/dotmarketing/common/util/SQLUtil.java @@ -44,6 +44,8 @@ public class SQLUtil { private static final SecurityLoggerServiceAPI securityLoggerServiceAPI = APILocator.getSecurityLogger(); + // When you need to send a sort but do not want to actually sort by anything + public static final String DOT_NOT_SORT = "dotnosort"; public static final String ASC = "asc"; public static final String DESC = "desc"; public static final String _ASC = " " + ASC ; From aa8dceb0337e35e32cbdcac6167d515f2c00d76b Mon Sep 17 00:00:00 2001 From: jdotcms Date: Fri, 20 Jun 2025 14:05:04 -0600 Subject: [PATCH 06/24] #32238 code after smoke test --- .../business/ContentTypeFactoryImpl.java | 2 +- .../v1/contenttype/ContentTypeResource.java | 84 ++++++++++++------- .../pagination/ContentTypesPaginator.java | 25 ++++-- .../java/com/liferay/util/StringPool.java | 2 +- 4 files changed, 72 insertions(+), 41 deletions(-) diff --git a/dotCMS/src/main/java/com/dotcms/contenttype/business/ContentTypeFactoryImpl.java b/dotCMS/src/main/java/com/dotcms/contenttype/business/ContentTypeFactoryImpl.java index 23f97a2c65f8..8842963d469f 100644 --- a/dotCMS/src/main/java/com/dotcms/contenttype/business/ContentTypeFactoryImpl.java +++ b/dotCMS/src/main/java/com/dotcms/contenttype/business/ContentTypeFactoryImpl.java @@ -170,7 +170,7 @@ public List find(final Collection varNames, final String fi final DotConnect dc = new DotConnect(); String sql = UtilMethods.isSet(filter) ? ContentTypeSql.SELECT_BY_VAR_NAMES_FILTERED : ContentTypeSql.SELECT_BY_VAR_NAMES; sql = String.format(sql, String.join(COMMA, Collections.nCopies(varNames.size(), "?"))); - if (UtilMethods.isSet(orderBy) && !orderBy.contains(SQLUtil.DOT_NOT_SORT)) { // dotNONE is used to indicate no order by + if (UtilMethods.isSet(orderBy) && !orderBy.contains(SQLUtil.DOT_NOT_SORT)) { // DOT_NOT_SORT is used to indicate no order by wanted sql = UtilMethods.isSet(orderBy) ? sql + ContentTypeSql.ORDER_BY : sql; final String sanitizedOrderBy = SQLUtil.sanitizeSortBy(orderBy); sql = String.format(sql, sanitizedOrderBy); diff --git a/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java b/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java index 48f606e60a20..5528b2b58aaa 100644 --- a/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java +++ b/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java @@ -1719,35 +1719,22 @@ public final Response getPagesContentTypes(@Context final HttpServletRequest htt Logger.debug(this, ()-> "Getting Content Types for page: " + pagePathOrId); + final Map extraParams = new HashMap<>(); final PageMode pageMode = PageMode.get(httpRequest); - final long userLanguageId = LanguageUtil.getLanguageId(language); - final long languageId = userLanguageId > 0 ? userLanguageId : APILocator.getLanguageAPI().getDefaultLanguage().getId(); - final Host site = UtilMethods.isSet(siteId) ? - APILocator.getHostAPI().find(siteId, user, pageMode.respectAnonPerms) : - APILocator.getHostAPI().findDefaultHost(user, pageMode.respectAnonPerms); // wondering if this should be current or default + final long languageId = getLanguageId(language); + final Host site = getSite(siteId, user, pageMode.respectAnonPerms); // wondering if this should be current or default final String orderBy = this.getOrderByRealName(orderByParam); - List typeVarNames = findPageContainersContentTypesVarnamesByPathOrId(pagePathOrId, site, + List typeVarNames = findPageContainersContentTypesVarnamesByPathOrIdAndFilter(pagePathOrId, site, languageId, pageMode, user, filter); - - final Map extraParams = new HashMap<>(); final boolean isUsage = "usage".equalsIgnoreCase(orderBy); - if (null != siteId) { - extraParams.put(ContentTypesPaginator.HOST_PARAMETER_ID,siteId); - } if (isUsage) { - final boolean isAscending = "ASC".equalsIgnoreCase(direction); - final Map entriesByContentTypes = APILocator.getContentTypeAPI - (user, true).getEntriesByContentTypes(); - // here are filtered and sorted, but we need to paginate them. - this.sort(typeVarNames, isAscending, user, entriesByContentTypes); - typeVarNames = this.paginate(typeVarNames, page, perPage); - extraParams.put("entriesByContentTypes", entriesByContentTypes); - final Comparator> comparator = Comparator - .comparing((Map contentTypeMap) -> - ConversionUtils.toLong(contentTypeMap.getOrDefault("nEntries", -1l),-1l)); - extraParams.put("comparator", isAscending?comparator:comparator.reversed()); + typeVarNames = doUsage(page, perPage, direction, user, typeVarNames, extraParams); + } + + if (null != siteId) { + extraParams.put(ContentTypesPaginator.HOST_PARAMETER_ID,siteId); } if (UtilMethods.isSet(typeVarNames)) { @@ -1768,6 +1755,39 @@ public final Response getPagesContentTypes(@Context final HttpServletRequest htt OrderDirection.valueOf(direction), extraParams); } // getPagesContentTypes. + private static long getLanguageId(final String language) { + + final long userLanguageId = LanguageUtil.getLanguageId(language); + final long languageId = userLanguageId > 0 ? userLanguageId : APILocator.getLanguageAPI().getDefaultLanguage().getId(); + return languageId; + } + + private static Host getSite(final String siteId, final User user, final boolean respectAnonPerms) throws DotDataException, DotSecurityException { + return UtilMethods.isSet(siteId) ? + APILocator.getHostAPI().find(siteId, user, respectAnonPerms) : + APILocator.getHostAPI().findDefaultHost(user, respectAnonPerms); + } + + private List doUsage(final int page, + final int perPage, + final String direction, + final User user, List typeVarNames, + final Map extraParams) throws DotDataException { + + final boolean isAscending = OrderDirection.ASC.name().equalsIgnoreCase(direction); + final Map entriesByContentTypes = APILocator.getContentTypeAPI + (user, true).getEntriesByContentTypes(); + // here are filtered and sorted, but we need to paginate them. + this.sort(typeVarNames, isAscending, user, entriesByContentTypes); + typeVarNames = this.paginate(typeVarNames, page, perPage); + extraParams.put(ContentTypesPaginator.ENTRIES_BY_CONTENT_TYPES, entriesByContentTypes); + final Comparator> comparator = Comparator + .comparing((Map contentTypeMap) -> + ConversionUtils.toLong(contentTypeMap.getOrDefault(ContentTypesPaginator.N_ENTRIES_FIELD_NAME, -1l),-1l)); + extraParams.put(ContentTypesPaginator.COMPARATOR, isAscending?comparator:comparator.reversed()); + return typeVarNames; + } + public List paginate(final List typeVarNames, final int page, final int perPage) { if (typeVarNames == null || typeVarNames.isEmpty() || perPage <= 0 || page <= 0) { @@ -1791,12 +1811,16 @@ private void sort(final List typeVarNames, final boolean ascending, typeVarNames.sort(ascending ? comparator : comparator.reversed()); } - private List findPageContainersContentTypesVarnamesByPathOrId(final String pagePathOrId, - final Host site, - final long languageId, - final PageMode pageMode, - final User user, - final String filter) throws DotDataException, DotSecurityException { + /* + * This methods retrieves the page by path or ID, then extracts the content types from the containers + * Matching the filter criteria and removing the repeated ones and the ones from the blacklist. + */ + private List findPageContainersContentTypesVarnamesByPathOrIdAndFilter(final String pagePathOrId, + final Host site, + final long languageId, + final PageMode pageMode, + final User user, + final String filter) throws DotDataException, DotSecurityException { Logger.debug(this, ()-> "Getting Content Types for page: " + pagePathOrId + " in site: " + (Objects.nonNull(site) ? site.getHostname() : "null") + @@ -1805,7 +1829,7 @@ private List findPageContainersContentTypesVarnamesByPathOrId(final Stri IHTMLPage htmlPage = Try.of(()->APILocator.getHTMLPageAssetAPI().getPageByPath( pagePathOrId, site, languageId, pageMode.showLive)).getOrNull(); - if (Objects.isNull(htmlPage)) { // try fallback + if (Objects.isNull(htmlPage)) { // try fallback by identifier final Optional contentletVersionInfoOpt = APILocator.getVersionableAPI().getContentletVersionInfo(pagePathOrId, languageId); if (contentletVersionInfoOpt.isPresent()) { @@ -1836,5 +1860,5 @@ private List findPageContainersContentTypesVarnamesByPathOrId(final Stri .filter(repeatedTypes::add) .filter(varname -> filter == null || varname.toLowerCase().contains(filter.toLowerCase())) .collect(Collectors.toList()); - } // findPageContainersContentTypesVarnamesByPathOrId + } // findPageContainersContentTypesVarnamesByPathOrIdAndFilter } diff --git a/dotCMS/src/main/java/com/dotcms/util/pagination/ContentTypesPaginator.java b/dotCMS/src/main/java/com/dotcms/util/pagination/ContentTypesPaginator.java index 0f0f0963bc57..7ecee2eb9bfd 100644 --- a/dotCMS/src/main/java/com/dotcms/util/pagination/ContentTypesPaginator.java +++ b/dotCMS/src/main/java/com/dotcms/util/pagination/ContentTypesPaginator.java @@ -19,6 +19,7 @@ import com.dotmarketing.util.PaginatedArrayList; import com.dotmarketing.util.UtilMethods; import com.liferay.portal.model.User; +import com.liferay.util.StringPool; import com.rainerhahnekamp.sneakythrow.Sneaky; import io.vavr.control.Try; @@ -40,11 +41,17 @@ */ public class ContentTypesPaginator implements PaginatorOrdered>{ - private static final String N_ENTRIES_FIELD_NAME = "nEntries"; + public static final String N_ENTRIES_FIELD_NAME = "nEntries"; public static final String TYPE_PARAMETER_NAME = "type"; public static final String TYPES_PARAMETER_NAME = "types"; public static final String HOST_PARAMETER_ID = "host"; public static final String SITES_PARAMETER_NAME = "sites"; + public static final String COMPARATOR = "comparator"; + public static final String ENTRIES_BY_CONTENT_TYPES = "entriesByContentTypes"; + public static final String VARIABLE = "variable"; + public static final String WORKFLOWS = "workflows"; + public static final String SYSTEM_ACTION_MAPPINGS = "systemActionMappings"; + private final ContentTypeAPI contentTypeAPI; private final WorkflowAPI workflowAPI; @@ -106,8 +113,8 @@ public PaginatedArrayList> getItems(final User user, final S this.workflowAPI.findSystemActionsMapByContentType(contentTypes, user), extraParams); - result.addAll(extraParams.containsKey("comparator")? - contentTypesTransform.stream().sorted((Comparator>) extraParams.get("comparator")).collect(Collectors.toList()) + result.addAll(extraParams.containsKey(COMPARATOR)? + contentTypesTransform.stream().sorted((Comparator>) extraParams.get(COMPARATOR)).collect(Collectors.toList()) :contentTypesTransform); return result; } catch (final DotDataException | DotSecurityException e) { @@ -138,8 +145,8 @@ private void setEntriesAttribute(final User user, final List Map entriesByContentTypes = null; try { - entriesByContentTypes = extraParams.containsKey("entriesByContentTypes")? - (Map)extraParams.get("entriesByContentTypes"): + entriesByContentTypes = extraParams.containsKey(ENTRIES_BY_CONTENT_TYPES)? + (Map)extraParams.get(ENTRIES_BY_CONTENT_TYPES): APILocator.getContentTypeAPI(user, true).getEntriesByContentTypes(); } catch (final DotStateException | DotDataException e) { final String errorMsg = String.format("Error trying to retrieve total entries by Content Type: %s", e.getMessage()); @@ -149,7 +156,7 @@ private void setEntriesAttribute(final User user, final List for (final Map contentTypeEntry : contentTypesTransform) { - final String variable = (String) contentTypeEntry.get("variable"); + final String variable = (String) contentTypeEntry.get(VARIABLE); if (entriesByContentTypes != null) { final String key = variable.toLowerCase(); @@ -157,17 +164,17 @@ private void setEntriesAttribute(final User user, final List entriesByContentTypes.get(key); contentTypeEntry.put(N_ENTRIES_FIELD_NAME, contentTypeEntriesNumber); } else { - contentTypeEntry.put(N_ENTRIES_FIELD_NAME, "N/A"); + contentTypeEntry.put(N_ENTRIES_FIELD_NAME, StringPool.NA); } if (workflowSchemes.containsKey(variable)) { - contentTypeEntry.put("workflows", workflowSchemes.get(variable)); + contentTypeEntry.put(WORKFLOWS, workflowSchemes.get(variable)); } if (systemActionMappings.containsKey(variable)) { - contentTypeEntry.put("systemActionMappings", workflowSchemes.get(variable)); + contentTypeEntry.put(SYSTEM_ACTION_MAPPINGS, workflowSchemes.get(variable)); } } } diff --git a/dotCMS/src/main/java/com/liferay/util/StringPool.java b/dotCMS/src/main/java/com/liferay/util/StringPool.java index 7aae9e980f25..6043d2095573 100644 --- a/dotCMS/src/main/java/com/liferay/util/StringPool.java +++ b/dotCMS/src/main/java/com/liferay/util/StringPool.java @@ -93,5 +93,5 @@ public class StringPool { public static final String UNKNOWN = "UNKNOWN"; - + public static final String NA = "N/A"; } From 19ad8ef08fcdbc883ba0f156b16d5e155a32116c Mon Sep 17 00:00:00 2001 From: jdotcms Date: Mon, 23 Jun 2025 09:33:56 -0600 Subject: [PATCH 07/24] #32238 fixing an unit test --- .../java/com/dotcms/util/pagination/ContentTypesPaginator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dotCMS/src/main/java/com/dotcms/util/pagination/ContentTypesPaginator.java b/dotCMS/src/main/java/com/dotcms/util/pagination/ContentTypesPaginator.java index 7ecee2eb9bfd..ad69b49a299a 100644 --- a/dotCMS/src/main/java/com/dotcms/util/pagination/ContentTypesPaginator.java +++ b/dotCMS/src/main/java/com/dotcms/util/pagination/ContentTypesPaginator.java @@ -27,6 +27,7 @@ import java.util.Comparator; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; import java.util.stream.Collectors; @@ -145,7 +146,7 @@ private void setEntriesAttribute(final User user, final List Map entriesByContentTypes = null; try { - entriesByContentTypes = extraParams.containsKey(ENTRIES_BY_CONTENT_TYPES)? + entriesByContentTypes = Objects.nonNull(extraParams) && extraParams.containsKey(ENTRIES_BY_CONTENT_TYPES)? (Map)extraParams.get(ENTRIES_BY_CONTENT_TYPES): APILocator.getContentTypeAPI(user, true).getEntriesByContentTypes(); } catch (final DotStateException | DotDataException e) { From c9a40147fa78f27535719f550352d3640616a837 Mon Sep 17 00:00:00 2001 From: jdotcms Date: Mon, 23 Jun 2025 11:15:29 -0600 Subject: [PATCH 08/24] #32238 adding more fixing for unit test --- .../java/com/dotcms/util/pagination/ContentTypesPaginator.java | 2 +- .../main/java/com/dotcms/util/pagination/PaginatorOrdered.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dotCMS/src/main/java/com/dotcms/util/pagination/ContentTypesPaginator.java b/dotCMS/src/main/java/com/dotcms/util/pagination/ContentTypesPaginator.java index ad69b49a299a..daf842da52af 100644 --- a/dotCMS/src/main/java/com/dotcms/util/pagination/ContentTypesPaginator.java +++ b/dotCMS/src/main/java/com/dotcms/util/pagination/ContentTypesPaginator.java @@ -114,7 +114,7 @@ public PaginatedArrayList> getItems(final User user, final S this.workflowAPI.findSystemActionsMapByContentType(contentTypes, user), extraParams); - result.addAll(extraParams.containsKey(COMPARATOR)? + result.addAll(Objects.nonNull(extraParams) && extraParams.containsKey(COMPARATOR)? contentTypesTransform.stream().sorted((Comparator>) extraParams.get(COMPARATOR)).collect(Collectors.toList()) :contentTypesTransform); return result; diff --git a/dotCMS/src/main/java/com/dotcms/util/pagination/PaginatorOrdered.java b/dotCMS/src/main/java/com/dotcms/util/pagination/PaginatorOrdered.java index 255340b71dff..d9ac41e1ebcf 100644 --- a/dotCMS/src/main/java/com/dotcms/util/pagination/PaginatorOrdered.java +++ b/dotCMS/src/main/java/com/dotcms/util/pagination/PaginatorOrdered.java @@ -3,6 +3,7 @@ import com.dotmarketing.util.PaginatedArrayList; import com.liferay.portal.model.User; +import java.util.Collections; import java.util.Map; /** @@ -102,7 +103,7 @@ default PaginatedArrayList getItems(final User user, final String filter, fin * @return A {@link PaginatedArrayList} of items matching the specified search criteria. */ default PaginatedArrayList getItems(final User user, final String filter, final int limit, final int offset, final String orderBy, final OrderDirection direction) { - return getItems(user, filter, limit, offset, orderBy, direction, null); + return getItems(user, filter, limit, offset, orderBy, direction, Collections.emptyMap()); } } From a44d65a63ea25ec0a41fa2e42541bc89d1f2dc3b Mon Sep 17 00:00:00 2001 From: jdotcms Date: Tue, 24 Jun 2025 09:20:51 -0600 Subject: [PATCH 09/24] #32238 adding fix for postman --- .../main/resources/postman/ContentTypeResourceTests.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json index 0282b9443752..270b19fcbdb8 100644 --- a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json +++ b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json @@ -396,14 +396,16 @@ "});", "", "pm.test(\"fields check\", function () {", - " pm.expect(jsonData.entity[0].fields.length).to.eql(2);", + " ", + " pm.expect(jsonData.entity[0].fields.length).to.be.above(2);", "});", "", "pm.test(\"description check\", function () {", " pm.expect(jsonData.entity[0].description).to.eql('THE DESCRIPTION');", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], From 93e39cd67853bef4c4b120209d8d55f50b334d69 Mon Sep 17 00:00:00 2001 From: jdotcms Date: Wed, 25 Jun 2025 12:42:06 -0600 Subject: [PATCH 10/24] #32238 trying to fix 400 on ct test --- .../postman/ContentTypeResourceTests.json | 125 +++++------------- 1 file changed, 30 insertions(+), 95 deletions(-) diff --git a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json index 270b19fcbdb8..c29bcb7bb86e 100644 --- a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json +++ b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json @@ -34,32 +34,19 @@ " pm.expect(jsonData.entity[0].sortOrder).to.eql(3);", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhcGliY2ExY2JjYy0xMjkyLTQxMGMtYWFkNy1lMjBlYmJmZTBlOTgiLCJ4bW9kIjoxNzUwNzg5MjA3MDAwLCJuYmYiOjE3NTA3ODkyMDcsImlzcyI6Imxlbm5veC1kZXYtMSIsImxhYmVsIjoiVGVzdEFQSSIsImV4cCI6MTg0NTQzOTIwMCwiaWF0IjoxNzUwNzg5MjA3LCJqdGkiOiJhY2JhNzM3Ny04N2EyLTQ4MzAtOTQwNi03ZTAwYTVkMTM4ZTAifQ.PcjweALvL8xBUYKVyuzIl3dxVoy-Bf0TudWdtnnLTyo", "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" } ] }, @@ -110,32 +97,19 @@ " pm.expect(jsonData.entity.sortOrder).to.eql(3);", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhcGliY2ExY2JjYy0xMjkyLTQxMGMtYWFkNy1lMjBlYmJmZTBlOTgiLCJ4bW9kIjoxNzUwNzg5MjA3MDAwLCJuYmYiOjE3NTA3ODkyMDcsImlzcyI6Imxlbm5veC1kZXYtMSIsImxhYmVsIjoiVGVzdEFQSSIsImV4cCI6MTg0NTQzOTIwMCwiaWF0IjoxNzUwNzg5MjA3LCJqdGkiOiJhY2JhNzM3Ny04N2EyLTQ4MzAtOTQwNi03ZTAwYTVkMTM4ZTAifQ.PcjweALvL8xBUYKVyuzIl3dxVoy-Bf0TudWdtnnLTyo", "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" } ] }, @@ -179,32 +153,19 @@ " pm.expect(jsonData.entity.sortOrder).to.eql(2);", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhcGliY2ExY2JjYy0xMjkyLTQxMGMtYWFkNy1lMjBlYmJmZTBlOTgiLCJ4bW9kIjoxNzUwNzg5MjA3MDAwLCJuYmYiOjE3NTA3ODkyMDcsImlzcyI6Imxlbm5veC1kZXYtMSIsImxhYmVsIjoiVGVzdEFQSSIsImV4cCI6MTg0NTQzOTIwMCwiaWF0IjoxNzUwNzg5MjA3LCJqdGkiOiJhY2JhNzM3Ny04N2EyLTQ4MzAtOTQwNi03ZTAwYTVkMTM4ZTAifQ.PcjweALvL8xBUYKVyuzIl3dxVoy-Bf0TudWdtnnLTyo", "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" } ] }, @@ -257,32 +218,19 @@ " pm.expect(jsonData.entity.sortOrder).to.eql(2);", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhcGliY2ExY2JjYy0xMjkyLTQxMGMtYWFkNy1lMjBlYmJmZTBlOTgiLCJ4bW9kIjoxNzUwNzg5MjA3MDAwLCJuYmYiOjE3NTA3ODkyMDcsImlzcyI6Imxlbm5veC1kZXYtMSIsImxhYmVsIjoiVGVzdEFQSSIsImV4cCI6MTg0NTQzOTIwMCwiaWF0IjoxNzUwNzg5MjA3LCJqdGkiOiJhY2JhNzM3Ny04N2EyLTQ4MzAtOTQwNi03ZTAwYTVkMTM4ZTAifQ.PcjweALvL8xBUYKVyuzIl3dxVoy-Bf0TudWdtnnLTyo", "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" } ] }, @@ -325,32 +273,19 @@ " pm.response.to.have.status(200);", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhcGliY2ExY2JjYy0xMjkyLTQxMGMtYWFkNy1lMjBlYmJmZTBlOTgiLCJ4bW9kIjoxNzUwNzg5MjA3MDAwLCJuYmYiOjE3NTA3ODkyMDcsImlzcyI6Imxlbm5veC1kZXYtMSIsImxhYmVsIjoiVGVzdEFQSSIsImV4cCI6MTg0NTQzOTIwMCwiaWF0IjoxNzUwNzg5MjA3LCJqdGkiOiJhY2JhNzM3Ny04N2EyLTQ4MzAtOTQwNi03ZTAwYTVkMTM4ZTAifQ.PcjweALvL8xBUYKVyuzIl3dxVoy-Bf0TudWdtnnLTyo", "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" } ] }, From ab6650b0fe817e5749d88eb751e2f65f4502c9da Mon Sep 17 00:00:00 2001 From: jdotcms Date: Tue, 8 Jul 2025 14:54:42 -0500 Subject: [PATCH 11/24] #32238 fixing some content type postmans --- .../postman/ContentTypeResourceTests.json | 102 +++++++++++++++--- 1 file changed, 89 insertions(+), 13 deletions(-) diff --git a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json index c29bcb7bb86e..2bc0f3f5017e 100644 --- a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json +++ b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json @@ -95,7 +95,9 @@ "", "pm.test(\"sortOrder check\", function () {", " pm.expect(jsonData.entity.sortOrder).to.eql(3);", - "});" + "});", + "", + "pm.collectionVariables.set(\"fields\", JSON.stringify(jsonData.entity.fields));" ], "type": "text/javascript", "packages": {} @@ -173,7 +175,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"My Custom Structure {{$randomBankAccount}}\",\n\t\"variable\": \"{{contentTypeVAR}}\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeID}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": true,\n \"iDate\": 1631719532000,\n \"id\": \"{{contentTypeFieldID}}\",\n \"indexed\": true,\n \"listed\": true,\n \"modDate\": 1631719532000,\n \"name\": \"Name\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name\"\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"My Custom Structure {{$randomBankAccount}}\",\n\t\"variable\": \"{{contentTypeVAR}}\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n\t\"fields\": {{fields}},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", "options": { "raw": { "language": "json" @@ -238,7 +240,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure test\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"My Custom Structure {{$randomBankAccount}}\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeID}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": true,\n \"iDate\": 1631719532000,\n \"id\": \"{{contentTypeFieldID}}\",\n \"indexed\": true,\n \"listed\": true,\n \"modDate\": 1631719532000,\n \"name\": \"Name\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name\"\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure test\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"My Custom Structure {{$randomBankAccount}}\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n\t\"fields\": {{fields}},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", "options": { "raw": { "language": "json" @@ -410,14 +412,20 @@ "", "", "pm.test(\"fields check\", function () {", - " pm.expect(jsonData.entity.fields.length).to.eql(2);", + " pm.expect(jsonData.entity.fields.length).to.gte(2);", "});", "", "pm.test(\"description check\", function () {", " pm.expect(jsonData.entity.description).to.eql('THE DESCRIPTION');", - "});" + "});", + "", + "let fields = jsonData.entity.fields.filter(field => field.variable !== 'tags');", + "", + "", + "pm.collectionVariables.set(\"fields\", JSON.stringify(fields));" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -486,7 +494,8 @@ " pm.expect(jsonData.entity.description).to.eql('THE DESCRIPTION');", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -519,7 +528,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"THE DESCRIPTION\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"contentTypeId\": \"{{contentTypeID}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Host-Folder\",\n \"fieldTypeLabel\": \"Site or Folder\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"id\": \"{{contentTypeFieldID}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1632506750000,\n \"name\": \"Host/Folder CHANGED\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n }\n ],\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"Test Content Type\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"THE DESCRIPTION\",\n \"fields\":{{fields}},\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"Test Content Type\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", "options": { "raw": { "language": "json" @@ -621,13 +630,14 @@ " pm.response.to.have.status(200);", "});", "pm.test(\"Content Type should have 2 fields\", function() {", - " pm.expect(contentType.fields.length).to.eql(2);", + " pm.expect(contentType.fields.length).to.gte(2);", "});", "pm.test(\"Content Type has a Story_block_field\", function() {", " pm.expect(contentType.fields[1].fieldType).to.eql(\"Story-Block\");", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -2956,7 +2966,8 @@ "});", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -3981,10 +3992,11 @@ "});", "", "pm.test(\"Fields check\", function () {", - " pm.expect(jsonData.entity[0].fields.length).to.eql(2);", + " pm.expect(jsonData.entity[0].fields.length).to.gte(2);", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -11585,6 +11597,70 @@ { "key": "currentPageUrl", "value": "" + }, + { + "key": "contentTypeIdWithStoryBlock", + "value": "" + }, + { + "key": "contentType.host", + "value": "" + }, + { + "key": "contentType.field1", + "value": "" + }, + { + "key": "contentType.field2", + "value": "" + }, + { + "key": "contentType.field3", + "value": "" + }, + { + "key": "contentType.field4", + "value": "" + }, + { + "key": "contentType.field4.varName", + "value": "" + }, + { + "key": "contentType.divider", + "value": "" + }, + { + "key": "contentType.columnDivider", + "value": "" + }, + { + "key": "contentType.field4.fieldVarOne.id", + "value": "" + }, + { + "key": "contentType.field4.fieldVarOne.key", + "value": "" + }, + { + "key": "fieldTypesArr", + "value": "" + }, + { + "key": "schemeId", + "value": "" + }, + { + "key": "schemeName", + "value": "" + }, + { + "key": "schemeVariableName", + "value": "" + }, + { + "key": "fields", + "value": "" } ] } \ No newline at end of file From 9d68c9709eb1d6490a77e117cb9e9e7bca68c2ea Mon Sep 17 00:00:00 2001 From: jdotcms Date: Tue, 8 Jul 2025 22:30:48 -0500 Subject: [PATCH 12/24] #32238 fixing some content type postmans --- .../postman/ContentTypeResourceTests.json | 15115 +++++++++------- 1 file changed, 8900 insertions(+), 6215 deletions(-) diff --git a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json index 2bc0f3f5017e..c493aa5937da 100644 --- a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json +++ b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json @@ -1,9 +1,9 @@ { "info": { - "_postman_id": "4eaa447a-cad4-46a5-ba2d-0cd107dfbc79", + "_postman_id": "173bf579-93b9-497b-baee-8f9c48e58b71", "name": "ContentType Resource", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "781456" + "_exporter_id": "36604690" }, "item": [ { @@ -20,7 +20,7 @@ "", "pm.collectionVariables.set(\"contentTypeID\", jsonData.entity[0].id);", "pm.collectionVariables.set(\"contentTypeVAR\", jsonData.entity[0].variable);", - "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[0].id);", + "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[2].id);", "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", @@ -41,12 +41,26 @@ ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { - "key": "token", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhcGliY2ExY2JjYy0xMjkyLTQxMGMtYWFkNy1lMjBlYmJmZTBlOTgiLCJ4bW9kIjoxNzUwNzg5MjA3MDAwLCJuYmYiOjE3NTA3ODkyMDcsImlzcyI6Imxlbm5veC1kZXYtMSIsImxhYmVsIjoiVGVzdEFQSSIsImV4cCI6MTg0NTQzOTIwMCwiaWF0IjoxNzUwNzg5MjA3LCJqdGkiOiJhY2JhNzM3Ny04N2EyLTQ4MzAtOTQwNi03ZTAwYTVkMTM4ZTAifQ.PcjweALvL8xBUYKVyuzIl3dxVoy-Bf0TudWdtnnLTyo", + "key": "username", + "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, @@ -95,23 +109,34 @@ "", "pm.test(\"sortOrder check\", function () {", " pm.expect(jsonData.entity.sortOrder).to.eql(3);", - "});", - "", - "pm.collectionVariables.set(\"fields\", JSON.stringify(jsonData.entity.fields));" + "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { - "key": "token", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhcGliY2ExY2JjYy0xMjkyLTQxMGMtYWFkNy1lMjBlYmJmZTBlOTgiLCJ4bW9kIjoxNzUwNzg5MjA3MDAwLCJuYmYiOjE3NTA3ODkyMDcsImlzcyI6Imxlbm5veC1kZXYtMSIsImxhYmVsIjoiVGVzdEFQSSIsImV4cCI6MTg0NTQzOTIwMCwiaWF0IjoxNzUwNzg5MjA3LCJqdGkiOiJhY2JhNzM3Ny04N2EyLTQ4MzAtOTQwNi03ZTAwYTVkMTM4ZTAifQ.PcjweALvL8xBUYKVyuzIl3dxVoy-Bf0TudWdtnnLTyo", + "key": "username", + "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, @@ -155,19 +180,32 @@ " pm.expect(jsonData.entity.sortOrder).to.eql(2);", "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { - "key": "token", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhcGliY2ExY2JjYy0xMjkyLTQxMGMtYWFkNy1lMjBlYmJmZTBlOTgiLCJ4bW9kIjoxNzUwNzg5MjA3MDAwLCJuYmYiOjE3NTA3ODkyMDcsImlzcyI6Imxlbm5veC1kZXYtMSIsImxhYmVsIjoiVGVzdEFQSSIsImV4cCI6MTg0NTQzOTIwMCwiaWF0IjoxNzUwNzg5MjA3LCJqdGkiOiJhY2JhNzM3Ny04N2EyLTQ4MzAtOTQwNi03ZTAwYTVkMTM4ZTAifQ.PcjweALvL8xBUYKVyuzIl3dxVoy-Bf0TudWdtnnLTyo", + "key": "username", + "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, @@ -175,7 +213,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"My Custom Structure {{$randomBankAccount}}\",\n\t\"variable\": \"{{contentTypeVAR}}\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n\t\"fields\": {{fields}},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"My Custom Structure {{$randomBankAccount}}\",\n\t\"variable\": \"{{contentTypeVAR}}\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeID}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": true,\n \"iDate\": 1631719532000,\n \"id\": \"{{contentTypeFieldID}}\",\n \"indexed\": true,\n \"listed\": true,\n \"modDate\": 1631719532000,\n \"name\": \"Name\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name\"\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", "options": { "raw": { "language": "json" @@ -220,129 +258,7 @@ " pm.expect(jsonData.entity.sortOrder).to.eql(2);", "});" ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhcGliY2ExY2JjYy0xMjkyLTQxMGMtYWFkNy1lMjBlYmJmZTBlOTgiLCJ4bW9kIjoxNzUwNzg5MjA3MDAwLCJuYmYiOjE3NTA3ODkyMDcsImlzcyI6Imxlbm5veC1kZXYtMSIsImxhYmVsIjoiVGVzdEFQSSIsImV4cCI6MTg0NTQzOTIwMCwiaWF0IjoxNzUwNzg5MjA3LCJqdGkiOiJhY2JhNzM3Ny04N2EyLTQ4MzAtOTQwNi03ZTAwYTVkMTM4ZTAifQ.PcjweALvL8xBUYKVyuzIl3dxVoy-Bf0TudWdtnnLTyo", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure test\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"My Custom Structure {{$randomBankAccount}}\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n\t\"fields\": {{fields}},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeID}}" - ] - }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." - }, - "response": [] - }, - { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhcGliY2ExY2JjYy0xMjkyLTQxMGMtYWFkNy1lMjBlYmJmZTBlOTgiLCJ4bW9kIjoxNzUwNzg5MjA3MDAwLCJuYmYiOjE3NTA3ODkyMDcsImlzcyI6Imxlbm5veC1kZXYtMSIsImxhYmVsIjoiVGVzdEFQSSIsImV4cCI6MTg0NTQzOTIwMCwiaWF0IjoxNzUwNzg5MjA3LCJqdGkiOiJhY2JhNzM3Ny04N2EyLTQ4MzAtOTQwNi03ZTAwYTVkMTM4ZTAifQ.PcjweALvL8xBUYKVyuzIl3dxVoy-Bf0TudWdtnnLTyo", - "type": "string" - } - ] - }, - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeID}}" - ] - }, - "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." - }, - "response": [] - } - ] - }, - { - "name": "Test CRUD Fields", - "item": [ - { - "name": "Create ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.collectionVariables.set(\"contentTypeID\", jsonData.entity[0].id);", - "pm.collectionVariables.set(\"contentTypeVAR\", jsonData.entity[0].variable);", - "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[0].id);", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"fields check\", function () {", - " ", - " pm.expect(jsonData.entity[0].fields.length).to.be.above(2);", - "});", - "", - "pm.test(\"description check\", function () {", - " pm.expect(jsonData.entity[0].description).to.eql('THE DESCRIPTION');", - "});" - ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], @@ -371,61 +287,46 @@ } ] }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\", \n \"defaultType\": false, \n \"name\": \"Test Content Type\", \n \"description\": \"THE DESCRIPTION\", \n \"host\": \"SYSTEM_HOST\", \n \"owner\": \"dotcms.org.1\", \n \"fixed\": false, \n \"system\": false, \n \"folder\": \"SYSTEM_FOLDER\",\n \"fields\": [\n {\n \"dataType\": \"SYSTEM\",\n \"dbColumn\": \"system_field1\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Host/Folder\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n },\n {\n \"dataType\": \"LONG_TEXT\",\n \"dbColumn\": \"text_area2\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1453474468000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTagField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Tags\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"tags\"\n }],\n \"workflow\": [\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}\n" + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure test\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"My Custom Structure {{$randomBankAccount}}\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeID}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": true,\n \"iDate\": 1631719532000,\n \"id\": \"{{contentTypeFieldID}}\",\n \"indexed\": true,\n \"listed\": true,\n \"modDate\": 1631719532000,\n \"name\": \"Name\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name\"\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeID}}" ] }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." }, "response": [] }, { - "name": "Get Content Type", + "name": "Delete ContentType", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", - "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "", - "pm.test(\"fields check\", function () {", - " pm.expect(jsonData.entity.fields.length).to.gte(2);", - "});", - "", - "pm.test(\"description check\", function () {", - " pm.expect(jsonData.entity.description).to.eql('THE DESCRIPTION');", - "});", - "", - "let fields = jsonData.entity.fields.filter(field => field.variable !== 'tags');", - "", - "", - "pm.collectionVariables.set(\"fields\", JSON.stringify(fields));" + "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], @@ -454,7 +355,7 @@ } ] }, - "method": "GET", + "method": "DELETE", "header": [], "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", @@ -469,171 +370,578 @@ "{{contentTypeID}}" ] }, - "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." + "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." }, "response": [] - }, + } + ] + }, + { + "name": "Test CRUD Fields", + "item": [ { - "name": "Update Content Type without sending variable success", - "event": [ + "name": "Filtering Fields", + "item": [ { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"fields check\", function () {", - " pm.expect(jsonData.entity.fields.length).to.eql(3);", - "});", - "", - "pm.test(\"description check\", function () {", - " pm.expect(jsonData.entity.description).to.eql('THE DESCRIPTION');", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Generate Test Data", + "item": [ { - "key": "password", - "value": "admin", - "type": "string" + "name": "Create Test Content Type", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.collectionVariables.set(\"typeNameWithMetadata\", \"test-type-\" + \"{{$randomInt}}\");" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Test Content Type was created successfully\", function () {", + " const jsonData = pm.response.json();", + " const entity = jsonData.entity[0];", + " pm.expect(jsonData.errors.length).to.eql(0);", + " pm.collectionVariables.set(\"contentTypeId\", entity.id);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"defaultType\": false,\n \"icon\": null,\n \"fixed\": false,\n \"system\": false,\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\": \"\",\n \"host\": \"48190c8c-42c4-46af-8d1a-0cd5db894797\",\n \"name\": \"My Test CT\",\n \"metadata\": {\n \"edit_mode\": true\n },\n \"systemActionMappings\": {\n \"NEW\": \"\"\n },\n \"workflow\": [\n \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + } + }, + "response": [] }, { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, + "name": "Add Fields to Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Test Content Type Fields were created successfully\", function () {", + " const jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"layout\": [\n {\n \"divider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"iDate\": 1705078587000,\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1705078587000,\n \"name\": \"Row Field\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": -1,\n \"unique\": false\n },\n \"columns\": [\n {\n \"columnDivider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"iDate\": 1705078587000,\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1705078587000,\n \"name\": \"Column Field\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": -1,\n \"unique\": false\n },\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"name\": \"Title\",\n \"dataType\": \"TEXT\",\n \"regexCheck\": \"\",\n \"defaultValue\": \"\",\n \"hint\": \"\",\n \"required\": true,\n \"searchable\": true,\n \"listed\": true,\n \"unique\": false,\n \"id\": null\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"name\": \"Description\",\n \"dataType\": \"TEXT\",\n \"regexCheck\": \"\",\n \"defaultValue\": \"\",\n \"hint\": \"\",\n \"required\": false,\n \"searchable\": true,\n \"listed\": false,\n \"unique\": false,\n \"id\": null\n }\n ]\n }\n ]\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/move", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v3", + "contenttype", + "{{contentTypeId}}", + "fields", + "move" + ] + } + }, + "response": [] + } + ], + "event": [ { - "key": "saveHelperData", - "type": "any" + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } }, { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"THE DESCRIPTION\",\n \"fields\":{{fields}},\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"Test Content Type\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", - "options": { - "raw": { - "language": "json" + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "pm.test(\"HTTP Status code must be successful\", function () {", + " pm.response.to.have.status(200);", + "});", + "" + ] + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeID}}" ] }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." - }, - "response": [] - }, - { - "name": "Delete ContentType", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "name": "Success", + "item": [ { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "name": "Filter By Required Fields", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Data was returned successfully\", function () {", + " const jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});", + "", + "pm.test(\"There must be only one 'Required' field\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.equal(1, \"Just one field must be marked as 'Required'\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=REQUIRED", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v3", + "contenttype", + "{{contentTypeId}}", + "fields", + "allfields" + ], + "query": [ + { + "key": "filter", + "value": "REQUIRED" + } + ] + } + }, + "response": [] }, { - "key": "saveHelperData", - "type": "any" + "name": "Filter By Indexed Fields", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Data was returned successfully\", function () {", + " const jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});", + "", + "pm.test(\"There must be two 'System Indexed' fields\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.equal(2, \"Two fields must be marked as 'System Indexed'\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=SYSTEM_INDEXED", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v3", + "contenttype", + "{{contentTypeId}}", + "fields", + "allfields" + ], + "query": [ + { + "key": "filter", + "value": "SYSTEM_INDEXED" + } + ] + } + }, + "response": [] }, { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeID}}" - ] + "name": "Filter By Several Criteria", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Data was returned successfully\", function () {", + " const jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});", + "", + "pm.test(\"There must be only one 'Required', 'User Searchable', and 'Show in List' field\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.equal(1, \"Just one field must be marked as 'Required', 'User Searchable', and 'Show in List' field\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=REQUIRED&filter=USER_SEARCHABLE&filter=SHOW_IN_LIST", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v3", + "contenttype", + "{{contentTypeId}}", + "fields", + "allfields" + ], + "query": [ + { + "key": "filter", + "value": "REQUIRED" + }, + { + "key": "filter", + "value": "USER_SEARCHABLE" + }, + { + "key": "filter", + "value": "SHOW_IN_LIST" + } + ] + } + }, + "response": [] + }, + { + "name": "Filter By Non-met Criteria", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Data was returned successfully\", function () {", + " const jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});", + "", + "pm.test(\"No field must match 'Required', 'User Searchable', 'Show in List' and 'Unique'\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.equal(0, \"No field must match the four specified filters\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=REQUIRED&filter=USER_SEARCHABLE&filter=SHOW_IN_LIST&filter=UNIQUE", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v3", + "contenttype", + "{{contentTypeId}}", + "fields", + "allfields" + ], + "query": [ + { + "key": "filter", + "value": "REQUIRED" + }, + { + "key": "filter", + "value": "USER_SEARCHABLE" + }, + { + "key": "filter", + "value": "SHOW_IN_LIST" + }, + { + "key": "filter", + "value": "UNIQUE" + } + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "pm.test(\"HTTP Status code must be successful\", function () {", + " pm.response.to.have.status(200);", + "});", + "" + ] + } + } + ] }, - "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." - }, - "response": [] - } - ] - }, - { - "name": "Tests For New StoryBlockField", - "item": [ + { + "name": "Failure", + "item": [ + { + "name": "Log User out", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/dotAdmin/logout", + "host": [ + "{{serverURL}}" + ], + "path": [ + "dotAdmin", + "logout" + ] + }, + "description": "This request just makes sure that the next request does NOT have an authenticated User." + }, + "response": [] + }, + { + "name": "No Authentication", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 'Unauthorized'\", function () {", + " pm.response.to.have.status(401);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=REQUIRED", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v3", + "contenttype", + "{{contentTypeId}}", + "fields", + "allfields" + ], + "query": [ + { + "key": "filter", + "value": "REQUIRED" + } + ] + } + }, + "response": [] + }, + { + "name": "Using Invalid Filter", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 'Bad Request'\", function () {", + " pm.response.to.have.status(400);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=INVALID_FILTER", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v3", + "contenttype", + "{{contentTypeId}}", + "fields", + "allfields" + ], + "query": [ + { + "key": "filter", + "value": "INVALID_FILTER" + } + ] + } + }, + "response": [] + }, + { + "name": "Using Invalid Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 'Not Found'\", function () {", + " pm.response.to.have.status(404);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v3/contenttype/INVALID_CONTENT_TYPE/fields/allfields?filter=REQUIRED", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v3", + "contenttype", + "INVALID_CONTENT_TYPE", + "fields", + "allfields" + ], + "query": [ + { + "key": "filter", + "value": "REQUIRED" + } + ] + } + }, + "response": [] + } + ] + } + ] + }, { - "name": "Create ContentType with StoryBlockField Success", + "name": "Create ContentType", "event": [ { "listen": "test", "script": { "exec": [ "var jsonData = pm.response.json();", - "var contentType = jsonData.entity[0];", - "pm.collectionVariables.set(\"contentTypeIdWithStoryBlock\", contentType.id);", - "pm.test(\"Status code should be 200\", function() {", + "", + "pm.collectionVariables.set(\"contentTypeID\", jsonData.entity[0].id);", + "pm.collectionVariables.set(\"contentTypeVAR\", jsonData.entity[0].variable);", + "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[2].id);", + "", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", "});", - "pm.test(\"Content Type should have 2 fields\", function() {", - " pm.expect(contentType.fields.length).to.gte(2);", + "", + "pm.test(\"fields check\", function () {", + " pm.expect(jsonData.entity[0].fields.length).to.eql(4);", "});", - "pm.test(\"Content Type has a Story_block_field\", function() {", - " pm.expect(contentType.fields[1].fieldType).to.eql(\"Story-Block\");", + "", + "pm.test(\"description check\", function () {", + " pm.expect(jsonData.entity[0].description).to.eql('THE DESCRIPTION');", "});" ], "type": "text/javascript", @@ -667,15 +975,15 @@ ] }, "method": "POST", - "header": [], + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"system\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"\",\n \"host\": \"SYSTEM_HOST\",\n \"folder\":\"SYSTEM_FOLDER\",\n \"name\":\"TestContentTypeWithStoryBlockField\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t},\n {\n \"clazz\":\"com.dotcms.contenttype.model.field.ImmutableStoryBlockField\",\n \"required\":false,\n \"name\":\"block\",\n \"defaultValue\":\"\",\n \"hint\":\"\",\n \"searchable\":true\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\", \n \"defaultType\": false, \n \"name\": \"Test Content Type\", \n \"description\": \"THE DESCRIPTION\", \n \"host\": \"SYSTEM_HOST\", \n \"owner\": \"dotcms.org.1\", \n \"fixed\": false, \n \"system\": false, \n \"folder\": \"SYSTEM_FOLDER\",\n \"fields\": [\n {\n \"dataType\": \"SYSTEM\",\n \"dbColumn\": \"system_field1\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Host/Folder\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n },\n {\n \"dataType\": \"LONG_TEXT\",\n \"dbColumn\": \"text_area2\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1453474468000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTagField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Tags\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"tags\"\n }],\n \"workflow\": [\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}\n" }, "url": { "raw": "{{serverURL}}/api/v1/contenttype", @@ -688,26 +996,34 @@ "contenttype" ] }, - "description": "Creates a contentType with 2 fields:\n- A text field named Title\n- A story block field named block" + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." }, "response": [] }, { - "name": "Create contentlet with StoryBlockField", + "name": "Get Content Type", "event": [ { "listen": "test", "script": { "exec": [ "var jsonData = pm.response.json();", - "pm.test(\"Status code should be 200\", function() {", + "", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", "});", - "pm.test(\"Contentlet StoryBlock has value\", function() {", - " pm.expect(jsonData.entity.block.content[0].content[0].text).contains(\"Wow, this editor instance exports its content as JSON\");", + "", + "", + "pm.test(\"fields check\", function () {", + " pm.expect(jsonData.entity.fields.length).to.eql(4);", + "});", + "", + "pm.test(\"description check\", function () {", + " pm.expect(jsonData.entity.description).to.eql('THE DESCRIPTION');", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -736,49 +1052,44 @@ } ] }, - "method": "PUT", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"contentlet\": {\n \"contentType\": \"{{contentTypeIdWithStoryBlock}}\",\n \"name\": \"test with data block field\",\n \"title\": \"test with data block field\",\n \"block\": \"{\\\"type\\\": \\\"doc\\\",\\\"content\\\": [{\\\"type\\\": \\\"paragraph\\\",\\\"content\\\": [{\\\"type\\\": \\\"text\\\",\\\"text\\\": \\\"Wow, this editor instance exports its content as JSON.\\\"}]}]}\"\n }\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "workflow", - "actions", - "default", - "fire", - "PUBLISH" + "contenttype", + "id", + "{{contentTypeID}}" ] - } + }, + "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." }, "response": [] - } - ] - }, - { - "name": "Test Get ContentTypes", - "item": [ + }, { - "name": "Get ContentTypes sending HostID", + "name": "Update Content Type without sending variable success", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 200\", function () {", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"fields check\", function () {", + " pm.expect(jsonData.entity.fields.length).to.eql(3);", + "});", + "", + "pm.test(\"description check\", function () {", + " pm.expect(jsonData.entity.description).to.eql('THE DESCRIPTION');", "});" ], "type": "text/javascript" @@ -810,42 +1121,42 @@ } ] }, - "method": "GET", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"THE DESCRIPTION\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"contentTypeId\": \"{{contentTypeID}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Host-Folder\",\n \"fieldTypeLabel\": \"Site or Folder\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"id\": \"{{contentTypeFieldID}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1632506750000,\n \"name\": \"Host/Folder CHANGED\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n }\n ],\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"Test Content Type\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype?host=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" - ], - "query": [ - { - "key": "host", - "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d" - } + "contenttype", + "id", + "{{contentTypeID}}" ] - } + }, + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." }, "response": [] }, { - "name": "Get ContentTypes sending SYSTEM_HOST", + "name": "Delete ContentType", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Amount of ContentTypes could be greather or eql than 10\", function () {", - " pm.expect(jsonData.entity.length).to.be.gte(10);", - "});", - "", - "pm.test(\"Status code should be 200\", function () {", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", "});" ], @@ -854,86 +1165,112 @@ } ], "request": { - "method": "GET", + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "DELETE", "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype?host=SYSTEM_HOST", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" - ], - "query": [ - { - "key": "host", - "value": "SYSTEM_HOST" - } + "contenttype", + "id", + "{{contentTypeID}}" ] - } + }, + "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." }, "response": [] }, { - "name": "Get ContentTypes without any param", + "name": "Create ContentType Unsupported Media Type", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Amount of ContentTypes could be greather or eql than 10\", function () {", - " pm.expect(jsonData.entity.length).to.be.gte(10);", + "// Validate the response status is 415", + "pm.test(\"Response status is 415\", function () {", + " pm.response.to.have.status(415);", "});", "", - "pm.test(\"Status code should be 200\", function () {", - " pm.response.to.have.status(200);", - "});" + "// Validate that the response body contains the 'message' property and it is not empty", + "pm.test(\"Response should have an error message\", function () {", + " const responseBody = pm.response.json();", + " pm.expect(responseBody).to.have.property('message').that.is.not.empty;", + " pm.expect(responseBody.message).to.equal('HTTP 415 Unsupported Media Type');", + "});", + "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } ] - } - }, - "response": [] - }, - { - "name": "Get ContentTypes sending not existing hostID", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/javascript" } - } - ], - "request": { - "method": "GET", - "header": [], + ], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\", \n \"defaultType\": false, \n \"name\": \"Test Content Type\", \n \"description\": \"THE DESCRIPTION\", \n \"host\": \"SYSTEM_HOST\", \n \"owner\": \"dotcms.org.1\", \n \"fixed\": false, \n \"system\": false, \n \"folder\": \"SYSTEM_FOLDER\",\n \"fields\": [\n {\n \"dataType\": \"SYSTEM\",\n \"dbColumn\": \"system_field1\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Host/Folder\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n },\n {\n \"dataType\": \"LONG_TEXT\",\n \"dbColumn\": \"text_area2\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1453474468000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTagField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Tags\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"tags\"\n }],\n \"workflow\": [\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}\n" + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype?host=aaaaa-aaaa-aaaa-aaaaaa", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], @@ -941,35 +1278,34 @@ "api", "v1", "contenttype" - ], - "query": [ - { - "key": "host", - "value": "aaaaa-aaaa-aaaa-aaaaaa" - } ] - } + }, + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." }, "response": [] }, { - "name": "Get existing Base Content Type", + "name": "Filter ContentType Unsupported Media Type", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", + "// Validate the response status is 415", + "pm.test(\"Response status is 415\", function () {", + " pm.response.to.have.status(415);", "});", "", - "pm.test(\"Checking that there are at least 1 Content Type of Base Type 'dotAsset'\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.gte(1, \"There MUST be at least one Content Type of Base Type 'dotAsset'\");", + "// Validate that the response body contains the 'message' property and it is not empty", + "pm.test(\"Response should have an error message\", function () {", + " const responseBody = pm.response.json();", + " pm.expect(responseBody).to.have.property('message').that.is.not.empty;", + " pm.expect(responseBody.message).to.equal('HTTP 415 Unsupported Media Type');", "});", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -977,1000 +1313,705 @@ "auth": { "type": "basic", "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { "key": "username", "value": "admin@dotcms.com", "type": "string" }, { - "key": "password", - "value": "admin", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?type=DOTASSET&orderby=name", + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/javascript" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\", \n \"defaultType\": false, \n \"name\": \"Test Content Type\", \n \"description\": \"THE DESCRIPTION\", \n \"host\": \"SYSTEM_HOST\", \n \"owner\": \"dotcms.org.1\", \n \"fixed\": false, \n \"system\": false, \n \"folder\": \"SYSTEM_FOLDER\",\n \"fields\": [\n {\n \"dataType\": \"SYSTEM\",\n \"dbColumn\": \"system_field1\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Host/Folder\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n },\n {\n \"dataType\": \"LONG_TEXT\",\n \"dbColumn\": \"text_area2\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1453474468000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTagField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Tags\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"tags\"\n }],\n \"workflow\": [\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}\n" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/_filter", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" - ], - "query": [ - { - "key": "type", - "value": "DOTASSET" - }, - { - "key": "orderby", - "value": "name" - } + "contenttype", + "_filter" ] }, - "description": "Returns all Content Types whose Base Type is 'dotAsset'. **There must be AT LEAST one Content Type of such a Base Type.**" + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." }, "response": [] }, { - "name": "Get non-existing Base Content Type", + "name": "Update Content Type Unsupported Media Type", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 400\", function () {", - " pm.response.to.have.status(400);", + "// Validate the response status is 415", + "pm.test(\"Response status is 415\", function () {", + " pm.response.to.have.status(415);", "});", "", - "pm.test(\"Checking that the error message is present\", function () {", - " const message = pm.response.json().message;", - " pm.expect(message).to.contain(\"FORM2\", \"The returned error message may not be\")", + "// Validate that the response body contains the 'message' property and it is not empty", + "pm.test(\"Response should have an error message\", function () {", + " const responseBody = pm.response.json();", + " pm.expect(responseBody).to.have.property('message').that.is.not.empty;", + " pm.expect(responseBody.message).to.equal('HTTP 415 Unsupported Media Type');", "});", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "content-type": true + } + }, "request": { "auth": { "type": "basic", "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { "key": "username", "value": "admin@dotcms.com", "type": "string" }, { - "key": "password", - "value": "admin", - "type": "string" + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, - "method": "GET", - "header": [], + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/javascript", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"THE DESCRIPTION\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"contentTypeId\": \"{{contentTypeID}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Host-Folder\",\n \"fieldTypeLabel\": \"Site or Folder\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"id\": \"{{contentTypeFieldID}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1632506750000,\n \"name\": \"Host/Folder CHANGED\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n }\n ],\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"Test Content Type\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype?filter=filter&page=3&per_page=4&type=FORM2&orderby=name", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" - ], - "query": [ - { - "key": "filter", - "value": "filter" - }, - { - "key": "page", - "value": "3" - }, - { - "key": "per_page", - "value": "4" - }, - { - "key": "type", - "value": "FORM2" - }, - { - "key": "orderby", - "value": "name" - } + "contenttype", + "id", + "{{contentTypeID}}" ] }, - "description": "Requesting an invalid Base Content Type will return an error message and an HTTP Status 400." + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." }, "response": [] } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } ] }, { - "name": "Test ContentType With Field Variables", + "name": "Tests For New StoryBlockField", "item": [ { - "name": "Create Test Data", - "item": [ + "name": "Create ContentType with StoryBlockField Success", + "event": [ { - "name": "Create ContentType with field variables", - "event": [ + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "var contentType = jsonData.entity[0];", + "pm.collectionVariables.set(\"contentTypeIdWithStoryBlock\", contentType.id);", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200);", + "});", + "pm.test(\"Content Type should have 4 fields\", function() {", + " pm.expect(contentType.fields.length).to.eql(4);", + "});", + "pm.test(\"Content Type has a Story_block_field\", function() {", + " pm.expect(contentType.fields[3].fieldType).to.eql(\"Story-Block\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "var contentType = jsonData.entity[0];", - "pm.collectionVariables.set(\"contentTypeId\", contentType.id);", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200);", - "});", - "pm.test(\"Content Type has the provided name\", function() {", - " pm.expect(contentType.name).to.eql(\"WYSIWYG-Content\");", - "});", - "pm.test(\"Content Type should have 4 fields\", function() {", - " pm.expect(contentType.fields.length).to.eql(4);", - "});", - "pm.collectionVariables.set(\"contentType.host\", contentType.host);", - "pm.collectionVariables.set(\"contentType.field1\", contentType.fields[0].id);", - "pm.collectionVariables.set(\"contentType.field2\", contentType.fields[1].id);", - "pm.collectionVariables.set(\"contentType.field3\", contentType.fields[2].id);", - "pm.collectionVariables.set(\"contentType.field4\", contentType.fields[3].id);", - "pm.collectionVariables.set(\"contentType.field4.varName\", contentType.fields[3].variable);", - "pm.collectionVariables.set(\"contentType.divider\", contentType.layout[0].divider.id);", - "pm.collectionVariables.set(\"contentType.columnDivider\", contentType.layout[0].columns[0].columnDivider.id);", - "var wysigygField = contentType.fields[3];", - "var secondVar = wysigygField.fieldVariables[1];", - "pm.test(\"Variable should have its key and value with hello:world\", function() {", - " pm.expect(secondVar.key).to.eql(\"hello\");", - " pm.expect(secondVar.value).to.eql(\"world\");", - "});", - "pm.test(\"WYSIWYG must exist and have 3 variables\", function() {", - " pm.expect(wysigygField.fieldType).to.eql(\"WYSIWYG\");", - " pm.expect(wysigygField.fieldVariables.length).to.eql(3);", - "});", - "var tinyMcePropsVar = wysigygField.fieldVariables[2];", - "pm.test(\"WYSIWYG tinymceoprops variable is present with value\", function() {", - " pm.expect(tinyMcePropsVar.key).to.eql(\"tinymceprops\");", - " pm.expect(tinyMcePropsVar.value).to.eql(\"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" }, { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "password", - "value": "admin", - "type": "string" - } - ] + "key": "username", + "value": "admin@dotcms.com", + "type": "string" }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\t\"baseType\": \"CONTENT\",\n\t\t\"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n\t\t\"defaultType\": false,\n\t\t\"fields\": [{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\"fieldType\": \"Row\",\n\t\t\t\"fieldTypeLabel\": \"Row\",\n\t\t\t\"fieldVariables\": [],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168604000,\n\t\t\t\"indexed\": false,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168642000,\n\t\t\t\"name\": \"fields-0\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": false,\n\t\t\t\"sortOrder\": 0,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"fields0\"\n\t\t}, {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\"fieldType\": \"Column\",\n\t\t\t\"fieldTypeLabel\": \"Column\",\n\t\t\t\"fieldVariables\": [],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168604000,\n\t\t\t\"indexed\": false,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168642000,\n\t\t\t\"name\": \"fields-1\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": false,\n\t\t\t\"sortOrder\": 1,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"fields1\"\n\t\t}, {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"fieldType\": \"Text\",\n\t\t\t\"fieldTypeLabel\": \"Text\",\n\t\t\t\"fieldVariables\": [],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168746000,\n\t\t\t\"indexed\": true,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168746000,\n\t\t\t\"name\": \"Title\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"title\"\n\t\t}, {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n\t\t\t\"dataType\": \"LONG_TEXT\",\n\t\t\t\"fieldType\": \"WYSIWYG\",\n\t\t\t\"fieldTypeLabel\": \"WYSIWYG\",\n\t\t\t\"fieldVariables\": [{\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\"key\": \"foo\",\n\t\t\t\t\"value\": \"bar\"\n\t\t\t}, {\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\"key\": \"hello\",\n\t\t\t\t\"value\": \"world\"\n\t\t\t}, {\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\"key\": \"tinymceprops\",\n\t\t\t\t\"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n\t\t\t}],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168642000,\n\t\t\t\"indexed\": true,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168746000,\n\t\t\t\"name\": \"component\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": true,\n\t\t\t\"sortOrder\": 3,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"component\"\n\t\t}],\n\t\t\"fixed\": false,\n\t\t\"folder\": \"SYSTEM_FOLDER\",\n\t\t\"host\": \"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n\t\t\"iDate\": 1606168519000,\n\t\t\"layout\": [{\n\t\t\t\"divider\": {\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n\t\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\t\"fieldType\": \"Row\",\n\t\t\t\t\"fieldTypeLabel\": \"Row\",\n\t\t\t\t\"fieldVariables\": [],\n\t\t\t\t\"fixed\": false,\n\t\t\t\t\"iDate\": 1606168604000,\n\t\t\t\t\"indexed\": false,\n\t\t\t\t\"listed\": false,\n\t\t\t\t\"modDate\": 1606168642000,\n\t\t\t\t\"name\": \"fields-0\",\n\t\t\t\t\"readOnly\": false,\n\t\t\t\t\"required\": false,\n\t\t\t\t\"searchable\": false,\n\t\t\t\t\"sortOrder\": 0,\n\t\t\t\t\"unique\": false,\n\t\t\t\t\"variable\": \"fields0\"\n\t\t\t},\n\t\t\t\"columns\": [{\n\t\t\t\t\"columnDivider\": {\n\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n\t\t\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\t\t\"fieldType\": \"Column\",\n\t\t\t\t\t\"fieldTypeLabel\": \"Column\",\n\t\t\t\t\t\"fieldVariables\": [],\n\t\t\t\t\t\"fixed\": false,\n\t\t\t\t\t\"iDate\": 1606168604000,\n\t\t\t\t\t\"indexed\": false,\n\t\t\t\t\t\"listed\": false,\n\t\t\t\t\t\"modDate\": 1606168642000,\n\t\t\t\t\t\"name\": \"fields-1\",\n\t\t\t\t\t\"readOnly\": false,\n\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\"searchable\": false,\n\t\t\t\t\t\"sortOrder\": 1,\n\t\t\t\t\t\"unique\": false,\n\t\t\t\t\t\"variable\": \"fields1\"\n\t\t\t\t},\n\t\t\t\t\"fields\": [{\n\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n\t\t\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\t\t\"fieldType\": \"Text\",\n\t\t\t\t\t\"fieldTypeLabel\": \"Text\",\n\t\t\t\t\t\"fieldVariables\": [],\n\t\t\t\t\t\"fixed\": false,\n\t\t\t\t\t\"iDate\": 1606168746000,\n\t\t\t\t\t\"indexed\": true,\n\t\t\t\t\t\"listed\": false,\n\t\t\t\t\t\"modDate\": 1606168746000,\n\t\t\t\t\t\"name\": \"Title\",\n\t\t\t\t\t\"readOnly\": false,\n\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\"searchable\": true,\n\t\t\t\t\t\"sortOrder\": 2,\n\t\t\t\t\t\"unique\": false,\n\t\t\t\t\t\"variable\": \"title\"\n\t\t\t\t}, {\n\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n\t\t\t\t\t\"dataType\": \"LONG_TEXT\",\n\t\t\t\t\t\"fieldType\": \"WYSIWYG\",\n\t\t\t\t\t\"fieldTypeLabel\": \"WYSIWYG\",\n\t\t\t\t\t\"fieldVariables\": [{\n\t\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\t\t\"key\": \"foo\",\n\t\t\t\t\t\t\"value\": \"bar\"\n\t\t\t\t\t}, {\n\t\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\t\t\"key\": \"hello\",\n\t\t\t\t\t\t\"value\": \"world\"\n\t\t\t\t\t}, {\n\t\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\t\t\"key\": \"tinymceprops\",\n\t\t\t\t\t\t\"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n\t\t\t\t\t}],\n\t\t\t\t\t\"fixed\": false,\n\t\t\t\t\t\"iDate\": 1606168642000,\n\t\t\t\t\t\"indexed\": true,\n\t\t\t\t\t\"listed\": false,\n\t\t\t\t\t\"modDate\": 1606168746000,\n\t\t\t\t\t\"name\": \"component\",\n\t\t\t\t\t\"readOnly\": false,\n\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\"searchable\": true,\n\t\t\t\t\t\"sortOrder\": 3,\n\t\t\t\t\t\"unique\": false,\n\t\t\t\t\t\"variable\": \"component\"\n\t\t\t\t}]\n\t\t\t}]\n\t\t}],\n\t\t\"modDate\": 1606177211000,\n\t\t\"multilingualable\": false,\n\t\t\"name\": \"WYSIWYG-Content\",\n\t\t\"system\": false,\n\t\t\"systemActionMappings\": {},\n\t\t\"variable\": \"WysiwygContent\",\n\t\t\"versionable\": true,\n\t\t\"workflows\": []\n\t}" + { + "key": "saveHelperData", + "type": "any" }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that WYSIWYG field is created with provided field variables." - }, - "response": [] - }, - { - "name": "Update ContentType with field variables", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "var contentType = jsonData.entity", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200);", - "});", - "pm.test(\"Content Type has the provided name\", function() {", - " pm.expect(contentType.name).to.eql(\"WYSIWYG-Content-Renamed\");", - "});", - "pm.test(\"Content Type should have 4 fields\", function() {", - " pm.expect(contentType.fields.length).to.eql(4);", - "});", - "var wysigygField = contentType.fields[3];", - "pm.test(\"WYSIWYG must exist and have 2 variables\", function() {", - " pm.expect(wysigygField.fieldType).to.eql(\"WYSIWYG\");", - " pm.expect(wysigygField.fieldVariables.length).to.eql(2);", - "});", - "var firstVar = wysigygField.fieldVariables[0];", - "pm.test(\"Variable should have its key and value modified to hola:mundo\", function() {", - " pm.expect(firstVar.key).to.eql(\"hola\");", - " pm.expect(firstVar.value).to.eql(\"mundo\");", - "});", - "var tinyMcePropsVar = wysigygField.fieldVariables[1];", - "pm.test(\"WYSIWYG tinymceoprops variable is present with value\", function() {", - " pm.expect(tinyMcePropsVar.key).to.eql(\"tinymceprops\");", - " pm.expect(tinyMcePropsVar.value).to.eql(\"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\");", - "});" - ], - "type": "text/javascript" - } + "key": "showPassword", + "value": false, + "type": "boolean" } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"baseType\": \"CONTENT\",\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"defaultType\": false,\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field2}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field3}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"title\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"id\": \"6bf0f909-7f33-43a3-9b9c-fd7551fa73d7\",\n \"key\": \"hola\",\n \"value\": \"mundo\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ],\n \"fixed\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"host\": \"{{contentType.host}}\",\n \"iDate\": 1606168519000,\n \"id\": \"{{contentTypeId}}\",\n \"layout\": [\n {\n \"divider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.divider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n \"columns\": [\n {\n \"columnDivider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.columnDivider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"title\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6bf0f909-7f33-43a3-9b9c-fd7551fa73d7\",\n \"key\": \"hola\",\n \"value\": \"mundo\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ]\n }\n ]\n }\n ],\n \"modDate\": 1607013655000,\n \"multilingualable\": false,\n \"name\": \"WYSIWYG-Content-Renamed\",\n \"system\": false,\n \"systemActionMappings\": {},\n \"variable\": \"WysiwygContent\",\n \"versionable\": true,\n \"workflows\": [\n {\n \"archived\": false,\n \"creationDate\": 1607013267018,\n \"defaultScheme\": false,\n \"description\": \"\",\n \"entryActionId\": null,\n \"id\": \"{{contentType.workflow}}\",\n \"mandatory\": false,\n \"modDate\": 1607013261505,\n \"name\": \"System Workflow\",\n \"system\": true\n }\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Given a content type payload containing field variables.\nWhen sending a PUT.\nExpect that code is 200.\nExpect content type is updated with the provided fields.\nExpect that WYSIWYG field is updated with provided field variables." - }, - "response": [] + ] }, - { - "name": "Update ContentType with field variables - delete - update - add", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "var contentType = jsonData.entity", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200);", - "});", - "pm.test(\"Content Type has the provided name\", function() {", - " pm.expect(contentType.name).to.eql(\"WYSIWYG-Content-Renamed2\");", - "});", - "pm.test(\"Content Type should have 4 fields\", function() {", - " pm.expect(contentType.fields.length).to.eql(4);", - "});", - "var wysigygField = contentType.fields[3];", - "pm.test(\"WYSIWYG must exist and have 2 variables\", function() {", - " pm.expect(wysigygField.fieldType).to.eql(\"WYSIWYG\");", - " pm.expect(wysigygField.fieldVariables.length).to.eql(2);", - "});", - "var firstVar = wysigygField.fieldVariables[0];", - "pm.test(\"Variable should have its key and value modified to hola:mundo\", function() {", - " pm.expect(firstVar.key).to.eql(\"hi\");", - " pm.expect(firstVar.value).to.eql(\"all\");", - " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", firstVar.id);", - " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.key\", firstVar.key);", - "});", - "var tinyMcePropsVar = wysigygField.fieldVariables[1];", - "pm.test(\"WYSIWYG tinymceoprops variable is present with value\", function() {", - " pm.expect(tinyMcePropsVar.key).to.eql(\"tinymceprops\");", - " pm.expect(tinyMcePropsVar.value).to.eql(\"{toolbar:\\\"true\\\",menu:\\\"true\\\", theme:\\\"advanced\\\"}\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"system\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"\",\n \"host\": \"SYSTEM_HOST\",\n \"folder\":\"SYSTEM_FOLDER\",\n \"name\":\"TestContentTypeWithStoryBlockField\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t},\n {\n \"clazz\":\"com.dotcms.contenttype.model.field.ImmutableStoryBlockField\",\n \"required\":false,\n \"name\":\"block\",\n \"defaultValue\":\"\",\n \"hint\":\"\",\n \"searchable\":true\n }\n ]\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"baseType\": \"CONTENT\",\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"defaultType\": false,\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field2}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field3}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"titleNew\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"key\": \"hi\",\n \"value\": \"all\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"true\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ],\n \"fixed\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"host\": \"{{contentType.host}}\",\n \"iDate\": 1606168519000,\n \"id\": \"{{contentTypeId}}\",\n \"layout\": [\n {\n \"divider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.divider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n \"columns\": [\n {\n \"columnDivider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.columnDivider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"title\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6bf0f909-7f33-43a3-9b9c-fd7551fa73d7\",\n \"key\": \"hola\",\n \"value\": \"mundo\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ]\n }\n ]\n }\n ],\n \"modDate\": 1607013655000,\n \"multilingualable\": false,\n \"name\": \"WYSIWYG-Content-Renamed2\",\n \"system\": false,\n \"systemActionMappings\": {},\n \"variable\": \"WysiwygContent\",\n \"versionable\": true,\n \"workflows\": [\n {\n \"archived\": false,\n \"creationDate\": 1607013267018,\n \"defaultScheme\": false,\n \"description\": \"\",\n \"entryActionId\": null,\n \"id\": \"{{contentType.workflow}}\",\n \"mandatory\": false,\n \"modDate\": 1607013261505,\n \"name\": \"System Workflow\",\n \"system\": true\n }\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Given a content type payload containing field variables.\nWhen sending a PUT.\nExpect that code is 200.\nExpect content type is updated with the provided fields.\nExpect that WYSIWYG field is updated with provided field variables." - }, - "response": [] - } - ] + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Creates a contentType with 2 fields:\n- A text field named Title\n- A story block field named block" + }, + "response": [] }, { - "name": "Field Variables - With User", - "item": [ + "name": "Create contentlet with StoryBlockField", + "event": [ { - "name": "Create Field Variable using Field ID", - "event": [ + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200);", + "});", + "pm.test(\"Contentlet StoryBlock has value\", function() {", + " pm.expect(jsonData.entity.block.content[0].content[0].text).contains(\"Wow, this editor instance exports its content as JSON\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" }, { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", jsonData.entity.id);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable created with ID\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "id", - "{{contentType.field4}}", - "variables" - ] + "key": "username", + "value": "admin@dotcms.com", + "type": "string" }, - "description": "Attempts to create a new Field Variable without User authentication." - }, - "response": [] - }, - { - "name": "Create Field Variable using Var Name", - "event": [ { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "saveHelperData", + "type": "any" }, { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", jsonData.entity.id);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "showPassword", + "value": false, + "type": "boolean" } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable created with Var Name\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "var", - "{{contentType.field4.varName}}", - "variables" - ] - }, - "description": "Attempts to create a new Field Variable without User authentication." - }, - "response": [] + ] + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"contentlet\": {\n \"contentType\": \"{{contentTypeIdWithStoryBlock}}\",\n \"name\": \"test with data block field\",\n \"title\": \"test with data block field\",\n \"block\": \"{\\\"type\\\": \\\"doc\\\",\\\"content\\\": [{\\\"type\\\": \\\"paragraph\\\",\\\"content\\\": [{\\\"type\\\": \\\"text\\\",\\\"text\\\": \\\"Wow, this editor instance exports its content as JSON.\\\"}]}]}\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Test Get ContentTypes", + "item": [ + { + "name": "Get ContentTypes sending HostID", + "event": [ { - "name": "Get All Field Variables using Field ID", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" }, { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - "});", - "", - "pm.test(\"There must be only two Field Variables\", function () {", - " pm.expect(pm.response.json().entity.length).to.equal(2, 'There must be only 2 Field Variables at this point');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "id", - "{{contentType.field4}}", - "variables" - ] + "key": "username", + "value": "admin@dotcms.com", + "type": "string" }, - "description": "Attempts to create a new Field Variable without User authentication." - }, - "response": [] - }, - { - "name": "Get All Field Variables using Field Var Name", - "event": [ { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "saveHelperData", + "type": "any" }, { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - "});", - "", - "pm.test(\"There must be only two Field Variables\", function () {", - " pm.expect(pm.response.json().entity.length).to.equal(2, 'There must be only 2 Field Variables at this point');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "showPassword", + "value": false, + "type": "boolean" } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "var", - "{{contentType.field4.varName}}", - "variables" - ] - }, - "description": "Attempts to create a new Field Variable without User authentication." - }, - "response": [] + ] }, - { - "name": "Get Field Variable using Field ID", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?host=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "host", + "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d" } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "id", - "{{contentType.field4}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" - ] - }, - "description": "Attempts to create a new Field Variable without User authentication." - }, - "response": [] - }, + ] + } + }, + "response": [] + }, + { + "name": "Get ContentTypes sending SYSTEM_HOST", + "event": [ { - "name": "Get Field Variable using Var Name", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Amount of ContentTypes could be greather or eql than 10\", function () {", + " pm.expect(jsonData.entity.length).to.be.gte(10);", + "});", + "", + "pm.test(\"Status code should be 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?host=SYSTEM_HOST", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "host", + "value": "SYSTEM_HOST" } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "var", - "{{contentType.field4.varName}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" - ] - }, - "description": "Attempts to create a new Field Variable without User authentication." - }, - "response": [] - }, + ] + } + }, + "response": [] + }, + { + "name": "Get ContentTypes without any param", + "event": [ { - "name": "Update Field Variable using Field ID", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Amount of ContentTypes could be greather or eql than 10\", function () {", + " pm.expect(jsonData.entity.length).to.be.gte(10);", + "});", + "", + "pm.test(\"Status code should be 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + } + }, + "response": [] + }, + { + "name": "Get ContentTypes sending not existing hostID", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?host=aaaaa-aaaa-aaaa-aaaaaa", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "host", + "value": "aaaaa-aaaa-aaaa-aaaaaa" + } + ] + } + }, + "response": [] + }, + { + "name": "Get existing Base Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that there are at least 1 Content Type of Base Type 'dotAsset'\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.gte(1, \"There MUST be at least one Content Type of Base Type 'dotAsset'\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" }, { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?type=DOTASSET&orderby=name", + "host": [ + "{{serverURL}}" ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable updated with ID\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "id", - "{{contentType.field4}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" - ] + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "type", + "value": "DOTASSET" }, - "description": "Attempts to update a Field Variable without User authentication." - }, - "response": [] + { + "key": "orderby", + "value": "name" + } + ] }, + "description": "Returns all Content Types whose Base Type is 'dotAsset'. **There must be AT LEAST one Content Type of such a Base Type.**" + }, + "response": [] + }, + { + "name": "Get non-existing Base Content Type", + "event": [ { - "name": "Update Field Variable using Var Name", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Checking that the error message is present\", function () {", + " const message = pm.response.json().message;", + " pm.expect(message).to.contain(\"FORM2\", \"The returned error message may not be\")", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" }, { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?filter=filter&page=3&per_page=4&type=FORM2&orderby=name", + "host": [ + "{{serverURL}}" ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "filter", + "value": "filter" }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable updated with Var Name\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" - } - } + { + "key": "page", + "value": "3" }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "var", - "{{contentType.field4.varName}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" - ] + { + "key": "per_page", + "value": "4" }, - "description": "Attempts to update a Field Variable without User authentication." - }, - "response": [] + { + "key": "type", + "value": "FORM2" + }, + { + "key": "orderby", + "value": "name" + } + ] }, + "description": "Requesting an invalid Base Content Type will return an error message and an HTTP Status 400." + }, + "response": [] + } + ] + }, + { + "name": "Test ContentType With Field Variables", + "item": [ + { + "name": "Create Test Data", + "item": [ { - "name": "Delete Field Variable using Field ID", + "name": "Create ContentType with field variables", "event": [ { - "listen": "prerequest", + "listen": "test", "script": { "exec": [ - "" + "var jsonData = pm.response.json();", + "var contentType = jsonData.entity[0];", + "pm.collectionVariables.set(\"contentTypeId\", contentType.id);", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200);", + "});", + "pm.test(\"Content Type has the provided name\", function() {", + " pm.expect(contentType.name).to.eql(\"WYSIWYG-Content\");", + "});", + "pm.test(\"Content Type should have 4 fields\", function() {", + " pm.expect(contentType.fields.length).to.eql(4);", + "});", + "pm.collectionVariables.set(\"contentType.host\", contentType.host);", + "pm.collectionVariables.set(\"contentType.field1\", contentType.fields[0].id);", + "pm.collectionVariables.set(\"contentType.field2\", contentType.fields[1].id);", + "pm.collectionVariables.set(\"contentType.field3\", contentType.fields[2].id);", + "pm.collectionVariables.set(\"contentType.field4\", contentType.fields[3].id);", + "pm.collectionVariables.set(\"contentType.field4.varName\", contentType.fields[3].variable);", + "pm.collectionVariables.set(\"contentType.divider\", contentType.layout[0].divider.id);", + "pm.collectionVariables.set(\"contentType.columnDivider\", contentType.layout[0].columns[0].columnDivider.id);", + "var wysigygField = contentType.fields[3];", + "var secondVar = wysigygField.fieldVariables[1];", + "pm.test(\"Variable should have its key and value with hello:world\", function() {", + " pm.expect(secondVar.key).to.eql(\"hello\");", + " pm.expect(secondVar.value).to.eql(\"world\");", + "});", + "pm.test(\"WYSIWYG must exist and have 3 variables\", function() {", + " pm.expect(wysigygField.fieldType).to.eql(\"WYSIWYG\");", + " pm.expect(wysigygField.fieldVariables.length).to.eql(3);", + "});", + "var tinyMcePropsVar = wysigygField.fieldVariables[2];", + "pm.test(\"WYSIWYG tinymceoprops variable is present with value\", function() {", + " pm.expect(tinyMcePropsVar.key).to.eql(\"tinymceprops\");", + " pm.expect(tinyMcePropsVar.value).to.eql(\"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\");", + "});" ], "type": "text/javascript", "packages": {} } }, { - "listen": "test", + "listen": "prerequest", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - "});", "" ], "type": "text/javascript", @@ -1980,96 +2021,113 @@ ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ { - "key": "token", - "value": "{{jwt}}", + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "password", + "value": "admin", "type": "string" } ] }, - "method": "DELETE", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\t\"baseType\": \"CONTENT\",\n\t\t\"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n\t\t\"defaultType\": false,\n\t\t\"fields\": [{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\"fieldType\": \"Row\",\n\t\t\t\"fieldTypeLabel\": \"Row\",\n\t\t\t\"fieldVariables\": [],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168604000,\n\t\t\t\"indexed\": false,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168642000,\n\t\t\t\"name\": \"fields-0\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": false,\n\t\t\t\"sortOrder\": 0,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"fields0\"\n\t\t}, {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\"fieldType\": \"Column\",\n\t\t\t\"fieldTypeLabel\": \"Column\",\n\t\t\t\"fieldVariables\": [],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168604000,\n\t\t\t\"indexed\": false,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168642000,\n\t\t\t\"name\": \"fields-1\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": false,\n\t\t\t\"sortOrder\": 1,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"fields1\"\n\t\t}, {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"fieldType\": \"Text\",\n\t\t\t\"fieldTypeLabel\": \"Text\",\n\t\t\t\"fieldVariables\": [],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168746000,\n\t\t\t\"indexed\": true,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168746000,\n\t\t\t\"name\": \"Title\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"title\"\n\t\t}, {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n\t\t\t\"dataType\": \"LONG_TEXT\",\n\t\t\t\"fieldType\": \"WYSIWYG\",\n\t\t\t\"fieldTypeLabel\": \"WYSIWYG\",\n\t\t\t\"fieldVariables\": [{\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\"key\": \"foo\",\n\t\t\t\t\"value\": \"bar\"\n\t\t\t}, {\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\"key\": \"hello\",\n\t\t\t\t\"value\": \"world\"\n\t\t\t}, {\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\"key\": \"tinymceprops\",\n\t\t\t\t\"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n\t\t\t}],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168642000,\n\t\t\t\"indexed\": true,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168746000,\n\t\t\t\"name\": \"component\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": true,\n\t\t\t\"sortOrder\": 3,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"component\"\n\t\t}],\n\t\t\"fixed\": false,\n\t\t\"folder\": \"SYSTEM_FOLDER\",\n\t\t\"host\": \"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n\t\t\"iDate\": 1606168519000,\n\t\t\"layout\": [{\n\t\t\t\"divider\": {\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n\t\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\t\"fieldType\": \"Row\",\n\t\t\t\t\"fieldTypeLabel\": \"Row\",\n\t\t\t\t\"fieldVariables\": [],\n\t\t\t\t\"fixed\": false,\n\t\t\t\t\"iDate\": 1606168604000,\n\t\t\t\t\"indexed\": false,\n\t\t\t\t\"listed\": false,\n\t\t\t\t\"modDate\": 1606168642000,\n\t\t\t\t\"name\": \"fields-0\",\n\t\t\t\t\"readOnly\": false,\n\t\t\t\t\"required\": false,\n\t\t\t\t\"searchable\": false,\n\t\t\t\t\"sortOrder\": 0,\n\t\t\t\t\"unique\": false,\n\t\t\t\t\"variable\": \"fields0\"\n\t\t\t},\n\t\t\t\"columns\": [{\n\t\t\t\t\"columnDivider\": {\n\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n\t\t\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\t\t\"fieldType\": \"Column\",\n\t\t\t\t\t\"fieldTypeLabel\": \"Column\",\n\t\t\t\t\t\"fieldVariables\": [],\n\t\t\t\t\t\"fixed\": false,\n\t\t\t\t\t\"iDate\": 1606168604000,\n\t\t\t\t\t\"indexed\": false,\n\t\t\t\t\t\"listed\": false,\n\t\t\t\t\t\"modDate\": 1606168642000,\n\t\t\t\t\t\"name\": \"fields-1\",\n\t\t\t\t\t\"readOnly\": false,\n\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\"searchable\": false,\n\t\t\t\t\t\"sortOrder\": 1,\n\t\t\t\t\t\"unique\": false,\n\t\t\t\t\t\"variable\": \"fields1\"\n\t\t\t\t},\n\t\t\t\t\"fields\": [{\n\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n\t\t\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\t\t\"fieldType\": \"Text\",\n\t\t\t\t\t\"fieldTypeLabel\": \"Text\",\n\t\t\t\t\t\"fieldVariables\": [],\n\t\t\t\t\t\"fixed\": false,\n\t\t\t\t\t\"iDate\": 1606168746000,\n\t\t\t\t\t\"indexed\": true,\n\t\t\t\t\t\"listed\": false,\n\t\t\t\t\t\"modDate\": 1606168746000,\n\t\t\t\t\t\"name\": \"Title\",\n\t\t\t\t\t\"readOnly\": false,\n\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\"searchable\": true,\n\t\t\t\t\t\"sortOrder\": 2,\n\t\t\t\t\t\"unique\": false,\n\t\t\t\t\t\"variable\": \"title\"\n\t\t\t\t}, {\n\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n\t\t\t\t\t\"dataType\": \"LONG_TEXT\",\n\t\t\t\t\t\"fieldType\": \"WYSIWYG\",\n\t\t\t\t\t\"fieldTypeLabel\": \"WYSIWYG\",\n\t\t\t\t\t\"fieldVariables\": [{\n\t\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\t\t\"key\": \"foo\",\n\t\t\t\t\t\t\"value\": \"bar\"\n\t\t\t\t\t}, {\n\t\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\t\t\"key\": \"hello\",\n\t\t\t\t\t\t\"value\": \"world\"\n\t\t\t\t\t}, {\n\t\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\t\t\"key\": \"tinymceprops\",\n\t\t\t\t\t\t\"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n\t\t\t\t\t}],\n\t\t\t\t\t\"fixed\": false,\n\t\t\t\t\t\"iDate\": 1606168642000,\n\t\t\t\t\t\"indexed\": true,\n\t\t\t\t\t\"listed\": false,\n\t\t\t\t\t\"modDate\": 1606168746000,\n\t\t\t\t\t\"name\": \"component\",\n\t\t\t\t\t\"readOnly\": false,\n\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\"searchable\": true,\n\t\t\t\t\t\"sortOrder\": 3,\n\t\t\t\t\t\"unique\": false,\n\t\t\t\t\t\"variable\": \"component\"\n\t\t\t\t}]\n\t\t\t}]\n\t\t}],\n\t\t\"modDate\": 1606177211000,\n\t\t\"multilingualable\": false,\n\t\t\"name\": \"WYSIWYG-Content\",\n\t\t\"system\": false,\n\t\t\"systemActionMappings\": {},\n\t\t\"variable\": \"WysiwygContent\",\n\t\t\"versionable\": true,\n\t\t\"workflows\": []\n\t}" + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "id", - "{{contentType.field4}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" + "contenttype" ] }, - "description": "Attempts to delete a Field Variable without User authentication." + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that WYSIWYG field is created with provided field variables." }, "response": [] }, { - "name": "Re-Create Test Field Variable", + "name": "Update ContentType with field variables", "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, { "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", + "var jsonData = pm.response.json();", + "var contentType = jsonData.entity", + "pm.test(\"Status code should be 200\", function() {", " pm.response.to.have.status(200);", "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", jsonData.entity.id);", + "pm.test(\"Content Type has the provided name\", function() {", + " pm.expect(contentType.name).to.eql(\"WYSIWYG-Content-Renamed\");", "});", - "" + "pm.test(\"Content Type should have 4 fields\", function() {", + " pm.expect(contentType.fields.length).to.eql(4);", + "});", + "var wysigygField = contentType.fields[3];", + "pm.test(\"WYSIWYG must exist and have 2 variables\", function() {", + " pm.expect(wysigygField.fieldType).to.eql(\"WYSIWYG\");", + " pm.expect(wysigygField.fieldVariables.length).to.eql(2);", + "});", + "var firstVar = wysigygField.fieldVariables[0];", + "pm.test(\"Variable should have its key and value modified to hola:mundo\", function() {", + " pm.expect(firstVar.key).to.eql(\"hola\");", + " pm.expect(firstVar.value).to.eql(\"mundo\");", + "});", + "var tinyMcePropsVar = wysigygField.fieldVariables[1];", + "pm.test(\"WYSIWYG tinymceoprops variable is present with value\", function() {", + " pm.expect(tinyMcePropsVar.key).to.eql(\"tinymceprops\");", + " pm.expect(tinyMcePropsVar.value).to.eql(\"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\");", + "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ { - "key": "token", - "value": "{{jwt}}", + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", "type": "string" } ] }, - "method": "POST", - "header": [], + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable created with ID\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n \"baseType\": \"CONTENT\",\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"defaultType\": false,\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field2}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field3}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"title\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"id\": \"6bf0f909-7f33-43a3-9b9c-fd7551fa73d7\",\n \"key\": \"hola\",\n \"value\": \"mundo\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ],\n \"fixed\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"host\": \"{{contentType.host}}\",\n \"iDate\": 1606168519000,\n \"id\": \"{{contentTypeId}}\",\n \"layout\": [\n {\n \"divider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.divider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n \"columns\": [\n {\n \"columnDivider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.columnDivider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"title\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6bf0f909-7f33-43a3-9b9c-fd7551fa73d7\",\n \"key\": \"hola\",\n \"value\": \"mundo\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ]\n }\n ]\n }\n ],\n \"modDate\": 1607013655000,\n \"multilingualable\": false,\n \"name\": \"WYSIWYG-Content-Renamed\",\n \"system\": false,\n \"systemActionMappings\": {},\n \"variable\": \"WysiwygContent\",\n \"versionable\": true,\n \"workflows\": [\n {\n \"archived\": false,\n \"creationDate\": 1607013267018,\n \"defaultScheme\": false,\n \"description\": \"\",\n \"entryActionId\": null,\n \"id\": \"{{contentType.workflow}}\",\n \"mandatory\": false,\n \"modDate\": 1607013261505,\n \"name\": \"System Workflow\",\n \"system\": true\n }\n ]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], @@ -2077,43 +2135,49 @@ "api", "v1", "contenttype", - "{{contentTypeId}}", - "fields", "id", - "{{contentType.field4}}", - "variables" + "{{contentTypeId}}" ] }, - "description": "Attempts to create a new Field Variable without User authentication." + "description": "Given a content type payload containing field variables.\nWhen sending a PUT.\nExpect that code is 200.\nExpect content type is updated with the provided fields.\nExpect that WYSIWYG field is updated with provided field variables." }, "response": [] }, { - "name": "Delete Field Variable using Var Name", + "name": "Update ContentType with field variables - delete - update - add", "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, { "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", + "var jsonData = pm.response.json();", + "var contentType = jsonData.entity", + "pm.test(\"Status code should be 200\", function() {", " pm.response.to.have.status(200);", "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "pm.test(\"Content Type has the provided name\", function() {", + " pm.expect(contentType.name).to.eql(\"WYSIWYG-Content-Renamed2\");", "});", - "" + "pm.test(\"Content Type should have 4 fields\", function() {", + " pm.expect(contentType.fields.length).to.eql(4);", + "});", + "var wysigygField = contentType.fields[3];", + "pm.test(\"WYSIWYG must exist and have 2 variables\", function() {", + " pm.expect(wysigygField.fieldType).to.eql(\"WYSIWYG\");", + " pm.expect(wysigygField.fieldVariables.length).to.eql(2);", + "});", + "var firstVar = wysigygField.fieldVariables[0];", + "pm.test(\"Variable should have its key and value modified to hola:mundo\", function() {", + " pm.expect(firstVar.key).to.eql(\"hi\");", + " pm.expect(firstVar.value).to.eql(\"all\");", + " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", firstVar.id);", + " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.key\", firstVar.key);", + "});", + "var tinyMcePropsVar = wysigygField.fieldVariables[1];", + "pm.test(\"WYSIWYG tinymceoprops variable is present with value\", function() {", + " pm.expect(tinyMcePropsVar.key).to.eql(\"tinymceprops\");", + " pm.expect(tinyMcePropsVar.value).to.eql(\"{toolbar:\\\"true\\\",menu:\\\"true\\\", theme:\\\"advanced\\\"}\");", + "});" ], "type": "text/javascript", "packages": {} @@ -2122,19 +2186,33 @@ ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ { - "key": "token", - "value": "{{jwt}}", + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", "type": "string" } ] }, - "method": "DELETE", - "header": [], + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"baseType\": \"CONTENT\",\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"defaultType\": false,\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field2}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field3}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"titleNew\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"key\": \"hi\",\n \"value\": \"all\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"true\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ],\n \"fixed\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"host\": \"{{contentType.host}}\",\n \"iDate\": 1606168519000,\n \"id\": \"{{contentTypeId}}\",\n \"layout\": [\n {\n \"divider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.divider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n \"columns\": [\n {\n \"columnDivider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.columnDivider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"title\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6bf0f909-7f33-43a3-9b9c-fd7551fa73d7\",\n \"key\": \"hola\",\n \"value\": \"mundo\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ]\n }\n ]\n }\n ],\n \"modDate\": 1607013655000,\n \"multilingualable\": false,\n \"name\": \"WYSIWYG-Content-Renamed2\",\n \"system\": false,\n \"systemActionMappings\": {},\n \"variable\": \"WysiwygContent\",\n \"versionable\": true,\n \"workflows\": [\n {\n \"archived\": false,\n \"creationDate\": 1607013267018,\n \"defaultScheme\": false,\n \"description\": \"\",\n \"entryActionId\": null,\n \"id\": \"{{contentType.workflow}}\",\n \"mandatory\": false,\n \"modDate\": 1607013261505,\n \"name\": \"System Workflow\",\n \"system\": true\n }\n ]\n}" + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], @@ -2142,59 +2220,19 @@ "api", "v1", "contenttype", - "{{contentTypeId}}", - "fields", - "var", - "{{contentType.field4.varName}}", - "variables", "id", - "{{contentType.field4.fieldVarOne.id}}" + "{{contentTypeId}}" ] }, - "description": "Attempts to delete a Field Variable without User authentication." + "description": "Given a content type payload containing field variables.\nWhen sending a PUT.\nExpect that code is 200.\nExpect content type is updated with the provided fields.\nExpect that WYSIWYG field is updated with provided field variables." }, "response": [] } - ], - "description": "Verifies that CRUD operations on Field Variables are working as expected." + ] }, { - "name": "Field Variables - No User", + "name": "Field Variables - With User", "item": [ - { - "name": "invalidate User Session", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/logout", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "logout" - ] - } - }, - "response": [] - }, { "name": "Create Field Variable using Field ID", "event": [ @@ -2212,12 +2250,14 @@ "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", "});", "", - "pm.test(\"An error message must be returned\", function () {", - " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", jsonData.entity.id);", "});", "" ], @@ -2228,13 +2268,20 @@ ], "request": { "auth": { - "type": "noauth" + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] }, "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\n \"key\": \"test-field-variable\",\n \"value\": \"Value for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "raw": "{\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable created with ID\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", "options": { "raw": { "language": "json" @@ -2278,12 +2325,14 @@ "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", "});", "", - "pm.test(\"An error message must be returned\", function () {", - " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", jsonData.entity.id);", "});", "" ], @@ -2294,13 +2343,20 @@ ], "request": { "auth": { - "type": "noauth" + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] }, "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\n \"key\": \"test-field-variable\",\n \"value\": \"NEW VALUE for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "raw": "{\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable created with Var Name\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", "options": { "raw": { "language": "json" @@ -2328,7 +2384,7 @@ "response": [] }, { - "name": "Update Field Variable using Field ID", + "name": "Get All Field Variables using Field ID", "event": [ { "listen": "prerequest", @@ -2344,12 +2400,17 @@ "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", "});", "", - "pm.test(\"An error message must be returned\", function () {", - " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "});", + "", + "pm.test(\"There must be only two Field Variables\", function () {", + " pm.expect(pm.response.json().entity.length).to.equal(2, 'There must be only 2 Field Variables at this point');", "});", "" ], @@ -2360,21 +2421,19 @@ ], "request": { "auth": { - "type": "noauth" - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"UPDATED VALUE USING ID for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" } - } + ] }, + "method": "GET", + "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", "host": [ "{{serverURL}}" ], @@ -2386,17 +2445,15 @@ "fields", "id", "{{contentType.field4}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" + "variables" ] }, - "description": "Attempts to update a Field Variable without User authentication." + "description": "Attempts to create a new Field Variable without User authentication." }, "response": [] }, { - "name": "Update Field Variable using Var Name", + "name": "Get All Field Variables using Field Var Name", "event": [ { "listen": "prerequest", @@ -2412,12 +2469,17 @@ "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", "});", "", - "pm.test(\"An error message must be returned\", function () {", - " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "});", + "", + "pm.test(\"There must be only two Field Variables\", function () {", + " pm.expect(pm.response.json().entity.length).to.equal(2, 'There must be only 2 Field Variables at this point');", "});", "" ], @@ -2428,21 +2490,19 @@ ], "request": { "auth": { - "type": "noauth" - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"UPDATED VALUE USING VAR NAME for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" } - } + ] }, + "method": "GET", + "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables", "host": [ "{{serverURL}}" ], @@ -2454,17 +2514,15 @@ "fields", "var", "{{contentType.field4.varName}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" + "variables" ] }, - "description": "Attempts to update a Field Variable without User authentication." + "description": "Attempts to create a new Field Variable without User authentication." }, "response": [] }, { - "name": "Delete Field Variable using Field ID", + "name": "Get Field Variable using Field ID", "event": [ { "listen": "prerequest", @@ -2480,12 +2538,13 @@ "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", "});", "", - "pm.test(\"An error message must be returned\", function () {", - " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", "});", "" ], @@ -2496,9 +2555,16 @@ ], "request": { "auth": { - "type": "noauth" + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] }, - "method": "DELETE", + "method": "GET", "header": [], "url": { "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", @@ -2518,12 +2584,12 @@ "{{contentType.field4.fieldVarOne.id}}" ] }, - "description": "Attempts to delete a Field Variable without User authentication." + "description": "Attempts to create a new Field Variable without User authentication." }, "response": [] }, { - "name": "Update Field Variable using Var Name", + "name": "Get Field Variable using Var Name", "event": [ { "listen": "prerequest", @@ -2539,12 +2605,13 @@ "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", "});", "", - "pm.test(\"An error message must be returned\", function () {", - " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", "});", "" ], @@ -2555,9 +2622,16 @@ ], "request": { "auth": { - "type": "noauth" + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] }, - "method": "DELETE", + "method": "GET", "header": [], "url": { "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", @@ -2577,734 +2651,802 @@ "{{contentType.field4.fieldVarOne.id}}" ] }, - "description": "Attempts to delete a Field Variable without User authentication." + "description": "Attempts to create a new Field Variable without User authentication." }, "response": [] - } - ], - "description": "Verifies that CRUD operations on Field Variables DO NOT WORK for the Anonymous User." - }, - { - "name": "Cleanup Content Type", - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - } - ] }, - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - } - }, - "response": [] - } - ], - "description": "Verifies that creating Field Variables for Fields in a Content Type is working as expected." - }, - { - "name": "Test Copy ContentType", - "item": [ - { - "name": "Copy FileAsset Success", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "var contentType = jsonData.entity;", - "", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200);", - "});", - "pm.test(\"Content Type has the provided name\", function() {", - " pm.expect(contentType.name).to.eql(\"File Asset Copy\");", - "});", - "pm.test(\"Content Type should have 9 fields\", function() {", - " pm.expect(contentType.fields.length).to.gt(8);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Update Field Variable using Field ID", + "event": [ { - "key": "password", - "value": "admin", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"File Asset Copy\"\n}", - "options": { - "raw": { - "language": "json" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "fileAsset", - "_copy" - ] - } - }, - "response": [] - }, - { - "name": "ContentType Source does not exist", - "event": [ + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable updated with ID\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "id", + "{{contentType.field4}}", + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" + ] + }, + "description": "Attempts to update a Field Variable without User authentication." + }, + "response": [] + }, { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 400\", function() {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Update Field Variable using Var Name", + "event": [ { - "key": "password", - "value": "admin", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"File Asset Copy\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/fileAssetNotExist/_copy", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "fileAssetNotExist", - "_copy" - ] - } - }, - "response": [] - }, - { - "name": "ContentType Name Not Sent", - "event": [ + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable updated with Var Name\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "var", + "{{contentType.field4.varName}}", + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" + ] + }, + "description": "Attempts to update a Field Variable without User authentication." + }, + "response": [] + }, { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 400\", function() {", - " pm.response.to.have.status(400);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Delete Field Variable using Field ID", + "event": [ { - "key": "password", - "value": "admin", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"variable\": \"FileAssetCopyTestNot\"\n}", - "options": { - "raw": { - "language": "json" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "fileAsset", - "_copy" - ] - } - }, - "response": [] - }, - { - "name": "ContentType Copy no body", - "event": [ + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "id", + "{{contentType.field4}}", + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" + ] + }, + "description": "Attempts to delete a Field Variable without User authentication." + }, + "response": [] + }, { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 400\", function() {", - " pm.response.to.have.status(400);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Re-Create Test Field Variable", + "event": [ { - "key": "password", - "value": "admin", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", jsonData.entity.id);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - ] - }, - "method": "POST", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "fileAsset", - "_copy" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Test Filtered Content Types", - "item": [ - { - "name": "pre - Import Test Content Types", - "event": [ + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable created with ID\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "id", + "{{contentType.field4}}", + "variables" + ] + }, + "description": "Attempts to create a new Field Variable without User authentication." + }, + "response": [] + }, { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Bundle 'bundle-with-content-types-issue-22039.tar.gz' was not uploaded!\", function () {", - " pm.response.to.have.status(200);", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData[\"bundleName\"]).to.eql(\"bundle-with-content-types-issue-22039.tar.gz\");", - " pm.expect(jsonData[\"status\"]).to.eql(\"SUCCESS\");", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Delete Field Variable using Var Name", + "event": [ { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "password", - "value": "admin", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/octet-stream" + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "var", + "{{contentType.field4.varName}}", + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" + ] + }, + "description": "Attempts to delete a Field Variable without User authentication." }, - { - "key": "Content-Disposition", - "value": "attachment" - } - ], - "body": { - "mode": "formdata", - "formdata": [ + "response": [] + } + ], + "description": "Verifies that CRUD operations on Field Variables are working as expected." + }, + { + "name": "Field Variables - No User", + "item": [ + { + "name": "invalidate User Session", + "event": [ { - "key": "file", - "type": "file", - "src": "resources/ContentTypeResource/bundle-with-content-types-issue-22039.tar.gz" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - ] - }, - "url": { - "raw": "{{serverURL}}/api/bundle/sync", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "bundle", - "sync" ], - "query": [ - { - "key": "AUTH_TOKEN", - "value": "", - "disabled": true + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/logout", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "logout" + ] } - ] + }, + "response": [] }, - "description": "Imports a Bundle containing the Content Types that are supposed to exist for the subsequent tests to work as expected." - }, - "response": [] - }, - { - "name": "Get Content Types - First page", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "", - "pm.test(\"Status code must be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"The 'Content (Generic)' type must come first!'\", function () {", - " pm.expect(\"Content (Generic)\").to.equal(jsonData.entity[0].name);", - "});", - "", - "pm.test(\"There must be 3 Content Types in the response only!'\", function () {", - " pm.expect(3).to.equal(jsonData.entity.length);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Create Field Variable using Field ID", + "event": [ { - "key": "password", - "value": "admin", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,htmlpageasset,FileAsset\"\n },\n \"page\": 1,\n \"perPage\": 3\n}", - "options": { - "raw": { - "language": "json" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"An error message must be returned\", function () {", + " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/_filter", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "_filter" - ] + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"key\": \"test-field-variable\",\n \"value\": \"Value for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "id", + "{{contentType.field4}}", + "variables" + ] + }, + "description": "Attempts to create a new Field Variable without User authentication." + }, + "response": [] }, - "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the pagination parameters**." - }, - "response": [] - }, - { - "name": "Get Content Types - Second page", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "", - "pm.test(\"Status code must be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"The 'dotAsset' type must come first!'\", function () {", - " pm.expect(\"dotAsset\").to.equal(jsonData.entity[0].name);", - "});", - "", - "pm.test(\"There must be 2 Content Types in the response only!'\", function () {", - " pm.expect(2).to.equal(jsonData.entity.length);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Create Field Variable using Var Name", + "event": [ { - "key": "password", - "value": "admin", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\"\n },\n \"page\": 2,\n \"perPage\": 3\n}", - "options": { - "raw": { - "language": "json" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"An error message must be returned\", function () {", + " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/_filter", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "_filter" - ] + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"key\": \"test-field-variable\",\n \"value\": \"NEW VALUE for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "var", + "{{contentType.field4.varName}}", + "variables" + ] + }, + "description": "Attempts to create a new Field Variable without User authentication." + }, + "response": [] }, - "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the pagination parameters**." - }, - "response": [] - }, - { - "name": "Get Content Types - Not paginated", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "", - "pm.test(\"Status code must be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"All 5 Content Types in the response only!'\", function () {", - " pm.expect(5).to.equal(jsonData.entity.length);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Update Field Variable using Field ID", + "event": [ { - "key": "password", - "value": "admin", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"An error message must be returned\", function () {", + " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\"\n }\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/_filter", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "_filter" - ] + "request": { + "auth": { + "type": "noauth" + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"UPDATED VALUE USING ID for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "id", + "{{contentType.field4}}", + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" + ] + }, + "description": "Attempts to update a Field Variable without User authentication." + }, + "response": [] }, - "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **without any pagination parameters.**" - }, - "response": [] - }, - { - "name": "Get Content Types - Filtered", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "", - "pm.test(\"Status code must be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Only 2 Content Types with the letters 'ent' should be returned!'\", function () {", - " pm.expect(2).to.equal(jsonData.entity.length);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Update Field Variable using Var Name", + "event": [ { - "key": "password", - "value": "admin", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\",\n \"query\": \"ent\"\n }\n}", - "options": { - "raw": { - "language": "json" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"An error message must be returned\", function () {", + " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/_filter", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "_filter" - ] + "request": { + "auth": { + "type": "noauth" + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"UPDATED VALUE USING VAR NAME for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "var", + "{{contentType.field4.varName}}", + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" + ] + }, + "description": "Attempts to update a Field Variable without User authentication." + }, + "response": [] }, - "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the specified filter including the letters that might be present in either the Content Type's name or Velocity Var Name.**" - }, - "response": [] - }, - { - "name": "Get Content Types - Filtered Paginated", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "", - "pm.test(\"Status code must be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Only 1 Content Type with the letters 'set' should be returned!'\", function () {", - " pm.expect(1).to.equal(jsonData.entity.length);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Delete Field Variable using Field ID", + "event": [ { - "key": "password", - "value": "admin", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\",\n \"query\": \"set\"\n },\n \"page\": 1,\n \"perPage\": 3\n}", - "options": { - "raw": { - "language": "json" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"An error message must be returned\", function () {", + " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/_filter", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "_filter" - ] + "request": { + "auth": { + "type": "noauth" + }, + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "id", + "{{contentType.field4}}", + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" + ] + }, + "description": "Attempts to delete a Field Variable without User authentication." + }, + "response": [] }, - "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the specified filter including the letters that might be present in either the Content Type's name or Velocity Var Name.**\n\nIn this case, the second page is being requested." - }, - "response": [] - }, - { - "name": "Get Content Types - All types", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "", - "pm.test(\"Status code must be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"At least 12 Content Types must be returned, as not filter is set!'\", function () {", - " pm.expect(jsonData.entity.length).to.greaterThan(11)", - "});", - "" - ], - "type": "text/javascript" - } + "name": "Update Field Variable using Var Name", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"An error message must be returned\", function () {", + " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "var", + "{{contentType.field4.varName}}", + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" + ] + }, + "description": "Attempts to delete a Field Variable without User authentication." + }, + "response": [] } ], + "description": "Verifies that CRUD operations on Field Variables DO NOT WORK for the Anonymous User." + }, + { + "name": "Cleanup Content Type", "request": { "auth": { "type": "basic", @@ -3321,19 +3463,10 @@ } ] }, - "method": "POST", + "method": "DELETE", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"orderBy\": \"name\",\n \"direction\": \"ASC\",\n \"perPage\": 40\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], @@ -3341,37 +3474,37 @@ "api", "v1", "contenttype", - "_filter" + "id", + "{{contentTypeId}}" ] - }, - "description": "Returns the appropriate JSON data with **ALL** the Content Types in the content repo as no filtering parameters were provided." + } }, "response": [] } ], - "description": "This Test Collection will verify that the Content Type Filtering Endpoint works as expected. This endpoint can take a list of specific Content Types and perform filtering and pagination operations on them." + "description": "Verifies that creating Field Variables for Fields in a Content Type is working as expected." }, { - "name": "Test Accept Site Names and Folder Path", + "name": "Test Copy ContentType", "item": [ { - "name": "createFolders Success", + "name": "Copy FileAsset Success", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 200\", function () {", + "var jsonData = pm.response.json();", + "var contentType = jsonData.entity;", + "", + "pm.test(\"Status code should be 200\", function() {", " pm.response.to.have.status(200);", - " let jsonData = pm.response.json();", - " pm.expect(jsonData.entity.length).to.be.above(0); ", - " let folder = jsonData.entity[0];", - " pm.expect(folder.title).eql(\"foo2\");", - " pm.expect(folder.type).eql(\"folder\");", - " pm.expect(folder.path).eql(\"/foo1/foo2/\");", - " pm.collectionVariables.set(\"folder\", folder);", - " pm.collectionVariables.set(\"folder.identifier\", folder.identifier);", - " pm.collectionVariables.set(\"folder.hostId\", folder.hostId);", + "});", + "pm.test(\"Content Type has the provided name\", function() {", + " pm.expect(contentType.name).to.eql(\"File Asset Copy\");", + "});", + "pm.test(\"Content Type should have 9 fields\", function() {", + " pm.expect(contentType.fields.length).to.gt(8);", "});" ], "type": "text/javascript" @@ -3398,7 +3531,7 @@ "header": [], "body": { "mode": "raw", - "raw": "[\"/foo1/foo2\"]\n", + "raw": "{\n \"name\": \"File Asset Copy\"\n}", "options": { "raw": { "language": "json" @@ -3406,38 +3539,31 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/folder/createfolders/default", + "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "folder", - "createfolders", - "default" + "contenttype", + "fileAsset", + "_copy" ] } }, "response": [] }, { - "name": "Create ContentType From Given Host Idenifier and Folder Identifier", + "name": "ContentType Source does not exist", "event": [ { "listen": "test", "script": { "exec": [ - "let jsonData = pm.response.json();", - "let contentType = jsonData.entity[0];", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200);", - " let folder = pm.collectionVariables.get(\"folder\");", - " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", - " pm.expect(contentType.folder).to.eql(folder.identifier);", - " pm.expect(contentType.host).to.eql(folder.hostId);", - "})", - "" + "pm.test(\"Status code should be 400\", function() {", + " pm.response.to.have.status(400);", + "});" ], "type": "text/javascript" } @@ -3456,15 +3582,6 @@ "key": "username", "value": "admin@dotcms.com", "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" } ] }, @@ -3472,7 +3589,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"system\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"CT created using the folderPath property\", \n \"host\":\"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n \"folder\":\"{{folder.identifier}}\",\n \"name\":\"SimpleContentTypeFromFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", + "raw": "{\n \"name\": \"File Asset Copy\"\n}", "options": { "raw": { "language": "json" @@ -3480,36 +3597,31 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/fileAssetNotExist/_copy", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "fileAssetNotExist", + "_copy" ] - }, - "description": "Creates a contentType using the folderPath property\n\nExpect success." + } }, "response": [] }, { - "name": "Create ContentType From Given Folder Path", + "name": "ContentType Name Not Sent", "event": [ { "listen": "test", "script": { "exec": [ - "let jsonData = pm.response.json();", - "let contentType = jsonData.entity[0];", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200);", - " let folder = pm.collectionVariables.get(\"folder\");", - " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", - " pm.expect(contentType.folder).to.eql(folder.identifier);", - " pm.expect(contentType.host).to.eql(folder.hostId);", - "})", + "pm.test(\"Status code should be 400\", function() {", + " pm.response.to.have.status(400);", + "});", "" ], "type": "text/javascript" @@ -3529,15 +3641,6 @@ "key": "username", "value": "admin@dotcms.com", "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" } ] }, @@ -3545,7 +3648,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"defaultType\":false,\n \"fixed\":false, \n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"CT created using the folderPath property\", \n \"folderPath\":\"default:/foo1/foo2\",\n \"name\":\"SimpleContentTypeFromFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", + "raw": "{\n \"variable\": \"FileAssetCopyTestNot\"\n}", "options": { "raw": { "language": "json" @@ -3553,36 +3656,31 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "fileAsset", + "_copy" ] - }, - "description": "Creates a contentType using the folderPath property\n\nExpect success." + } }, "response": [] }, { - "name": "Create ContentType From Given Host Name and Folder Path", + "name": "ContentType Copy no body", "event": [ { "listen": "test", "script": { "exec": [ - "let jsonData = pm.response.json();", - "let contentType = jsonData.entity[0];", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200);", - " let folder = pm.collectionVariables.get(\"folder\");", - " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", - " pm.expect(contentType.folder).to.eql(folder.identifier);", - " pm.expect(contentType.host).to.eql(folder.hostId);", - "})", + "pm.test(\"Status code should be 400\", function() {", + " pm.response.to.have.status(400);", + "});", "" ], "type": "text/javascript" @@ -3602,66 +3700,57 @@ "key": "username", "value": "admin@dotcms.com", "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" } ] }, "method": "POST", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"system\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"Here we're sending host name an the folder path separately\", \n \"host\":\"default\",\n \"folderPath\":\"/foo1/foo2\",\n \"name\":\"SimpleContentTypeUsingHostNameAndFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "fileAsset", + "_copy" ] - }, - "description": "Creates a contentType using a host name and folderPath\n\nHere we're sending host name and the folder path only contains the folders bit without the site name portion" + } }, "response": [] }, { - "name": "Create ContentType From Given Host Identifier and Folder Path (no host)", + "name": "Copy FileAsset Unsupported Media Type", "event": [ { "listen": "test", "script": { "exec": [ - "let jsonData = pm.response.json();", - "let contentType = jsonData.entity[0];", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200);", - " let folder = pm.collectionVariables.get(\"folder\");", - " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", - " pm.expect(contentType.folder).to.eql(folder.identifier);", - " pm.expect(contentType.host).to.eql(folder.hostId);", - "})", + "// Validate the response status is 415", + "pm.test(\"Response status is 415\", function () {", + " pm.response.to.have.status(415);", + "});", + "", + "// Validate that the response body contains the 'message' property and it is not empty", + "pm.test(\"Response should have an error message\", function () {", + " const responseBody = pm.response.json();", + " pm.expect(responseBody).to.have.property('message').that.is.not.empty;", + " pm.expect(responseBody.message).to.equal('HTTP 415 Unsupported Media Type');", + "});", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "content-type": true + } + }, "request": { "auth": { "type": "basic", @@ -3675,23 +3764,20 @@ "key": "username", "value": "admin@dotcms.com", "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" } ] }, "method": "POST", - "header": [], + "header": [ + { + "key": "Content-Type", + "value": "application/javascript", + "type": "text" + } + ], "body": { "mode": "raw", - "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"Here we're sending host name an the folder path separately\", \n \"host\":\"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n \"folderPath\":\"/foo1/foo2\",\n \"name\":\"SimpleContentTypeUsingHostIdAndFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", + "raw": "{\n \"name\": \"File Asset Copy\"\n}", "options": { "raw": { "language": "json" @@ -3699,35 +3785,40 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "fileAsset", + "_copy" ] - }, - "description": "Creates a contentType using a host name and folderPath\n\nHere we're sending host name and the folder path only contains the folders bit without the site name portion" + } }, "response": [] - }, + } + ] + }, + { + "name": "Test Filtered Content Types", + "item": [ { - "name": "Create FIXED ContentType Expect System-Host and System-Folder", + "name": "pre - Import Test Content Types", "event": [ { "listen": "test", "script": { "exec": [ - "let jsonData = pm.response.json();", - "let contentType = jsonData.entity[0];", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200); ", - " pm.expect(contentType.folderPath).to.eql(\"/\");", - " pm.expect(contentType.folder).to.eql(\"SYSTEM_FOLDER\");", - " pm.expect(contentType.host).to.eql(\"SYSTEM_HOST\");", - "})" + "pm.test(\"Bundle 'bundle-with-content-types-issue-22039.tar.gz' was not uploaded!\", function () {", + " pm.response.to.have.status(200);", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData[\"bundleName\"]).to.eql(\"bundle-with-content-types-issue-22039.tar.gz\");", + " pm.expect(jsonData[\"status\"]).to.eql(\"SUCCESS\");", + "});" ], "type": "text/javascript" } @@ -3737,126 +3828,86 @@ "auth": { "type": "basic", "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, { "key": "username", "value": "admin@dotcms.com", "type": "string" }, { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" + "key": "password", + "value": "admin", + "type": "string" } ] }, "method": "POST", - "header": [], + "header": [ + { + "key": "Content-Type", + "value": "application/octet-stream" + }, + { + "key": "Content-Disposition", + "value": "attachment" + } + ], "body": { - "mode": "raw", - "raw": "{\n \"defaultType\":false,\n \"fixed\":true, \n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"CT created using the folderPath property\", \n \"folderPath\":\"any:/non-existing-folder\",\n \"name\":\"SimpleContentTypeFromFolderPathNonExistingFolder\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", - "options": { - "raw": { - "language": "json" + "mode": "formdata", + "formdata": [ + { + "key": "file", + "type": "file", + "src": "resources/ContentTypeResource/bundle-with-content-types-issue-22039.tar.gz" } - } + ] }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/bundle/sync", "host": [ "{{serverURL}}" ], "path": [ "api", - "v1", - "contenttype" + "bundle", + "sync" + ], + "query": [ + { + "key": "AUTH_TOKEN", + "value": "", + "disabled": true + } ] }, - "description": "Creates a simple contentType, that uses the folderPath property to set the location" + "description": "Imports a Bundle containing the Content Types that are supposed to exist for the subsequent tests to work as expected." }, "response": [] - } - ] - }, - { - "name": "Field Data", - "item": [ + }, { - "name": "Get All Field Types", + "name": "Get Content Types - First page", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status must be successful\", function() {", + "", + "pm.test(\"Status code must be ok 200\", function () {", " pm.response.to.have.status(200);", "});", "", - "const expectedFieldTypes = pm.collectionVariables.get(\"fieldTypesArr\");", + "var jsonData = pm.response.json();", "", - "pm.test(\"Checking the total number of Field Types\", function () {", - " const fieldTypes = pm.response.json().entity;", - " pm.expect(expectedFieldTypes.length).to.eql(fieldTypes.length, \"There must be exactly \" + expectedFieldTypes.length + \" Field Types in dotCMS\");", + "pm.test(\"The 'Content (Generic)' type must come first!'\", function () {", + " pm.expect(\"Content (Generic)\").to.equal(jsonData.entity[0].name);", "});", "", - "pm.test(\"Checking the classes in all Field Types\", function () {", - " const fieldTypes = pm.response.json().entity;", - " fieldTypes.forEach(type => {", - "", - " pm.expect(expectedFieldTypes.includes(type.clazz)).to.equal(true, \"Type '\" + type.clazz + \"' doesn't exist in the official Field Type list\");", - "", - " })", + "pm.test(\"There must be 3 Content Types in the response only!'\", function () {", + " pm.expect(3).to.equal(jsonData.entity.length);", "});", "" ], "type": "text/javascript" } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "const fieldTypesArr = [ ", - " \"com.dotcms.contenttype.model.field.ImmutableBinaryField\",", - " \"com.dotcms.contenttype.model.field.ImmutableStoryBlockField\",", - " \"com.dotcms.contenttype.model.field.ImmutableCategoryField\",", - " \"com.dotcms.contenttype.model.field.ImmutableCheckboxField\",", - " \"com.dotcms.contenttype.model.field.ImmutableConstantField\",", - " \"com.dotcms.contenttype.model.field.ImmutableCustomField\",", - " \"com.dotcms.contenttype.model.field.ImmutableDateField\",", - " \"com.dotcms.contenttype.model.field.ImmutableDateTimeField\",", - " \"com.dotcms.contenttype.model.field.ImmutableFileField\",", - " \"com.dotcms.contenttype.model.field.ImmutableHiddenField\",", - " \"com.dotcms.contenttype.model.field.ImmutableImageField\",", - " \"com.dotcms.contenttype.model.field.ImmutableJSONField\",", - " \"com.dotcms.contenttype.model.field.ImmutableKeyValueField\",", - " \"com.dotcms.contenttype.model.field.ImmutableLineDividerField\",", - " \"com.dotcms.contenttype.model.field.ImmutableMultiSelectField\",", - " \"com.dotcms.contenttype.model.field.ImmutablePermissionTabField\",", - " \"com.dotcms.contenttype.model.field.ImmutableRadioField\",", - " \"com.dotcms.contenttype.model.field.ImmutableRelationshipField\",", - " \"com.dotcms.contenttype.model.field.ImmutableRelationshipsTabField\",", - " \"com.dotcms.contenttype.model.field.ImmutableSelectField\",", - " \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",", - " \"com.dotcms.contenttype.model.field.ImmutableTabDividerField\",", - " \"com.dotcms.contenttype.model.field.ImmutableTagField\",", - " \"com.dotcms.contenttype.model.field.ImmutableTextField\",", - " \"com.dotcms.contenttype.model.field.ImmutableTextAreaField\",", - " \"com.dotcms.contenttype.model.field.ImmutableTimeField\",", - " \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\"", - "];", - "pm.collectionVariables.set(\"fieldTypesArr\", fieldTypesArr);" - ], - "type": "text/javascript" - } } ], "request": { @@ -3864,72 +3915,69 @@ "type": "basic", "basic": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "password", + "value": "admin", "type": "string" }, { - "key": "password", - "value": "admin", + "key": "username", + "value": "admin@dotcms.com", "type": "string" } ] }, - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,htmlpageasset,FileAsset\"\n },\n \"page\": 1,\n \"perPage\": 3\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/fieldTypes", + "raw": "{{serverURL}}/api/v1/contenttype/_filter", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "fieldTypes" + "contenttype", + "_filter" ] }, - "description": "Verifies that there's a specific number of Field Types in dotCMS, and that they all match one of the expected Field Types." + "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the pagination parameters**." }, "response": [] }, { - "name": "Site or Folder Field with No Searchable Option", + "name": "Get Content Types - Second page", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status must be successful\", function() {", + "", + "pm.test(\"Status code must be ok 200\", function () {", " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Checking that 'Searchable' option in 'Site or Folder' field is NOT present anymore\", function () {", - " const fieldTypes = pm.response.json().entity;", - " var isPropertyPresent = false;", - " fieldTypes.forEach(type => {", + "var jsonData = pm.response.json();", "", - " if (\"com.dotcms.contenttype.model.field.ImmutableHostFolderField\" === type.clazz && type.properties.includes(\"searchable\")) {", - " isPropertyPresent = true;", - " }", + "pm.test(\"The 'dotAsset' type must come first!'\", function () {", + " pm.expect(\"dotAsset\").to.equal(jsonData.entity[0].name);", + "});", "", - " });", - " if (isPropertyPresent) {", - " pm.expect(false).to.equal(isPropertyPresent, \"The 'searchable' property must not be present for 'Site or Folder' fields\");", - " }", + "pm.test(\"There must be 2 Content Types in the response only!'\", function () {", + " pm.expect(2).to.equal(jsonData.entity.length);", "});", "" ], "type": "text/javascript" } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } } ], "request": { @@ -3937,66 +3985,64 @@ "type": "basic", "basic": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "password", + "value": "admin", "type": "string" }, { - "key": "password", - "value": "admin", + "key": "username", + "value": "admin@dotcms.com", "type": "string" } ] }, - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\"\n },\n \"page\": 2,\n \"perPage\": 3\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/fieldTypes", + "raw": "{{serverURL}}/api/v1/contenttype/_filter", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "fieldTypes" + "contenttype", + "_filter" ] - } + }, + "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the pagination parameters**." }, "response": [] - } - ], - "description": "Verifies that operations related to retrieving data from fields in Content Types are aworking as expected." - }, - { - "name": "Test delete publish/expire field", - "item": [ + }, { - "name": "Create ContentType with publish/expire fields", + "name": "Get Content Types - Not paginated", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.collectionVariables.set(\"contentTypeID\", jsonData.entity[0].id);", - "pm.collectionVariables.set(\"contentTypeVAR\", jsonData.entity[0].variable);", - "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[0].id);", "", - "pm.test(\"Status code should be ok 200\", function () {", + "pm.test(\"Status code must be ok 200\", function () {", " pm.response.to.have.status(200);", "});", "", - "pm.test(\"icon check\", function () {", - " pm.expect(jsonData.entity[0].icon).to.eql('testIcon');", - "});", + "var jsonData = pm.response.json();", "", - "pm.test(\"Fields check\", function () {", - " pm.expect(jsonData.entity[0].fields.length).to.gte(2);", - "});" + "pm.test(\"All 5 Content Types in the response only!'\", function () {", + " pm.expect(5).to.equal(jsonData.entity.length);", + "});", + "" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], @@ -4013,54 +4059,54 @@ "key": "username", "value": "admin@dotcms.com", "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" } ] }, "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test dates content {{$randomBankAccount}}\",\n\t\"variable\": \"testDatesContent{{$randomBankAccount}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"testIcon\",\n \"sortOrder\": 3,\n \"publishDateVar\": \"publishDate\",\n \"expireDateVar\": \"expireDate\",\n\t\"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableDateTimeField\",\n \"dataType\": \"DATE\",\n \"fieldType\": \"Date-and-Time\",\n \"fieldTypeLabel\": \"Date and Time\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Publish Date\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"publishDate\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableDateTimeField\",\n \"dataType\": \"DATE\",\n \"fieldType\": \"Date-and-Time\",\n \"fieldTypeLabel\": \"Date and Time\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"iDate\": 1685054935000,\n \"indexed\": true,\n \"listed\": true,\n \"modDate\": 1685054935000,\n \"name\": \"Expire Date\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"expireDate\"\n }\n\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/_filter", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "_filter" ] }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." + "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **without any pagination parameters.**" }, "response": [] }, { - "name": "Delete dateTime field", + "name": "Get Content Types - Filtered", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", - "});" + "", + "pm.test(\"Status code must be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Only 2 Content Types with the letters 'ent' should be returned!'\", function () {", + " pm.expect(2).to.equal(jsonData.entity.length);", + "});", + "" ], "type": "text/javascript" } @@ -4079,23 +4125,14 @@ "key": "username", "value": "admin@dotcms.com", "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" } ] }, - "method": "DELETE", + "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\"fieldsID\": [\"{{contentTypeFieldID}}\"]}", + "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\",\n \"query\": \"ent\"\n }\n}", "options": { "raw": { "language": "json" @@ -4103,47 +4140,37 @@ } }, "url": { - "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeID}}/fields", + "raw": "{{serverURL}}/api/v1/contenttype/_filter", "host": [ "{{serverURL}}" ], "path": [ "api", - "v3", + "v1", "contenttype", - "{{contentTypeID}}", - "fields" + "_filter" ] }, - "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." + "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the specified filter including the letters that might be present in either the Content Type's name or Velocity Var Name.**" }, "response": [] - } - ] - }, - { - "name": "Get Types from one or more Sites", - "item": [ + }, { - "name": "(Legacy) Types from System Host", + "name": "Get Content Types - Filtered Paginated", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", + "", + "pm.test(\"Status code must be ok 200\", function () {", " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Checking that there at least 10 Content Types living under System Host\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(10, \"There MUST be at least 10 Content Types living in System Host -- unless some were added/removed\");", - "});", + "var jsonData = pm.response.json();", "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(10, \"The 'totalEntries' parameter must be at least 10\");", + "pm.test(\"Only 1 Content Type with the letters 'set' should be returned!'\", function () {", + " pm.expect(1).to.equal(jsonData.entity.length);", "});", "" ], @@ -4156,64 +4183,60 @@ "type": "basic", "basic": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "password", + "value": "admin", "type": "string" }, { - "key": "password", - "value": "admin", + "key": "username", + "value": "admin@dotcms.com", "type": "string" } ] }, - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\",\n \"query\": \"set\"\n },\n \"page\": 1,\n \"perPage\": 3\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype?host=SYSTEM_HOST&per_page=40", + "raw": "{{serverURL}}/api/v1/contenttype/_filter", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" - ], - "query": [ - { - "key": "host", - "value": "SYSTEM_HOST" - }, - { - "key": "per_page", - "value": "40" - } + "contenttype", + "_filter" ] }, - "description": "Returns the Content Types living in System Host." + "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the specified filter including the letters that might be present in either the Content Type's name or Velocity Var Name.**\n\nIn this case, the second page is being requested." }, "response": [] }, { - "name": "(Legacy) Types from Default site", + "name": "Get Content Types - All types", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", + "", + "pm.test(\"Status code must be ok 200\", function () {", " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Checking that there at least 2 Content Types living under the Default Site\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(2, \"There MUST be at least 2 Content Types living in the Default Site\");", - "});", + "var jsonData = pm.response.json();", "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(10, \"The 'perPage' parameter must be 10\");", - " pm.expect(pagination.totalEntries).to.be.gte(2, \"The 'totalEntries' parameter must be at least 2\");", + "pm.test(\"At least 12 Content Types must be returned, as not filter is set!'\", function () {", + " pm.expect(jsonData.entity.length).to.greaterThan(11)", "});", "" ], @@ -4226,68 +4249,69 @@ "type": "basic", "basic": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "password", + "value": "admin", "type": "string" }, { - "key": "password", - "value": "admin", + "key": "username", + "value": "admin@dotcms.com", "type": "string" } ] }, - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"orderBy\": \"name\",\n \"direction\": \"ASC\",\n \"perPage\": 40\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype?host=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d", + "raw": "{{serverURL}}/api/v1/contenttype/_filter", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" - ], - "query": [ - { - "key": "host", - "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d" - } + "contenttype", + "_filter" ] }, - "description": "Returns all the Content Types living in the Default site." + "description": "Returns the appropriate JSON data with **ALL** the Content Types in the content repo as no filtering parameters were provided." }, "response": [] - }, + } + ], + "description": "This Test Collection will verify that the Content Type Filtering Endpoint works as expected. This endpoint can take a list of specific Content Types and perform filtering and pagination operations on them." + }, + { + "name": "Test Accept Site Names and Folder Path", + "item": [ { - "name": "Get Types from System Host", + "name": "createFolders Success", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", + "pm.test(\"Status code should be 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there are at least 10 Content Types living under the System Host\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(10, \"There MUST be at least 10 Content Types living in System Host -- unless some were added/removed\");", - "});", - "", - "pm.test(\"Checking that there is no Content Type from another Site\", function () {", - " const entity = pm.response.json().entity;", - " const typeFromDefaultSite = entity.find(type => type.host !== 'SYSTEM_HOST');", - " pm.expect(typeFromDefaultSite).equals(undefined, \"There must be no Content Types from sites other than System Host\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(10, \"The 'totalEntries' parameter must be at least 10\");", - "});", - "" + " let jsonData = pm.response.json();", + " pm.expect(jsonData.entity.length).to.be.above(0); ", + " let folder = jsonData.entity[0];", + " pm.expect(folder.title).eql(\"foo2\");", + " pm.expect(folder.type).eql(\"folder\");", + " pm.expect(folder.path).eql(\"/foo1/foo2/\");", + " pm.collectionVariables.set(\"folder\", folder);", + " pm.collectionVariables.set(\"folder.identifier\", folder.identifier);", + " pm.collectionVariables.set(\"folder.hostId\", folder.hostId);", + "});" ], "type": "text/javascript" } @@ -4298,71 +4322,60 @@ "type": "basic", "basic": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "password", + "value": "admin", "type": "string" }, { - "key": "password", - "value": "admin", + "key": "username", + "value": "admin@dotcms.com", "type": "string" } ] }, - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "[\"/foo1/foo2\"]\n", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=SYSTEM_HOST&per_page=40", + "raw": "{{serverURL}}/api/v1/folder/createfolders/default", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" - ], - "query": [ - { - "key": "sites", - "value": "SYSTEM_HOST" - }, - { - "key": "per_page", - "value": "40" - } + "folder", + "createfolders", + "default" ] - }, - "description": "Returns all the Content Types living in the Default site, using the new query string parameter." + } }, "response": [] }, { - "name": "Get Types from Default site", + "name": "Create ContentType From Given Host Idenifier and Folder Identifier", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", + "let jsonData = pm.response.json();", + "let contentType = jsonData.entity[0];", + "pm.test(\"Status code should be 200\", function() {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there are at least 2 Content Types living under the Default site\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(2, \"There MUST be at least 2 Content Types living in the Default site\");", - "});", - "", - "pm.test(\"Checking that there is no Content Type from another Site\", function () {", - " const entity = pm.response.json().entity;", - " const typeFromDefaultSite = entity.find(type => type.host !== '8a7d5e23-da1e-420a-b4f0-471e7da8ea2d');", - " pm.expect(typeFromDefaultSite).equals(undefined, \"There must be no Content Types from sites other than Default\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(2, \"The 'totalEntries' parameter must be at least 2\");", - "});", + " let folder = pm.collectionVariables.get(\"folder\");", + " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", + " pm.expect(contentType.folder).to.eql(folder.identifier);", + " pm.expect(contentType.host).to.eql(folder.hostId);", + "})", "" ], "type": "text/javascript" @@ -4373,22 +4386,40 @@ "auth": { "type": "basic", "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { "key": "username", "value": "admin@dotcms.com", "type": "string" }, { - "key": "password", - "value": "admin", - "type": "string" + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"system\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"CT created using the folderPath property\", \n \"host\":\"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n \"folder\":\"{{folder.identifier}}\",\n \"name\":\"SimpleContentTypeFromFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=default&per_page=40", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], @@ -4396,49 +4427,28 @@ "api", "v1", "contenttype" - ], - "query": [ - { - "key": "sites", - "value": "default" - }, - { - "key": "per_page", - "value": "40" - } ] }, - "description": "Returns all the Content Types living in the Default site, using the new query string parameter, and passing down the Site Key." + "description": "Creates a contentType using the folderPath property\n\nExpect success." }, "response": [] }, { - "name": "Get Types from Default Site (ID) and System Host", + "name": "Create ContentType From Given Folder Path", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", + "let jsonData = pm.response.json();", + "let contentType = jsonData.entity[0];", + "pm.test(\"Status code should be 200\", function() {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there are at least 12 Content Types living under the Default and System Host sites\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(12, \"There MUST be at least 12 Content Types living in the Default and System Host sites -- unless some were added/removed\");", - "});", - "", - "pm.test(\"Checking that there is at least 1 Content Type from the Default Site\", function () {", - " const entity = pm.response.json().entity;", - " const typeFromDefaultSite = entity.find(type => type.host === '8a7d5e23-da1e-420a-b4f0-471e7da8ea2d');", - " pm.expect(typeFromDefaultSite).to.not.equal(undefined, \"There MUST be at least one Content Type from the Default Site\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(12, \"The 'totalEntries' parameter must be at least 12\");", - "});", + " let folder = pm.collectionVariables.get(\"folder\");", + " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", + " pm.expect(contentType.folder).to.eql(folder.identifier);", + " pm.expect(contentType.host).to.eql(folder.hostId);", + "})", "" ], "type": "text/javascript" @@ -4449,22 +4459,40 @@ "auth": { "type": "basic", "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { "key": "username", "value": "admin@dotcms.com", "type": "string" }, { - "key": "password", - "value": "admin", - "type": "string" + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"defaultType\":false,\n \"fixed\":false, \n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"CT created using the folderPath property\", \n \"folderPath\":\"default:/foo1/foo2\",\n \"name\":\"SimpleContentTypeFromFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d,SYSTEM_HOST&per_page=40", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], @@ -4472,49 +4500,28 @@ "api", "v1", "contenttype" - ], - "query": [ - { - "key": "sites", - "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d,SYSTEM_HOST" - }, - { - "key": "per_page", - "value": "40" - } ] }, - "description": "Returns all the Content Types living in both the Default and System Host sites, using the IDs." + "description": "Creates a contentType using the folderPath property\n\nExpect success." }, "response": [] }, { - "name": "Get Types from Default Site (Site Key) and System Host Copy", + "name": "Create ContentType From Given Host Name and Folder Path", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", + "let jsonData = pm.response.json();", + "let contentType = jsonData.entity[0];", + "pm.test(\"Status code should be 200\", function() {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there are at least 12 Content Types living under the Default and System Host sites\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(12, \"There MUST be at least 12 Content Types living in the Default and System Host sites -- unless some were added/removed\");", - "});", - "", - "pm.test(\"Checking that there is at least 1 Content Type from the Default Site\", function () {", - " const entity = pm.response.json().entity;", - " const typeFromDefaultSite = entity.find(type => type.host === '8a7d5e23-da1e-420a-b4f0-471e7da8ea2d');", - " pm.expect(typeFromDefaultSite).to.not.equal(undefined, \"There MUST be at least one Content Type from the Default Site\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(12, \"The 'totalEntries' parameter must be at least 12\");", - "});", + " let folder = pm.collectionVariables.get(\"folder\");", + " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", + " pm.expect(contentType.folder).to.eql(folder.identifier);", + " pm.expect(contentType.host).to.eql(folder.hostId);", + "})", "" ], "type": "text/javascript" @@ -4525,66 +4532,69 @@ "auth": { "type": "basic", "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { "key": "username", "value": "admin@dotcms.com", "type": "string" }, { - "key": "password", - "value": "admin", - "type": "string" + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, - "method": "GET", + "method": "POST", "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=default,SYSTEM_HOST&per_page=40", - "host": [ + "body": { + "mode": "raw", + "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"system\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"Here we're sending host name an the folder path separately\", \n \"host\":\"default\",\n \"folderPath\":\"/foo1/foo2\",\n \"name\":\"SimpleContentTypeUsingHostNameAndFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ "{{serverURL}}" ], "path": [ "api", "v1", "contenttype" - ], - "query": [ - { - "key": "sites", - "value": "default,SYSTEM_HOST" - }, - { - "key": "per_page", - "value": "40" - } ] }, - "description": "Returns all the Content Types living in both the Default and System Host sites, using the Site Key." + "description": "Creates a contentType using a host name and folderPath\n\nHere we're sending host name and the folder path only contains the folders bit without the site name portion" }, "response": [] }, { - "name": "Get Types from non-existing Site", + "name": "Create ContentType From Given Host Identifier and Folder Path (no host)", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", + "let jsonData = pm.response.json();", + "let contentType = jsonData.entity[0];", + "pm.test(\"Status code should be 200\", function() {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that no Content Types are returned\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).equals(0, \"There must be no Content Types in the results\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).equals(0, \"The 'totalEntries' parameter must be zero\");", - "});", + " let folder = pm.collectionVariables.get(\"folder\");", + " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", + " pm.expect(contentType.folder).to.eql(folder.identifier);", + " pm.expect(contentType.host).to.eql(folder.hostId);", + "})", "" ], "type": "text/javascript" @@ -4595,22 +4605,40 @@ "auth": { "type": "basic", "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { "key": "username", "value": "admin@dotcms.com", "type": "string" }, { - "key": "password", - "value": "admin", - "type": "string" + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"Here we're sending host name an the folder path separately\", \n \"host\":\"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n \"folderPath\":\"/foo1/foo2\",\n \"name\":\"SimpleContentTypeUsingHostIdAndFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=non-existing-site&per_page=40", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], @@ -4618,50 +4646,27 @@ "api", "v1", "contenttype" - ], - "query": [ - { - "key": "sites", - "value": "non-existing-site" - }, - { - "key": "per_page", - "value": "40" - } ] }, - "description": "Returns all the Content Types living in the non-existing site, which must return an empty list." + "description": "Creates a contentType using a host name and folderPath\n\nHere we're sending host name and the folder path only contains the folders bit without the site name portion" }, "response": [] }, { - "name": "Get Types from non-existing Site (ID) and System Host", + "name": "Create FIXED ContentType Expect System-Host and System-Folder", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there are at least 10 Content Types living under the Default and System Host sites\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(10, \"There MUST be at least 10 Content Types living in System Host -- unless some were added/removed\");", - "});", - "", - "pm.test(\"Checking that all Content Types come from System Host only\", function () {", - " const entity = pm.response.json().entity;", - " const typeFromDefaultSite = entity.find(type => type.host === '12312312-abcd-1234-dcba-456456456456');", - " pm.expect(typeFromDefaultSite).equals(undefined, \"All Content Types must come from System Host only\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(10, \"The 'totalEntries' parameter must be at least 10\");", - "});", - "" + "let jsonData = pm.response.json();", + "let contentType = jsonData.entity[0];", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200); ", + " pm.expect(contentType.folderPath).to.eql(\"/\");", + " pm.expect(contentType.folder).to.eql(\"SYSTEM_FOLDER\");", + " pm.expect(contentType.host).to.eql(\"SYSTEM_HOST\");", + "})" ], "type": "text/javascript" } @@ -4671,22 +4676,40 @@ "auth": { "type": "basic", "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { "key": "username", "value": "admin@dotcms.com", "type": "string" }, { - "key": "password", - "value": "admin", - "type": "string" + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"defaultType\":false,\n \"fixed\":true, \n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"CT created using the folderPath property\", \n \"folderPath\":\"any:/non-existing-folder\",\n \"name\":\"SimpleContentTypeFromFolderPathNonExistingFolder\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=12312312-abcd-1234-dcba-456456456456,SYSTEM_HOST&per_page=40", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], @@ -4694,53 +4717,85 @@ "api", "v1", "contenttype" - ], - "query": [ - { - "key": "sites", - "value": "12312312-abcd-1234-dcba-456456456456,SYSTEM_HOST" - }, - { - "key": "per_page", - "value": "40" - } ] }, - "description": "Returns all the Content Types living in a non-existing site and System Host, which must return only the types living in System Host." + "description": "Creates a simple contentType, that uses the folderPath property to set the location" }, "response": [] - }, + } + ] + }, + { + "name": "Field Data", + "item": [ { - "name": "Get Types from non-existing Site (ID) and Default site", + "name": "Get All Field Types", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", + "pm.test(\"HTTP Status must be successful\", function() {", " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Checking that there are at least 2 Content Types living under the Default site\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(2, \"There MUST be at least 2 Content Types living in the Default site\");", - "});", + "const expectedFieldTypes = pm.collectionVariables.get(\"fieldTypesArr\");", "", - "pm.test(\"Checking that all Content Types come from the Default site only\", function () {", - " const entity = pm.response.json().entity;", - " const typeFromDefaultSite = entity.find(type => type.host === '12312312-abcd-1234-dcba-456456456456');", - " pm.expect(typeFromDefaultSite).equals(undefined, \"All Content Types must come from the Default site only\");", + "pm.test(\"Checking the total number of Field Types\", function () {", + " const fieldTypes = pm.response.json().entity;", + " pm.expect(expectedFieldTypes.length).to.eql(fieldTypes.length, \"There must be exactly \" + expectedFieldTypes.length + \" Field Types in dotCMS\");", "});", "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(2, \"The 'totalEntries' parameter must be at least 2\");", + "pm.test(\"Checking the classes in all Field Types\", function () {", + " const fieldTypes = pm.response.json().entity;", + " fieldTypes.forEach(type => {", + "", + " pm.expect(expectedFieldTypes.includes(type.clazz)).to.equal(true, \"Type '\" + type.clazz + \"' doesn't exist in the official Field Type list\");", + "", + " })", "});", "" ], "type": "text/javascript" } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "const fieldTypesArr = [ ", + " \"com.dotcms.contenttype.model.field.ImmutableBinaryField\",", + " \"com.dotcms.contenttype.model.field.ImmutableStoryBlockField\",", + " \"com.dotcms.contenttype.model.field.ImmutableCategoryField\",", + " \"com.dotcms.contenttype.model.field.ImmutableCheckboxField\",", + " \"com.dotcms.contenttype.model.field.ImmutableConstantField\",", + " \"com.dotcms.contenttype.model.field.ImmutableCustomField\",", + " \"com.dotcms.contenttype.model.field.ImmutableDateField\",", + " \"com.dotcms.contenttype.model.field.ImmutableDateTimeField\",", + " \"com.dotcms.contenttype.model.field.ImmutableFileField\",", + " \"com.dotcms.contenttype.model.field.ImmutableHiddenField\",", + " \"com.dotcms.contenttype.model.field.ImmutableImageField\",", + " \"com.dotcms.contenttype.model.field.ImmutableJSONField\",", + " \"com.dotcms.contenttype.model.field.ImmutableKeyValueField\",", + " \"com.dotcms.contenttype.model.field.ImmutableLineDividerField\",", + " \"com.dotcms.contenttype.model.field.ImmutableMultiSelectField\",", + " \"com.dotcms.contenttype.model.field.ImmutablePermissionTabField\",", + " \"com.dotcms.contenttype.model.field.ImmutableRadioField\",", + " \"com.dotcms.contenttype.model.field.ImmutableRelationshipField\",", + " \"com.dotcms.contenttype.model.field.ImmutableRelationshipsTabField\",", + " \"com.dotcms.contenttype.model.field.ImmutableSelectField\",", + " \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",", + " \"com.dotcms.contenttype.model.field.ImmutableTabDividerField\",", + " \"com.dotcms.contenttype.model.field.ImmutableTagField\",", + " \"com.dotcms.contenttype.model.field.ImmutableTextField\",", + " \"com.dotcms.contenttype.model.field.ImmutableTextAreaField\",", + " \"com.dotcms.contenttype.model.field.ImmutableTimeField\",", + " \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\"", + "];", + "pm.collectionVariables.set(\"fieldTypesArr\", fieldTypesArr);" + ], + "type": "text/javascript" + } } ], "request": { @@ -4762,760 +4817,948 @@ "method": "GET", "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=invalid-site,default&per_page=40", + "raw": "{{serverURL}}/api/v1/fieldTypes", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" - ], - "query": [ - { - "key": "sites", - "value": "invalid-site,default" - }, - { - "key": "per_page", - "value": "40" - } + "fieldTypes" ] }, - "description": "Returns all the Content Types living in a non-existing site and the Defaut site, which must return only the types living in the Default site." + "description": "Verifies that there's a specific number of Field Types in dotCMS, and that they all match one of the expected Field Types." }, "response": [] - } - ], - "description": "These requests allow you to verify that dotCMS can retrieve a filtered paginated list of Content Types from a specific list of Sites only, and not from the whole repository. You can use both the Site's Identifier, or its Key -- aka, Site Name.\n\nThis suite is testing both the existing per-Site Endpoint -- flagged with **`(Legacy)`** -- and the new multi-site parameter." - }, - { - "name": "Test detail page", - "item": [ + }, { - "name": "Test update detail page with id and URI", - "item": [ + "name": "Site or Folder Field with No Searchable Option", + "event": [ { - "name": "Create Test Site", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Storing page data for subsequent tests\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"pageDetailSiteId\", jsonData.entity.identifier);", - " pm.collectionVariables.set(\"pageDetailSiteName\", jsonData.entity.siteName);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"siteName\":\"page.detail.host.com.{{$timestamp}}\",\n \"variables\":[]\n}\n", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/site", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "site" - ] - } - }, - "response": [] + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status must be successful\", function() {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that 'Searchable' option in 'Site or Folder' field is NOT present anymore\", function () {", + " const fieldTypes = pm.response.json().entity;", + " var isPropertyPresent = false;", + " fieldTypes.forEach(type => {", + "", + " if (\"com.dotcms.contenttype.model.field.ImmutableHostFolderField\" === type.clazz && type.properties.includes(\"searchable\")) {", + " isPropertyPresent = true;", + " }", + "", + " });", + " if (isPropertyPresent) {", + " pm.expect(false).to.equal(isPropertyPresent, \"The 'searchable' property must not be present for 'Site or Folder' fields\");", + " }", + "});", + "" + ], + "type": "text/javascript" + } }, { - "name": "Create test Page1", - "event": [ + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Storing page id and path for subsequent tests\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"pageDetailPageId1\", jsonData.entity.identifier);", - " pm.collectionVariables.set(\"pageDetailPageInode1\", jsonData.entity.inode);", - " pm.collectionVariables.set(\"pageDetailPageURL1\", jsonData.entity.url);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"contentlet\":{\n\t\t\"stName\": \"htmlpageasset\",\n\t\t\"title\": \"Page1 {{$timestamp}}\",\n \"url\": \"page1-{{$timestamp}}\",\n \"friendlyName\":\"page1-{{$timestamp}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"100\",\n \"hostFolder\":\"{{pageDetailSiteId}}\"\n\t}\n}", - "options": { - "raw": { - "language": "json" - } - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "PUBLISH" - ] + { + "key": "password", + "value": "admin", + "type": "string" } - }, - "response": [] + ] }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/fieldTypes", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "fieldTypes" + ] + } + }, + "response": [] + } + ], + "description": "Verifies that operations related to retrieving data from fields in Content Types are aworking as expected." + }, + { + "name": "Test delete publish/expire field", + "item": [ + { + "name": "Create ContentType with publish/expire fields", + "event": [ { - "name": "Create test Page2", - "event": [ + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.collectionVariables.set(\"contentTypeID\", jsonData.entity[0].id);", + "pm.collectionVariables.set(\"contentTypeVAR\", jsonData.entity[0].variable);", + "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[2].id);", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"icon check\", function () {", + " pm.expect(jsonData.entity[0].icon).to.eql('testIcon');", + "});", + "", + "pm.test(\"Fields check\", function () {", + " pm.expect(jsonData.entity[0].fields.length).to.eql(4);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Storing page id and path for subsequent tests\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"pageDetailPageId2\", jsonData.entity.identifier);", - " pm.collectionVariables.set(\"pageDetailPageInode2\", jsonData.entity.inode);", - " pm.collectionVariables.set(\"pageDetailPageURL2\", jsonData.entity.url);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"contentlet\":{\n\t\t\"stName\": \"htmlpageasset\",\n\t\t\"title\": \"Pag2 {{$timestamp}}\",\n \"url\": \"page2-{{$timestamp}}\",\n \"friendlyName\":\"page2-{{$timestamp}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"100\",\n \"hostFolder\":\"{{pageDetailSiteId}}\"\n\t}\n}", - "options": { - "raw": { - "language": "json" - } - } + "key": "password", + "value": "admin", + "type": "string" }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "PUBLISH" - ] + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } - }, - "response": [] + ] }, - { - "name": "Create ContentType with page detail id", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity[0].detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity[0].detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - } + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test dates content {{$randomBankAccount}}\",\n\t\"variable\": \"testDatesContent{{$randomBankAccount}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"testIcon\",\n \"sortOrder\": 3,\n \"publishDateVar\": \"publishDate\",\n \"expireDateVar\": \"expireDate\",\n\t\"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableDateTimeField\",\n \"dataType\": \"DATE\",\n \"fieldType\": \"Date-and-Time\",\n \"fieldTypeLabel\": \"Date and Time\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Publish Date\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"publishDate\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableDateTimeField\",\n \"dataType\": \"DATE\",\n \"fieldType\": \"Date-and-Time\",\n \"fieldTypeLabel\": \"Date and Time\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"iDate\": 1685054935000,\n \"indexed\": true,\n \"listed\": true,\n \"modDate\": 1685054935000,\n \"name\": \"Expire Date\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"expireDate\"\n }\n\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." + }, + "response": [] + }, + { + "name": "Delete dateTime field", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", + "});" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"{{pageDetailPageId1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "{\"fieldsID\": [\"{{contentTypeFieldID}}\"]}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeID}}/fields", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." - }, - "response": [] + "path": [ + "api", + "v3", + "contenttype", + "{{contentTypeID}}", + "fields" + ] }, + "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." + }, + "response": [] + } + ] + }, + { + "name": "Get Types from one or more Sites", + "item": [ + { + "name": "(Legacy) Types from System Host", + "event": [ { - "name": "Update Content Type with page detail with URI", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that there at least 10 Content Types living under System Host\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(10, \"There MUST be at least 10 Content Types living in System Host -- unless some were added/removed\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(10, \"The 'totalEntries' parameter must be at least 10\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "password", + "value": "admin", + "type": "string" } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?host=SYSTEM_HOST&per_page=40", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL2}}\",\n \"urlMapPattern\" : \"/{name}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "host", + "value": "SYSTEM_HOST" }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." - }, - "response": [] + { + "key": "per_page", + "value": "40" + } + ] }, + "description": "Returns the Content Types living in System Host." + }, + "response": [] + }, + { + "name": "(Legacy) Types from Default site", + "event": [ { - "name": "Get Content Type", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that there at least 2 Content Types living under the Default Site\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(2, \"There MUST be at least 2 Content Types living in the Default Site\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(10, \"The 'perPage' parameter must be 10\");", + " pm.expect(pagination.totalEntries).to.be.gte(2, \"The 'totalEntries' parameter must be at least 2\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "password", + "value": "admin", + "type": "string" } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?host=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "host", + "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d" + } + ] }, + "description": "Returns all the Content Types living in the Default site." + }, + "response": [] + }, + { + "name": "Get Types from System Host", + "event": [ { - "name": "Update Content Type with page detail id", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that there are at least 10 Content Types living under the System Host\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(10, \"There MUST be at least 10 Content Types living in System Host -- unless some were added/removed\");", + "});", + "", + "pm.test(\"Checking that there is no Content Type from another Site\", function () {", + " const entity = pm.response.json().entity;", + " const typeFromDefaultSite = entity.find(type => type.host !== 'SYSTEM_HOST');", + " pm.expect(typeFromDefaultSite).equals(undefined, \"There must be no Content Types from sites other than System Host\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(10, \"The 'totalEntries' parameter must be at least 10\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "password", + "value": "admin", + "type": "string" } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?sites=SYSTEM_HOST&per_page=40", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"{{pageDetailPageId1}}\",\n \"urlMapPattern\" : \"/{name}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "SYSTEM_HOST" }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "per_page", + "value": "40" } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." - }, - "response": [] + ] }, + "description": "Returns all the Content Types living in the Default site, using the new query string parameter." + }, + "response": [] + }, + { + "name": "Get Types from Default site", + "event": [ { - "name": "Update Content Type with page detail with URI Again", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that there are at least 2 Content Types living under the Default site\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(2, \"There MUST be at least 2 Content Types living in the Default site\");", + "});", + "", + "pm.test(\"Checking that there is no Content Type from another Site\", function () {", + " const entity = pm.response.json().entity;", + " const typeFromDefaultSite = entity.find(type => type.host !== '8a7d5e23-da1e-420a-b4f0-471e7da8ea2d');", + " pm.expect(typeFromDefaultSite).equals(undefined, \"There must be no Content Types from sites other than Default\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(2, \"The 'totalEntries' parameter must be at least 2\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL2}}\",\n \"urlMapPattern\" : \"/{name}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "key": "username", + "value": "admin@dotcms.com", + "type": "string" }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?sites=default&per_page=40", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "default" }, - "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." - }, - "response": [] - }, - { - "name": "Update Content Type removing page detail", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData).not.have.property('detailPage');", - " pm.expect(jsonData).not.have.property('detailPagePath');", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "per_page", + "value": "40" } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"urlMapPattern\" : \"/{name}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." - }, - "response": [] + ] }, + "description": "Returns all the Content Types living in the Default site, using the new query string parameter, and passing down the Site Key." + }, + "response": [] + }, + { + "name": "Get Types from Default Site (ID) and System Host", + "event": [ { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData).not.have.property('detailPage');", - " pm.expect(jsonData).not.have.property('detailPagePath');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that there are at least 12 Content Types living under the Default and System Host sites\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(12, \"There MUST be at least 12 Content Types living in the Default and System Host sites -- unless some were added/removed\");", + "});", + "", + "pm.test(\"Checking that there is at least 1 Content Type from the Default Site\", function () {", + " const entity = pm.response.json().entity;", + " const typeFromDefaultSite = entity.find(type => type.host === '8a7d5e23-da1e-420a-b4f0-471e7da8ea2d');", + " pm.expect(typeFromDefaultSite).to.not.equal(undefined, \"There MUST be at least one Content Type from the Default Site\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(12, \"The 'totalEntries' parameter must be at least 12\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "password", + "value": "admin", + "type": "string" } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?sites=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d,SYSTEM_HOST&per_page=40", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d,SYSTEM_HOST" }, - "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." - }, - "response": [] + { + "key": "per_page", + "value": "40" + } + ] }, + "description": "Returns all the Content Types living in both the Default and System Host sites, using the IDs." + }, + "response": [] + }, + { + "name": "Get Types from Default Site (Site Key) and System Host Copy", + "event": [ { - "name": "Archive Test Page1", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that there are at least 12 Content Types living under the Default and System Host sites\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(12, \"There MUST be at least 12 Content Types living in the Default and System Host sites -- unless some were added/removed\");", + "});", + "", + "pm.test(\"Checking that there is at least 1 Content Type from the Default Site\", function () {", + " const entity = pm.response.json().entity;", + " const typeFromDefaultSite = entity.find(type => type.host === '8a7d5e23-da1e-420a-b4f0-471e7da8ea2d');", + " pm.expect(typeFromDefaultSite).to.not.equal(undefined, \"There MUST be at least one Content Type from the Default Site\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(12, \"The 'totalEntries' parameter must be at least 12\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"No errors must be present\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "password", + "value": "admin", + "type": "string" } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?sites=default,SYSTEM_HOST&per_page=40", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Origin", - "value": "{{serverURL}}" - } - ], - "body": { - "mode": "raw", - "raw": "{}", - "options": { - "raw": { - "language": "json" - } - } + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "default,SYSTEM_HOST" }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/ARCHIVE?inode={{pageDetailPageInode1}}&identifier={{pageDetailPageId1}}&indexPolicy=WAIT_FOR", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "ARCHIVE" - ], - "query": [ - { - "key": "inode", - "value": "{{pageDetailPageInode1}}" - }, - { - "key": "identifier", - "value": "{{pageDetailPageId1}}" - }, - { - "key": "indexPolicy", - "value": "WAIT_FOR" - } - ] + { + "key": "per_page", + "value": "40" } - }, - "response": [] + ] }, + "description": "Returns all the Content Types living in both the Default and System Host sites, using the Site Key." + }, + "response": [] + }, + { + "name": "Get Types from non-existing Site", + "event": [ { - "name": "Archive Test Page2", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that no Content Types are returned\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).equals(0, \"There must be no Content Types in the results\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).equals(0, \"The 'totalEntries' parameter must be zero\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"No errors must be present\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});" - ], + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "password", + "value": "admin", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?sites=non-existing-site&per_page=40", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "non-existing-site" + }, + { + "key": "per_page", + "value": "40" + } + ] + }, + "description": "Returns all the Content Types living in the non-existing site, which must return an empty list." + }, + "response": [] + }, + { + "name": "Get Types from non-existing Site (ID) and System Host", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that there are at least 10 Content Types living under the Default and System Host sites\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(10, \"There MUST be at least 10 Content Types living in System Host -- unless some were added/removed\");", + "});", + "", + "pm.test(\"Checking that all Content Types come from System Host only\", function () {", + " const entity = pm.response.json().entity;", + " const typeFromDefaultSite = entity.find(type => type.host === '12312312-abcd-1234-dcba-456456456456');", + " pm.expect(typeFromDefaultSite).equals(undefined, \"All Content Types must come from System Host only\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(10, \"The 'totalEntries' parameter must be at least 10\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "password", + "value": "admin", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?sites=12312312-abcd-1234-dcba-456456456456,SYSTEM_HOST&per_page=40", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "12312312-abcd-1234-dcba-456456456456,SYSTEM_HOST" + }, + { + "key": "per_page", + "value": "40" + } + ] + }, + "description": "Returns all the Content Types living in a non-existing site and System Host, which must return only the types living in System Host." + }, + "response": [] + }, + { + "name": "Get Types from non-existing Site (ID) and Default site", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that there are at least 2 Content Types living under the Default site\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(2, \"There MUST be at least 2 Content Types living in the Default site\");", + "});", + "", + "pm.test(\"Checking that all Content Types come from the Default site only\", function () {", + " const entity = pm.response.json().entity;", + " const typeFromDefaultSite = entity.find(type => type.host === '12312312-abcd-1234-dcba-456456456456');", + " pm.expect(typeFromDefaultSite).equals(undefined, \"All Content Types must come from the Default site only\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(2, \"The 'totalEntries' parameter must be at least 2\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "password", + "value": "admin", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?sites=invalid-site,default&per_page=40", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "invalid-site,default" + }, + { + "key": "per_page", + "value": "40" + } + ] + }, + "description": "Returns all the Content Types living in a non-existing site and the Defaut site, which must return only the types living in the Default site." + }, + "response": [] + } + ], + "description": "These requests allow you to verify that dotCMS can retrieve a filtered paginated list of Content Types from a specific list of Sites only, and not from the whole repository. You can use both the Site's Identifier, or its Key -- aka, Site Name.\n\nThis suite is testing both the existing per-Site Endpoint -- flagged with **`(Legacy)`** -- and the new multi-site parameter." + }, + { + "name": "Test detail page", + "item": [ + { + "name": "Test update detail page with id and URI", + "item": [ + { + "name": "Create Test Site", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Storing page data for subsequent tests\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"pageDetailSiteId\", jsonData.entity.identifier);", + " pm.collectionVariables.set(\"pageDetailSiteName\", jsonData.entity.siteName);", + "});", + "" + ], "type": "text/javascript", "packages": {} } } ], "request": { - "method": "PUT", - "header": [ - { - "key": "Origin", - "value": "{{serverURL}}" - } - ], + "method": "POST", + "header": [], "body": { "mode": "raw", - "raw": "{}", + "raw": "{\n \"siteName\":\"page.detail.host.com.{{$timestamp}}\",\n \"variables\":[]\n}\n", "options": { "raw": { "language": "json" @@ -5523,47 +5766,31 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/ARCHIVE?inode={{pageDetailPageInode2}}&identifier={{pageDetailPageId2}}&indexPolicy=WAIT_FOR", + "raw": "{{serverURL}}/api/v1/site", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "workflow", - "actions", - "default", - "fire", - "ARCHIVE" - ], - "query": [ - { - "key": "inode", - "value": "{{pageDetailPageInode2}}" - }, - { - "key": "identifier", - "value": "{{pageDetailPageId2}}" - }, - { - "key": "indexPolicy", - "value": "WAIT_FOR" - } + "site" ] } }, "response": [] }, { - "name": "Delete Test Page1", + "name": "Create test Page1", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"No errors must be present\", function () {", + "pm.test(\"Storing page id and path for subsequent tests\", function () {", " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", + " pm.collectionVariables.set(\"pageDetailPageId1\", jsonData.entity.identifier);", + " pm.collectionVariables.set(\"pageDetailPageInode1\", jsonData.entity.inode);", + " pm.collectionVariables.set(\"pageDetailPageURL1\", jsonData.entity.url);", "});" ], "type": "text/javascript", @@ -5573,15 +5800,10 @@ ], "request": { "method": "PUT", - "header": [ - { - "key": "Origin", - "value": "{{serverURL}}" - } - ], + "header": [], "body": { "mode": "raw", - "raw": "{}", + "raw": "{\n\t\"contentlet\":{\n\t\t\"stName\": \"htmlpageasset\",\n\t\t\"title\": \"Page1 {{$timestamp}}\",\n \"url\": \"page1-{{$timestamp}}\",\n \"friendlyName\":\"page1-{{$timestamp}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"100\",\n \"hostFolder\":\"{{pageDetailSiteId}}\"\n\t}\n}", "options": { "raw": { "language": "json" @@ -5589,7 +5811,7 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/DELETE?inode={{pageDetailPageInode1}}&identifier={{pageDetailPageId1}}&indexPolicy=WAIT_FOR", + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", "host": [ "{{serverURL}}" ], @@ -5600,36 +5822,24 @@ "actions", "default", "fire", - "DELETE" - ], - "query": [ - { - "key": "inode", - "value": "{{pageDetailPageInode1}}" - }, - { - "key": "identifier", - "value": "{{pageDetailPageId1}}" - }, - { - "key": "indexPolicy", - "value": "WAIT_FOR" - } + "PUBLISH" ] } }, "response": [] }, { - "name": "Delete Test Page2", + "name": "Create test Page2", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"No errors must be present\", function () {", + "pm.test(\"Storing page id and path for subsequent tests\", function () {", " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", + " pm.collectionVariables.set(\"pageDetailPageId2\", jsonData.entity.identifier);", + " pm.collectionVariables.set(\"pageDetailPageInode2\", jsonData.entity.inode);", + " pm.collectionVariables.set(\"pageDetailPageURL2\", jsonData.entity.url);", "});" ], "type": "text/javascript", @@ -5639,15 +5849,10 @@ ], "request": { "method": "PUT", - "header": [ - { - "key": "Origin", - "value": "{{serverURL}}" - } - ], + "header": [], "body": { "mode": "raw", - "raw": "{}", + "raw": "{\n\t\"contentlet\":{\n\t\t\"stName\": \"htmlpageasset\",\n\t\t\"title\": \"Pag2 {{$timestamp}}\",\n \"url\": \"page2-{{$timestamp}}\",\n \"friendlyName\":\"page2-{{$timestamp}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"100\",\n \"hostFolder\":\"{{pageDetailSiteId}}\"\n\t}\n}", "options": { "raw": { "language": "json" @@ -5655,7 +5860,7 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/DELETE?inode={{pageDetailPageInode2}}&identifier={{pageDetailPageId2}}&indexPolicy=WAIT_FOR", + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", "host": [ "{{serverURL}}" ], @@ -5666,81 +5871,94 @@ "actions", "default", "fire", - "DELETE" - ], - "query": [ - { - "key": "inode", - "value": "{{pageDetailPageInode2}}" - }, - { - "key": "identifier", - "value": "{{pageDetailPageId2}}" - }, - { - "key": "indexPolicy", - "value": "WAIT_FOR" - } + "PUBLISH" ] } }, "response": [] }, { - "name": "Delete ContentType", + "name": "Create ContentType with page detail id", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Response entity contains 'deleted'\", function () {", - " pm.expect(pm.response.json().entity).to.include(\"deleted\");", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", "});", "", - "pm.test(\"Errors array is empty\", function () {", - " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity[0].detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity[0].detailPagePath).to.eql(\"//\"+siteName+pageURL);", "});" ], "type": "text/javascript", "packages": {} } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } } ], "request": { - "method": "DELETE", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"{{pageDetailPageId1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "contenttype" ] }, - "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." }, "response": [] }, { - "name": "Archive Site", + "name": "Get Content Type", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Entity archived property is true\", function () {", - " var siteId= pm.collectionVariables.get(\"pageDetailSiteId\")", - " pm.expect(pm.response.json().entity.identifier).contains(siteId);", - " pm.expect(pm.response.json().entity.archived).to.be.true;", - "});", + "pm.test(\"Check detail page\", function () {", "", - "pm.test(\"Errors array is empty\", function () {", - " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", "});", "" ], @@ -5750,33 +5968,41 @@ } ], "request": { - "method": "PUT", + "method": "GET", "header": [], "url": { - "raw": "{{serverURL}}/api/v1/site/{{pageDetailSiteId}}/_archive", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "site", - "{{pageDetailSiteId}}", - "_archive" + "contenttype", + "id", + "{{contentTypeId}}" ] - } + }, + "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." }, "response": [] }, { - "name": "Delete Site", + "name": "Update Content Type with page detail with URI", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Errors array is empty\", function () {", - " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", "});" ], "type": "text/javascript", @@ -5785,64 +6011,50 @@ } ], "request": { - "method": "DELETE", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL2}}\",\n \"urlMapPattern\" : \"/{name}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/site/{{pageDetailSiteId}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "site", - "{{pageDetailSiteId}}" + "contenttype", + "id", + "{{contentTypeId}}" ] - } + }, + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." }, "response": [] - } - ], - "description": "The `detailPage` attribute supports id and URI for updates, these tests validate both cases are working as expected.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } }, { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ] - } - } - ] - }, - { - "name": "Test create content type with detailPage as URI", - "item": [ - { - "name": "Create Test Site", + "name": "Get Content Type", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Storing page data for subsequent tests\", function () {", + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", + "", " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"pageDetailSiteId\", jsonData.entity.identifier);", - " pm.collectionVariables.set(\"pageDetailSiteName\", jsonData.entity.siteName);", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", "});", "" ], @@ -5852,43 +6064,41 @@ } ], "request": { - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"siteName\":\"page.detail.host.com.{{$timestamp}}\",\n \"variables\":[]\n}\n", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/site", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "site" + "contenttype", + "id", + "{{contentTypeId}}" ] - } + }, + "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." }, "response": [] }, { - "name": "Create test Page", + "name": "Update Content Type with page detail id", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Storing page id and path for subsequent tests\", function () {", + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", + "", " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"pageDetailPageId1\", jsonData.entity.identifier);", - " pm.collectionVariables.set(\"pageDetailPageInode1\", jsonData.entity.inode);", - " pm.collectionVariables.set(\"pageDetailPageURL1\", jsonData.entity.url);", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", "});" ], "type": "text/javascript", @@ -5901,7 +6111,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"contentlet\":{\n\t\t\"stName\": \"htmlpageasset\",\n\t\t\"title\": \"Page1 {{$timestamp}}\",\n \"url\": \"page1-{{$timestamp}}\",\n \"friendlyName\":\"page1-{{$timestamp}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"100\",\n \"hostFolder\":\"{{pageDetailSiteId}}\"\n\t}\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"{{pageDetailPageId1}}\",\n \"urlMapPattern\" : \"/{name}\"\n}", "options": { "raw": { "language": "json" @@ -5909,36 +6119,29 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "workflow", - "actions", - "default", - "fire", - "PUBLISH" + "contenttype", + "id", + "{{contentTypeId}}" ] - } + }, + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." }, "response": [] }, { - "name": "Create ContentType with page detail as URI", + "name": "Get Content Type", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", "pm.test(\"Check detail page\", function () {", "", " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", @@ -5946,18 +6149,9 @@ " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", "", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity[0].detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity[0].detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});", "" ], "type": "text/javascript", @@ -5966,58 +6160,42 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, + "method": "GET", + "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeId}}" ] }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." + "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." }, "response": [] }, { - "name": "Try to create a page detail with non existing URI", + "name": "Update Content Type with page detail with URI Again", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});", + "pm.test(\"Check detail page\", function () {", "", - "pm.test(\"Correct response message\", function () {", - " pm.expect(pm.response.json().message).to.include('Missing required information when creating Content Type(s):');", - "});", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", "", - "pm.collectionVariables.set(\"skipPreResquest\", false); " - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.collectionVariables.set(\"skipPreResquest\", true); " + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});" ], "type": "text/javascript", "packages": {} @@ -6025,107 +6203,31 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}11{{pageDetailPageURL1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." - }, - "response": [] - }, - { - "name": "Try to create ContentType with page detail as URI without credentials", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response content type is text/plain\", function () {", - " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"text/plain\");", - "});", - "", - "pm.test(\"Check if the response is invalid\", function () {", - " pm.expect(pm.response.text()).to.include(\"Invalid User\");", - "});", - "", - "", - "pm.collectionVariables.set(\"skipPreResquest\", false);" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.sendRequest({", - " url: pm.environment.get(\"serverURL\") + \"/api/v1/logout\",", - " method: 'GET'", - "}, function (err, res) {", - " if (err) {", - " console.log('Logout failed:', err);", - " } else {", - " console.log('Logout successful, cookies should be cleared.');", - " }", - "});", - "", - "pm.collectionVariables.set(\"skipPreResquest\", true);" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL2}}\",\n \"urlMapPattern\" : \"/{name}\"\n}", + "options": { + "raw": { + "language": "json" + } } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeId}}" ] }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." }, "response": [] }, @@ -6138,9 +6240,9 @@ "exec": [ "pm.test(\"Check detail page\", function () {", "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", "", " var jsonData = pm.response.json();", " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", @@ -6260,7 +6362,7 @@ "response": [] }, { - "name": "Archive Test Page", + "name": "Archive Test Page1", "event": [ { "listen": "test", @@ -6326,7 +6428,7 @@ "response": [] }, { - "name": "Delete Test Page", + "name": "Archive Test Page2", "event": [ { "listen": "test", @@ -6360,7 +6462,7 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/DELETE?inode={{pageDetailPageInode1}}&identifier={{pageDetailPageId1}}&indexPolicy=WAIT_FOR", + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/ARCHIVE?inode={{pageDetailPageInode2}}&identifier={{pageDetailPageId2}}&indexPolicy=WAIT_FOR", "host": [ "{{serverURL}}" ], @@ -6371,16 +6473,16 @@ "actions", "default", "fire", - "DELETE" + "ARCHIVE" ], "query": [ { "key": "inode", - "value": "{{pageDetailPageInode1}}" + "value": "{{pageDetailPageInode2}}" }, { "key": "identifier", - "value": "{{pageDetailPageId1}}" + "value": "{{pageDetailPageId2}}" }, { "key": "indexPolicy", @@ -6392,13 +6494,16 @@ "response": [] }, { - "name": "Delete ContentType", + "name": "Delete Test Page1", "event": [ { "listen": "test", "script": { "exec": [ - "" + "pm.test(\"No errors must be present\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});" ], "type": "text/javascript", "packages": {} @@ -6406,37 +6511,172 @@ } ], "request": { - "method": "DELETE", - "header": [], + "method": "PUT", + "header": [ + { + "key": "Origin", + "value": "{{serverURL}}" + } + ], + "body": { + "mode": "raw", + "raw": "{}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/DELETE?inode={{pageDetailPageInode1}}&identifier={{pageDetailPageId1}}&indexPolicy=WAIT_FOR", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "workflow", + "actions", + "default", + "fire", + "DELETE" + ], + "query": [ + { + "key": "inode", + "value": "{{pageDetailPageInode1}}" + }, + { + "key": "identifier", + "value": "{{pageDetailPageId1}}" + }, + { + "key": "indexPolicy", + "value": "WAIT_FOR" + } ] - }, - "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." + } }, "response": [] }, { - "name": "Archive Site", + "name": "Delete Test Page2", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Entity archived property is true\", function () {", - " var siteId= pm.collectionVariables.get(\"pageDetailSiteId\")", - " pm.expect(pm.response.json().entity.identifier).contains(siteId);", - " pm.expect(pm.response.json().entity.archived).to.be.true;", - "});", + "pm.test(\"No errors must be present\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Origin", + "value": "{{serverURL}}" + } + ], + "body": { + "mode": "raw", + "raw": "{}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/DELETE?inode={{pageDetailPageInode2}}&identifier={{pageDetailPageId2}}&indexPolicy=WAIT_FOR", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "DELETE" + ], + "query": [ + { + "key": "inode", + "value": "{{pageDetailPageInode2}}" + }, + { + "key": "identifier", + "value": "{{pageDetailPageId2}}" + }, + { + "key": "indexPolicy", + "value": "WAIT_FOR" + } + ] + } + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Response entity contains 'deleted'\", function () {", + " pm.expect(pm.response.json().entity).to.include(\"deleted\");", + "});", + "", + "pm.test(\"Errors array is empty\", function () {", + " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." + }, + "response": [] + }, + { + "name": "Archive Site", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Entity archived property is true\", function () {", + " var siteId= pm.collectionVariables.get(\"pageDetailSiteId\")", + " pm.expect(pm.response.json().entity.identifier).contains(siteId);", + " pm.expect(pm.response.json().entity.archived).to.be.true;", + "});", "", "pm.test(\"Errors array is empty\", function () {", " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", @@ -6520,737 +6760,766 @@ "type": "text/javascript", "packages": {}, "exec": [ - "skipPreResquest = pm.collectionVariables.get(\"skipPreResquest\");", - "", - "if (!skipPreResquest){", - " pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - " });", - "}" + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" ] } } ] - } - ], - "description": "when specifying a detail page for a url mapped page, a user should be able to specify a path and not rely on an id, e.g. //demo.dotcms.com/blogs/detail-page", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } }, { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Test don't relying on id", - "item": [ - { - "name": "Content Type", + "name": "Test create content type with detailPage as URI", "item": [ { - "name": "Creation without id", - "item": [ + "name": "Create Test Site", + "event": [ { - "name": "Create ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Storing page data for subsequent tests\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"pageDetailSiteId\", jsonData.entity.identifier);", + " pm.collectionVariables.set(\"pageDetailSiteName\", jsonData.entity.siteName);", + "});", + "" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a content type without a content type id in the body." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"siteName\":\"page.detail.host.com.{{$timestamp}}\",\n \"variables\":[]\n}\n", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/site", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Searched for a content type by id validating the content type was created." - }, - "response": [] - }, + "path": [ + "api", + "v1", + "site" + ] + } + }, + "response": [] + }, + { + "name": "Create test Page", + "event": [ { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Storing page id and path for subsequent tests\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"pageDetailPageId1\", jsonData.entity.identifier);", + " pm.collectionVariables.set(\"pageDetailPageInode1\", jsonData.entity.inode);", + " pm.collectionVariables.set(\"pageDetailPageURL1\", jsonData.entity.url);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"contentlet\":{\n\t\t\"stName\": \"htmlpageasset\",\n\t\t\"title\": \"Page1 {{$timestamp}}\",\n \"url\": \"page1-{{$timestamp}}\",\n \"friendlyName\":\"page1-{{$timestamp}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"100\",\n \"hostFolder\":\"{{pageDetailSiteId}}\"\n\t}\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Cleanup" - }, - "response": [] + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] } - ], - "description": "This test tries to create a content type without provide a content type id in the body, this is the most common escenario creating a content type." + }, + "response": [] }, { - "name": "Creation with non existing id", - "item": [ + "name": "Create ContentType with page detail as URI", + "event": [ { - "name": "Create ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity[0].detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity[0].detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"123ec8e74bc0fd62172507{{$timestamp}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a content type using in the body a non existing content type id." - }, - "response": [] + "type": "text/javascript", + "packages": {} + } }, { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Searched for a content type by id validating the content type was created." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype" + ] }, + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." + }, + "response": [] + }, + { + "name": "Try to create a page detail with non existing URI", + "event": [ { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Cleanup" - }, - "response": [] + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Correct response message\", function () {", + " pm.expect(pm.response.json().message).to.include('Missing required information when creating Content Type(s):');", + "});", + "", + "pm.collectionVariables.set(\"skipPreResquest\", false); " + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.collectionVariables.set(\"skipPreResquest\", true); " + ], + "type": "text/javascript", + "packages": {} + } } ], - "description": "This test creates a content type with a not existing id in the body" + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}11{{pageDetailPageURL1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." + }, + "response": [] }, { - "name": "Multiple update permutations", - "item": [ + "name": "Try to create ContentType with page detail as URI without credentials", + "event": [ { - "name": "Create ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response content type is text/plain\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"text/plain\");", + "});", + "", + "pm.test(\"Check if the response is invalid\", function () {", + " pm.expect(pm.response.text()).to.include(\"Invalid User\");", + "});", + "", + "", + "pm.collectionVariables.set(\"skipPreResquest\", false);" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Simple content type creation to set up the test data." - }, - "response": [] + "type": "text/javascript", + "packages": {} + } }, { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({", + " url: pm.environment.get(\"serverURL\") + \"/api/v1/logout\",", + " method: 'GET'", + "}, function (err, res) {", + " if (err) {", + " console.log('Logout failed:', err);", + " } else {", + " console.log('Logout successful, cookies should be cleared.');", + " }", + "});", + "", + "pm.collectionVariables.set(\"skipPreResquest\", true);" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Searched for a content type by id validating the content type was created." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype" + ] }, + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ { - "name": "Update Content Type without id in body and variable in body but existing id in path param", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type without an id and variable in the body but with a valid content type id as path param." - }, - "response": [] + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." + }, + "response": [] + }, + { + "name": "Update Content Type removing page detail", + "event": [ { - "name": "Update Content Type without id in body and variable in body but existing variable in path param", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData).not.have.property('detailPage');", + " pm.expect(jsonData).not.have.property('detailPagePath');", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"urlMapPattern\" : \"/{name}\"\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeVariable}}" - ] - }, - "description": "Updates a content type without an id and variable in the body but with a valid content type id as path param." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ { - "name": "Update Content Type without id in body and variable in body and non existing id in path param", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 404 Not found\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData).not.have.property('detailPage');", + " pm.expect(jsonData).not.have.property('detailPagePath');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "does-not-exist" - ] - }, - "description": "Updates a content type without an id and variable in the body and without a valid content type id as path param." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." + }, + "response": [] + }, + { + "name": "Archive Test Page", + "event": [ { - "name": "Update Content Type with existing ids", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"No errors must be present\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Origin", + "value": "{{serverURL}}" + } + ], + "body": { + "mode": "raw", + "raw": "{}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/ARCHIVE?inode={{pageDetailPageInode1}}&identifier={{pageDetailPageId1}}&indexPolicy=WAIT_FOR", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "ARCHIVE" + ], + "query": [ + { + "key": "inode", + "value": "{{pageDetailPageInode1}}" }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + { + "key": "identifier", + "value": "{{pageDetailPageId1}}" }, - "description": "Updates a content type with valid ids and variable name." - }, - "response": [] - }, - { - "name": "Update Content Type with existing id and variable in body but non existing id in path param", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "indexPolicy", + "value": "WAIT_FOR" } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "does-not-exist" - ] - }, - "description": "Updates a content type resolving the content type using the data in the body as the path param id does not exist." - }, - "response": [] - }, + ] + } + }, + "response": [] + }, + { + "name": "Delete Test Page", + "event": [ { - "name": "Update Content Type with no existing id in body and not existing id in path param", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"No errors must be present\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Origin", + "value": "{{serverURL}}" + } + ], + "body": { + "mode": "raw", + "raw": "{}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/DELETE?inode={{pageDetailPageInode1}}&identifier={{pageDetailPageId1}}&indexPolicy=WAIT_FOR", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"does-not-exist\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "DELETE" + ], + "query": [ + { + "key": "inode", + "value": "{{pageDetailPageInode1}}" }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "does-not-exist" - ] + { + "key": "identifier", + "value": "{{pageDetailPageId1}}" }, - "description": "Updates a content type resolving the content type using the id and variable in the body as the path param id does not exist. \nIn this test the id does not exist but the variable does." - }, - "response": [] - }, - { - "name": "Update Content Type without id in body and not existing id in path param", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", + "key": "indexPolicy", + "value": "WAIT_FOR" + } + ] + } + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." + }, + "response": [] + }, + { + "name": "Archive Site", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Entity archived property is true\", function () {", + " var siteId= pm.collectionVariables.get(\"pageDetailSiteId\")", + " pm.expect(pm.response.json().entity.identifier).contains(siteId);", + " pm.expect(pm.response.json().entity.archived).to.be.true;", + "});", + "", + "pm.test(\"Errors array is empty\", function () {", + " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/site/{{pageDetailSiteId}}/_archive", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "site", + "{{pageDetailSiteId}}", + "_archive" + ] + } + }, + "response": [] + }, + { + "name": "Delete Site", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Errors array is empty\", function () {", + " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/site/{{pageDetailSiteId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "site", + "{{pageDetailSiteId}}" + ] + } + }, + "response": [] + } + ], + "description": "The `detailPage` attribute supports id and URI for updates, these tests validate both cases are working as expected.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "skipPreResquest = pm.collectionVariables.get(\"skipPreResquest\");", + "", + "if (!skipPreResquest){", + " pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + " });", + "}" + ] + } + } + ] + } + ], + "description": "when specifying a detail page for a url mapped page, a user should be able to specify a path and not rely on an id, e.g. //demo.dotcms.com/blogs/detail-page", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Test don't relying on id", + "item": [ + { + "name": "Content Type", + "item": [ + { + "name": "Creation without id", + "item": [ + { + "name": "Create ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", "", + "pm.test(\"Storing content type id\", function () {", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", "});" ], "type": "text/javascript", @@ -7259,53 +7528,43 @@ } ], "request": { - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "does-not-exist" + "contenttype" ] }, - "description": "Updates a content type resolving the content type using variable in the body as the path param id does not exist. \nIn this test the id in the body is not set, so the variable should be used." + "description": "Creates a content type without a content type id in the body." }, "response": [] }, { - "name": "Update Content Type with not existing variable", + "name": "Get Content Type", "event": [ { "listen": "test", "script": { "exec": [ + "var jsonData = pm.response.json();", + "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", "});" ], "type": "text/javascript", @@ -7314,19 +7573,10 @@ } ], "request": { - "method": "PUT", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"doesnotexist\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], @@ -7335,55 +7585,10 @@ "v1", "contenttype", "id", - "does-not-exist" + "{{contentTypeId}}" ] }, - "description": "Updates a content type resolving the content type using the id and variable in the body as the path param id does not exist. \nIn this test the variable in the body does not exist." - }, - "response": [] - }, - { - "name": "Update Content Type with not existing id and variable and path param", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"does-not-exist\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"doesnotexist\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "does-not-exist" - ] - }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." + "description": "Searched for a content type by id validating the content type was created." }, "response": [] }, @@ -7424,16 +7629,10 @@ "response": [] } ], - "description": "On this set of tests we are going to test multiple updates permutations." - } - ], - "description": "In this folder we test different scenarios for handling the Content Type where we validate cases in order to not always rely on the Content Type ID." - }, - { - "name": "Fields", - "item": [ + "description": "This test tries to create a content type without provide a content type id in the body, this is the most common escenario creating a content type." + }, { - "name": "Creation without id", + "name": "Creation with non existing id", "item": [ { "name": "Create ContentType", @@ -7467,7 +7666,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"123ec8e74bc0fd62172507{{$timestamp}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, "url": { "raw": "{{serverURL}}/api/v1/contenttype", @@ -7480,7 +7679,7 @@ "contenttype" ] }, - "description": "Creates a content type and field without a field id or content type id in the field." + "description": "Creates a content type using in the body a non existing content type id." }, "response": [] }, @@ -7518,7 +7717,7 @@ "{{contentTypeId}}" ] }, - "description": "Validates the content type and field were created as expected." + "description": "Searched for a content type by id validating the content type was created." }, "response": [] }, @@ -7554,15 +7753,15 @@ "{{contentTypeId}}" ] }, - "description": "Cleanup." + "description": "Cleanup" }, "response": [] } ], - "description": "This test tries to create a content type and field without provide a field ID in the body, this is the most common escenario creating a content type." + "description": "This test creates a content type with a not existing id in the body" }, { - "name": "Creation with non existing id", + "name": "Multiple update permutations", "item": [ { "name": "Create ContentType", @@ -7579,9 +7778,7 @@ " var jsonData = pm.response.json();", " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", - " pm.collectionVariables.set(\"contentTypeField1Variable\", jsonData.entity[0].fields[0].variable);", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[2].id);", "});" ], "type": "text/javascript", @@ -7599,7 +7796,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"123ec8e74bc0fd62172507{{$timestamp}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, "url": { "raw": "{{serverURL}}/api/v1/contenttype", @@ -7612,7 +7809,7 @@ "contenttype" ] }, - "description": "Creates a field using a non existing field id." + "description": "Simple content type creation to set up the test data." }, "response": [] }, @@ -7627,16 +7824,6 @@ "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -7660,12 +7847,12 @@ "{{contentTypeId}}" ] }, - "description": "Validates the content type and field were created as expected." + "description": "Searched for a content type by id validating the content type was created." }, "response": [] }, { - "name": "Delete ContentType", + "name": "Update Content Type without id in body and variable in body but existing id in path param", "event": [ { "listen": "test", @@ -7673,6 +7860,16 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", "});" ], "type": "text/javascript", @@ -7681,8 +7878,17 @@ } ], "request": { - "method": "DELETE", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -7696,18 +7902,12 @@ "{{contentTypeId}}" ] }, - "description": "Cleanup" + "description": "Updates a content type without an id and variable in the body but with a valid content type id as path param." }, "response": [] - } - ], - "description": "This test creates the Content Type with a field with a not existing field id in the body." - }, - { - "name": "Multiple update permutations Copy", - "item": [ + }, { - "name": "Create ContentType", + "name": "Update Content Type without id in body and variable in body but existing variable in path param", "event": [ { "listen": "test", @@ -7717,12 +7917,14 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing content type id\", function () {", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", + "", " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", - " pm.collectionVariables.set(\"contentTypeField1Variable\", jsonData.entity[0].fields[0].variable);", + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", "});" ], "type": "text/javascript", @@ -7731,53 +7933,43 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeVariable}}" ] }, - "description": "Simple creation to sep up the data for the update tests." + "description": "Updates a content type without an id and variable in the body but with a valid content type id as path param." }, "response": [] }, { - "name": "Get Content Type", + "name": "Update Content Type without id in body and variable in body and non existing id in path param", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", + "pm.test(\"Status code should be 404 Not found\", function () {", + " pm.response.to.have.status(404);", "});" ], "type": "text/javascript", @@ -7786,10 +7978,19 @@ } ], "request": { - "method": "GET", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", "host": [ "{{serverURL}}" ], @@ -7798,15 +7999,15 @@ "v1", "contenttype", "id", - "{{contentTypeId}}" + "does-not-exist" ] }, - "description": "Validates the content type and field were created as expected." + "description": "Updates a content type without an id and variable in the body and without a valid content type id as path param." }, "response": [] }, { - "name": "Update field with no variable name", + "name": "Update Content Type with existing ids", "event": [ { "listen": "test", @@ -7818,12 +8019,12 @@ "", "pm.test(\"Check response\", function () {", "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", "", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", "});" ], "type": "text/javascript", @@ -7836,7 +8037,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", "options": { "raw": { "language": "json" @@ -7856,12 +8057,12 @@ "{{contentTypeId}}" ] }, - "description": "Updates the field with no variable name." + "description": "Updates a content type with valid ids and variable name." }, "response": [] }, { - "name": "Update field with no content type id", + "name": "Update Content Type with existing id and variable in body but non existing id in path param", "event": [ { "listen": "test", @@ -7874,13 +8075,11 @@ "pm.test(\"Check response\", function () {", "", " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", "", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", - " pm.expect(jsonData.entity.fields[0].contentTypeId).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", "});" ], "type": "text/javascript", @@ -7893,7 +8092,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", "options": { "raw": { "language": "json" @@ -7901,7 +8100,7 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", "host": [ "{{serverURL}}" ], @@ -7910,15 +8109,15 @@ "v1", "contenttype", "id", - "{{contentTypeId}}" + "does-not-exist" ] }, - "description": "Updates the fields with no content type id in the fields." + "description": "Updates a content type resolving the content type using the data in the body as the path param id does not exist." }, "response": [] }, { - "name": "Update field with content type id", + "name": "Update Content Type with no existing id in body and not existing id in path param", "event": [ { "listen": "test", @@ -7930,12 +8129,12 @@ "", "pm.test(\"Check response\", function () {", "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", "", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", "});" ], "type": "text/javascript", @@ -7948,7 +8147,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"does-not-exist\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", "options": { "raw": { "language": "json" @@ -7956,7 +8155,7 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", "host": [ "{{serverURL}}" ], @@ -7965,15 +8164,15 @@ "v1", "contenttype", "id", - "{{contentTypeId}}" + "does-not-exist" ] }, - "description": "Updates the fields with the content type id in the fields." + "description": "Updates a content type resolving the content type using the id and variable in the body as the path param id does not exist. \nIn this test the id does not exist but the variable does." }, "response": [] }, { - "name": "Update field with existing id", + "name": "Update Content Type without id in body and not existing id in path param", "event": [ { "listen": "test", @@ -7985,12 +8184,12 @@ "", "pm.test(\"Check response\", function () {", "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", "", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", "});" ], "type": "text/javascript", @@ -8003,7 +8202,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", "options": { "raw": { "language": "json" @@ -8011,7 +8210,7 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", "host": [ "{{serverURL}}" ], @@ -8020,15 +8219,15 @@ "v1", "contenttype", "id", - "{{contentTypeId}}" + "does-not-exist" ] }, - "description": "Updates a field using an existing field id." + "description": "Updates a content type resolving the content type using variable in the body as the path param id does not exist. \nIn this test the id in the body is not set, so the variable should be used." }, "response": [] }, { - "name": "Update field with no existing id", + "name": "Update Content Type with not existing variable", "event": [ { "listen": "test", @@ -8040,12 +8239,12 @@ "", "pm.test(\"Check response\", function () {", "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", "", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", "});" ], "type": "text/javascript", @@ -8058,7 +8257,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"does-not-exist\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"doesnotexist\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", "options": { "raw": { "language": "json" @@ -8066,7 +8265,7 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", "host": [ "{{serverURL}}" ], @@ -8075,32 +8274,22 @@ "v1", "contenttype", "id", - "{{contentTypeVariable}}" + "does-not-exist" ] }, - "description": "Updates the field with a non existing field id but existing field variable name." + "description": "Updates a content type resolving the content type using the id and variable in the body as the path param id does not exist. \nIn this test the variable in the body does not exist." }, "response": [] }, { - "name": "Update field without id", + "name": "Update Content Type with not existing id and variable and path param", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", + "pm.test(\"Status code should be ok 404\", function () {", + " pm.response.to.have.status(404);", "});" ], "type": "text/javascript", @@ -8113,7 +8302,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"does-not-exist\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"doesnotexist\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", "options": { "raw": { "language": "json" @@ -8121,7 +8310,7 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", "host": [ "{{serverURL}}" ], @@ -8130,15 +8319,15 @@ "v1", "contenttype", "id", - "{{contentTypeVariable}}" + "does-not-exist" ] }, - "description": "Updates a field without a field id in the body but with a valid variable name." + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." }, "response": [] }, { - "name": "Update field without id and variable", + "name": "Delete ContentType", "event": [ { "listen": "test", @@ -8154,41 +8343,95 @@ } ], "request": { - "method": "PUT", + "method": "DELETE", "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Cleanup" + }, + "response": [] + } + ], + "description": "On this set of tests we are going to test multiple updates permutations." + } + ], + "description": "In this folder we test different scenarios for handling the Content Type where we validate cases in order to not always rely on the Content Type ID." + }, + { + "name": "Fields", + "item": [ + { + "name": "Creation without id", + "item": [ + { + "name": "Create ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeVariable}}" + "contenttype" ] }, - "description": "Updates a content type with a field without a field id and field variable in the body, as there is not data to use to identify the field, a new field will be created." + "description": "Creates a content type and field without a field id or content type id in the field." }, "response": [] }, { - "name": "Delete ContentType", + "name": "Get Content Type", "event": [ { "listen": "test", "script": { "exec": [ + "var jsonData = pm.response.json();", + "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", "});" @@ -8199,7 +8442,7 @@ } ], "request": { - "method": "DELETE", + "method": "GET", "header": [], "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", @@ -8214,67 +8457,20 @@ "{{contentTypeId}}" ] }, - "description": "Cleanup" + "description": "Validates the content type and field were created as expected." }, "response": [] - } - ] - } - ], - "description": "In this folder we test different scenarios for handling the Content Type fields where we validate cases in order to not always rely on the Content Type field ID." - } - ], - "description": "When saving content type and fields, we don't need to rely entirely on ids, if the id does not exist or is not provided, we should use variables as the key.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Test Workflows", - "item": [ - { - "name": "Simple workflows array", - "item": [ - { - "name": "Creation", - "item": [ + }, { - "name": "Create Scheme", + "name": "Delete ContentType", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 200 \", function () {", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing workflow data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"schemeId\", jsonData.entity.id);", - " pm.collectionVariables.set(\"schemeName\", jsonData.entity.name);", - " pm.collectionVariables.set(\"schemeVariableName\", jsonData.entity.variableName);", - "});", - "" + "});" ], "type": "text/javascript", "packages": {} @@ -8282,35 +8478,33 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\"schemeName\": \"Test Schema {{$timestamp}}\", \"schemeDescription\": \"Test sechema\", \"schemeArchived\": \"false\"}" - }, + "method": "DELETE", + "header": [], "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "workflow", - "schemes" + "contenttype", + "id", + "{{contentTypeId}}" ] }, - "description": "Creates a new test scheme" + "description": "Cleanup." }, "response": [] - }, + } + ], + "description": "This test tries to create a content type and field without provide a field ID in the body, this is the most common escenario creating a content type." + }, + { + "name": "Creation with non existing id", + "item": [ { - "name": "Create ContentType with workflow id", + "name": "Create ContentType", "event": [ { "listen": "test", @@ -8320,19 +8514,13 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing content type data\", function () {", + "pm.test(\"Storing content type id\", function () {", " var jsonData = pm.response.json();", " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[2].id);", + " pm.collectionVariables.set(\"contentTypeField1Variable\", jsonData.entity[0].fields[2].variable);", "});" ], "type": "text/javascript", @@ -8350,7 +8538,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"123ec8e74bc0fd62172507{{$timestamp}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, "url": { "raw": "{{serverURL}}/api/v1/contenttype", @@ -8363,7 +8551,7 @@ "contenttype" ] }, - "description": "Creates a content type using a workflow id." + "description": "Creates a field using a non existing field id." }, "response": [] }, @@ -8380,13 +8568,14 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Validate response\", function () {", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + "", " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -8409,7 +8598,8 @@ "id", "{{contentTypeId}}" ] - } + }, + "description": "Validates the content type and field were created as expected." }, "response": [] }, @@ -8444,12 +8634,19 @@ "id", "{{contentTypeId}}" ] - } + }, + "description": "Cleanup" }, "response": [] - }, + } + ], + "description": "This test creates the Content Type with a field with a not existing field id in the body." + }, + { + "name": "Multiple update permutations", + "item": [ { - "name": "Create ContentType with workflow variable name", + "name": "Create ContentType", "event": [ { "listen": "test", @@ -8459,19 +8656,12 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing content type data\", function () {", + "pm.test(\"Storing content type id\", function () {", " var jsonData = pm.response.json();", " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[2].id);", + " pm.collectionVariables.set(\"contentTypeField1Variable\", jsonData.entity[0].fields[2].variable);", "});" ], "type": "text/javascript", @@ -8489,7 +8679,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, "url": { "raw": "{{serverURL}}/api/v1/contenttype", @@ -8502,19 +8692,31 @@ "contenttype" ] }, - "description": "Creates a content type using a workflow variable name." + "description": "Simple creation to sep up the data for the update tests." }, "response": [] }, { - "name": "Delete ContentType", + "name": "Get Content Type", "event": [ { "listen": "test", "script": { "exec": [ + "var jsonData = pm.response.json();", + "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -8523,7 +8725,7 @@ } ], "request": { - "method": "DELETE", + "method": "GET", "header": [], "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", @@ -8537,12 +8739,13 @@ "id", "{{contentTypeId}}" ] - } + }, + "description": "Validates the content type and field were created as expected." }, "response": [] }, { - "name": "Create ContentType with workflow variable name and id", + "name": "Update field with no variable name", "event": [ { "listen": "test", @@ -8552,34 +8755,15 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate response\", function () {", + "pm.test(\"Check response\", function () {", "", - " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", - " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", "", " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " workflows = workflows.sort(compareBy);", - " pm.expect(2).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - " pm.expect(workflows[1].id).to.eql(testSchemeId);", - " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", - "});", - "", - "function compareBy(a, b) {", - " if (a.variableName < b.variableName) { return -1; }", - " if (a.variableName > b.variableName) { return 1; }", - " return 0;", - "}", - "" + " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", + "});" ], "type": "text/javascript", "packages": {} @@ -8587,34 +8771,36 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"{{schemeId}}\",\"systemworkflow\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeId}}" ] }, - "description": "Creates a content type using a workflow id and a workflow variable name." + "description": "Updates the field with no variable name." }, "response": [] }, { - "name": "Delete ContentType", + "name": "Update field with no content type id", "event": [ { "listen": "test", @@ -8622,6 +8808,18 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", + " pm.expect(jsonData.entity.fields[2].contentTypeId).to.eql(contentTypeId);", "});" ], "type": "text/javascript", @@ -8630,8 +8828,17 @@ } ], "request": { - "method": "DELETE", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -8644,21 +8851,31 @@ "id", "{{contentTypeId}}" ] - } + }, + "description": "Updates the fields with no content type id in the fields." }, "response": [] }, { - "name": "Create ContentType with wrong workflow #1", + "name": "Update field with content type id", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", "});", - "" + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", + "});" ], "type": "text/javascript", "packages": {} @@ -8666,43 +8883,54 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"doesNotExist\",\"systemworkflow\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeId}}" ] }, - "description": "Validates the proper error handling when a wrong workflow is used." + "description": "Updates the fields with the content type id in the fields." }, "response": [] }, { - "name": "Create ContentType with wrong workflow #2", + "name": "Update field with existing id", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", "});", - "" + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", + "});" ], "type": "text/javascript", "packages": {} @@ -8710,41 +8938,53 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"doesNotExist\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeId}}" ] }, - "description": "Validates the proper error handling when a wrong workflow is used." + "description": "Updates a field using an existing field id." }, "response": [] }, { - "name": "Archive Scheme", + "name": "Update field with no existing id", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 200 \", function () {", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -8753,67 +8993,53 @@ } ], "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "header": [], "body": { "mode": "raw", - "raw": "{\"schemeName\": \"{{schemeName}}\", \"schemeArchived\": \"true\"}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"does-not-exist\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "workflow", - "schemes", - "{{schemeId}}" + "contenttype", + "id", + "{{contentTypeVariable}}" ] }, - "description": "\n### Update Workflow Scheme\n\nUpdates an existing workflow scheme.\n\n#### Request Body\n- `schemeName` (string, optional): The name of the scheme.\n- `schemeArchived` (boolean, optional): Indicates if the scheme is archived.\n\n#### Response\nThe response for this request is documented as a JSON schema.\n" + "description": "Updates the field with a non existing field id but existing field variable name." }, "response": [] }, { - "name": "Delete Scheme", + "name": "Update field without id", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 200 \", function () {", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -8822,75 +9048,153 @@ } ], "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeVariable}}" ] }, - "method": "DELETE", + "description": "Updates a field without a field id in the body but with a valid variable name." + }, + "response": [] + }, + { + "name": "Update field without id and variable", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "workflow", - "schemes", - "{{schemeId}}" + "contenttype", + "id", + "{{contentTypeVariable}}" ] - } + }, + "description": "Updates a content type with a field without a field id and field variable in the body, as there is not data to use to identify the field, a new field will be created." }, "response": [] - } - ], - "description": "Covering different save scenarios for saving workflows in a content type.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } }, { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Cleanup" + }, + "response": [] } ] - }, + } + ], + "description": "In this folder we test different scenarios for handling the Content Type fields where we validate cases in order to not always rely on the Content Type field ID." + } + ], + "description": "When saving content type and fields, we don't need to rely entirely on ids, if the id does not exist or is not provided, we should use variables as the key.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Test Workflows", + "item": [ + { + "name": "Simple workflows array", + "item": [ { - "name": "Update", + "name": "Creation", "item": [ { "name": "Create Scheme", @@ -8940,12 +9244,12 @@ "schemes" ] }, - "description": "Creates a test scheme" + "description": "Creates a new test scheme" }, "response": [] }, { - "name": "Create ContentType", + "name": "Create ContentType with workflow id", "event": [ { "listen": "test", @@ -8959,7 +9263,6 @@ " var jsonData = pm.response.json();", " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", "});", "", "pm.test(\"Validate response\", function () {", @@ -9050,7 +9353,7 @@ "response": [] }, { - "name": "Update Content Type with workflow id", + "name": "Delete ContentType", "event": [ { "listen": "test", @@ -9058,16 +9361,6 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var jsonData = pm.response.json();", - "", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -9076,17 +9369,8 @@ } ], "request": { - "method": "PUT", + "method": "DELETE", "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -9099,13 +9383,12 @@ "id", "{{contentTypeId}}" ] - }, - "description": "Updates a content type using a workflow id." + } }, "response": [] }, { - "name": "Update Content Type with workflow variable name", + "name": "Create ContentType with workflow variable name", "event": [ { "listen": "test", @@ -9115,11 +9398,16 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Validate response\", function () {", - "", + "pm.test(\"Storing content type data\", function () {", " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", "", - " var workflows = jsonData.entity.workflows;", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", " pm.expect(1).to.eql(workflows.length);", " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", @@ -9131,36 +9419,34 @@ } ], "request": { - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\"]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\"]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "contenttype" ] }, - "description": "Updates a content type using a workflow variable name." + "description": "Creates a content type using a workflow variable name." }, "response": [] }, { - "name": "Update Content Type with workflow variable name and id", + "name": "Delete ContentType", "event": [ { "listen": "test", @@ -9168,29 +9454,71 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", - " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", - "", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity.workflows;", - " workflows = workflows.sort(compareBy);", - " pm.expect(2).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - " pm.expect(workflows[1].id).to.eql(testSchemeId);", - " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", - "});", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + } + }, + "response": [] + }, + { + "name": "Create ContentType with workflow variable name and id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", + " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", + "", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", + " workflows = workflows.sort(compareBy);", + " pm.expect(2).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + " pm.expect(workflows[1].id).to.eql(testSchemeId);", + " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", + "});", "", "function compareBy(a, b) {", " if (a.variableName < b.variableName) { return -1; }", " if (a.variableName > b.variableName) { return 1; }", " return 0;", - "}" + "}", + "" ], "type": "text/javascript", "packages": {} @@ -9198,43 +9526,41 @@ } ], "request": { - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\", \"{{schemeId}}\"]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"{{schemeId}}\",\"systemworkflow\"]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "contenttype" ] }, - "description": "Updates a content type using a workflow variable name and a workflow id." + "description": "Creates a content type using a workflow id and a workflow variable name." }, "response": [] }, { - "name": "Update Content Type with wrong workflow #1", + "name": "Delete ContentType", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", "});" ], "type": "text/javascript", @@ -9243,17 +9569,8 @@ } ], "request": { - "method": "PUT", + "method": "DELETE", "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\", \"doestNotExist\"]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -9266,13 +9583,12 @@ "id", "{{contentTypeId}}" ] - }, - "description": "Validates the proper error handling when a wrong workflow is used." + } }, "response": [] }, { - "name": "Update Content Type with wrong workflow #2", + "name": "Create ContentType with wrong workflow #1", "event": [ { "listen": "test", @@ -9280,7 +9596,8 @@ "exec": [ "pm.test(\"Status code should be 400\", function () {", " pm.response.to.have.status(400);", - "});" + "});", + "" ], "type": "text/javascript", "packages": {} @@ -9288,28 +9605,26 @@ } ], "request": { - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"doestNotExist\"]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"doesNotExist\",\"systemworkflow\"]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "contenttype" ] }, "description": "Validates the proper error handling when a wrong workflow is used." @@ -9317,15 +9632,16 @@ "response": [] }, { - "name": "Delete ContentType", + "name": "Create ContentType with wrong workflow #2", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "" ], "type": "text/javascript", "packages": {} @@ -9333,21 +9649,29 @@ } ], "request": { - "method": "DELETE", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"doesNotExist\"]\n}" + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "contenttype" ] - } + }, + "description": "Validates the proper error handling when a wrong workflow is used." }, "response": [] }, @@ -9415,7 +9739,8 @@ "schemes", "{{schemeId}}" ] - } + }, + "description": "\n### Update Workflow Scheme\n\nUpdates an existing workflow scheme.\n\n#### Request Body\n- `schemeName` (string, optional): The name of the scheme.\n- `schemeArchived` (boolean, optional): Indicates if the scheme is archived.\n\n#### Response\nThe response for this request is documented as a JSON schema.\n" }, "response": [] }, @@ -9479,7 +9804,7 @@ "response": [] } ], - "description": "Covering different update scenarios for saving workflows in a content type.", + "description": "Covering different save scenarios for saving workflows in a content type.", "event": [ { "listen": "prerequest", @@ -9502,15 +9827,9 @@ } } ] - } - ], - "description": "The content type allows to pass a simple array of workflows ids or variables, these tests cases will cover diferent escenarios for this workflows list." - }, - { - "name": "Structured workflows array", - "item": [ + }, { - "name": "Creation", + "name": "Update", "item": [ { "name": "Create Scheme", @@ -9560,12 +9879,12 @@ "schemes" ] }, - "description": "Creates a new test scheme" + "description": "Creates a test scheme" }, "response": [] }, { - "name": "Create ContentType with workflow id and variable name", + "name": "Create ContentType", "event": [ { "listen": "test", @@ -9579,6 +9898,7 @@ " var jsonData = pm.response.json();", " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[2].id);", "});", "", "pm.test(\"Validate response\", function () {", @@ -9605,7 +9925,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"indexed\": true,\n \"dataType\": \"TEXT\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"listed\": true,\n \"unique\": false,\n \"name\": \"Name\",\n \"variable\": \"name\",\n \"fixed\": true\n }\n ],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, "url": { "raw": "{{serverURL}}/api/v1/contenttype", @@ -9618,7 +9938,7 @@ "contenttype" ] }, - "description": "Creates a content type specifying a workflow id and variable name." + "description": "Creates a content type using a workflow id." }, "response": [] }, @@ -9669,7 +9989,7 @@ "response": [] }, { - "name": "Delete ContentType", + "name": "Update Content Type with workflow id", "event": [ { "listen": "test", @@ -9677,6 +9997,16 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var jsonData = pm.response.json();", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -9685,8 +10015,17 @@ } ], "request": { - "method": "DELETE", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -9699,12 +10038,13 @@ "id", "{{contentTypeId}}" ] - } + }, + "description": "Updates a content type using a workflow id." }, "response": [] }, { - "name": "Create ContentType with workflow variable name", + "name": "Update Content Type with workflow variable name", "event": [ { "listen": "test", @@ -9714,16 +10054,11 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", "pm.test(\"Validate response\", function () {", + "", " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", + "", + " var workflows = jsonData.entity.workflows;", " pm.expect(1).to.eql(workflows.length);", " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", @@ -9735,34 +10070,36 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\"]\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeId}}" ] }, - "description": "Creates a content type using just the workflow variable name." + "description": "Updates a content type using a workflow variable name." }, "response": [] }, { - "name": "Delete ContentType", + "name": "Update Content Type with workflow variable name and id", "event": [ { "listen": "test", @@ -9770,57 +10107,29 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - } - }, - "response": [] - }, - { - "name": "Create ContentType with workflow id", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", "});", "", "pm.test(\"Validate response\", function () {", + "", + " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", + " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", + "", " var jsonData = pm.response.json();", " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", + " var workflows = jsonData.entity.workflows;", + " workflows = workflows.sort(compareBy);", + " pm.expect(2).to.eql(workflows.length);", " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" + " pm.expect(workflows[1].id).to.eql(testSchemeId);", + " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", + "});", + "", + "function compareBy(a, b) {", + " if (a.variableName < b.variableName) { return -1; }", + " if (a.variableName > b.variableName) { return 1; }", + " return 0;", + "}" ], "type": "text/javascript", "packages": {} @@ -9828,41 +10137,43 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n }\n ]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\", \"{{schemeId}}\"]\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeId}}" ] }, - "description": "Creates a content type using just the workflow id." + "description": "Updates a content type using a workflow variable name and a workflow id." }, "response": [] }, { - "name": "Delete ContentType", + "name": "Update Content Type with wrong workflow #1", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", "});" ], "type": "text/javascript", @@ -9871,8 +10182,17 @@ } ], "request": { - "method": "DELETE", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\", \"doestNotExist\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -9885,49 +10205,21 @@ "id", "{{contentTypeId}}" ] - } + }, + "description": "Validates the proper error handling when a wrong workflow is used." }, "response": [] }, { - "name": "Create ContentType with multiple workflows", + "name": "Update Content Type with wrong workflow #2", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", - " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", - "", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " workflows = workflows.sort(compareBy);", - " pm.expect(2).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - " pm.expect(workflows[1].id).to.eql(testSchemeId);", - " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", - "});", - "", - "function compareBy(a, b) {", - " if (a.variableName < b.variableName) { return -1; }", - " if (a.variableName > b.variableName) { return 1; }", - " return 0;", - "}", - "" + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", + "});" ], "type": "text/javascript", "packages": {} @@ -9935,29 +10227,31 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n },\n {\n \"id\": \"{{schemeId}}\",\n \"variableName\": \"{{schemeVariableName}}\"\n }\n ]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"doestNotExist\"]\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeId}}" ] }, - "description": "Creates a content type with multiple workflows" + "description": "Validates the proper error handling when a wrong workflow is used." }, "response": [] }, @@ -9997,31 +10291,15 @@ "response": [] }, { - "name": "Create ContentType with non existing id but valid variable", + "name": "Archive Scheme", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", + "pm.test(\"Status code is 200 \", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});", - "" + "});" ], "type": "text/javascript", "packages": {} @@ -10029,7 +10307,31 @@ } ], "request": { - "method": "POST", + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "PUT", "header": [ { "key": "Content-Type", @@ -10038,249 +10340,34 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bf12345\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" + "raw": "{\"schemeName\": \"{{schemeName}}\", \"schemeArchived\": \"true\"}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "workflow", + "schemes", + "{{schemeId}}" ] - }, - "description": "Creates a content type with with a workflow using a non existing id but with a valid variable name." + } }, "response": [] }, { - "name": "Create ContentType with non existing variable but valid id", + "name": "Delete Scheme", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", + "pm.test(\"Status code is 200 \", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"doesNotExit\"\n }\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a content type with with a workflow using a non existing variable but with a valid id." - }, - "response": [] - }, - { - "name": "Create ContentType with wrong workflow #1", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"doesNotExist\"\n }\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Validates the proper error handling when a wrong workflow is used." - }, - "response": [] - }, - { - "name": "Create ContentType with wrong workflow #2", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"doesNotExist\"\n }\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Validates the proper error handling when a wrong workflow is used." - }, - "response": [] - }, - { - "name": "Archive Scheme", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200 \", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\"schemeName\": \"{{schemeName}}\", \"schemeArchived\": \"true\"}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "schemes", - "{{schemeId}}" - ] - }, - "description": "\n### Update Workflow Scheme\n\nUpdates an existing workflow scheme.\n\n#### Request Body\n- `schemeName` (string, optional): The name of the scheme.\n- `schemeArchived` (boolean, optional): Indicates if the scheme is archived.\n\n#### Response\nThe response for this request is documented as a JSON schema.\n" - }, - "response": [] - }, - { - "name": "Delete Scheme", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200 \", function () {", - " pm.response.to.have.status(200);", - "});" + "});" ], "type": "text/javascript", "packages": {} @@ -10331,7 +10418,7 @@ "response": [] } ], - "description": "Covering different save scenarios for saving workflows in a content type.", + "description": "Covering different update scenarios for saving workflows in a content type.", "event": [ { "listen": "prerequest", @@ -10354,9 +10441,15 @@ } } ] - }, + } + ], + "description": "The content type allows to pass a simple array of workflows ids or variables, these tests cases will cover diferent escenarios for this workflows list." + }, + { + "name": "Structured workflows array", + "item": [ { - "name": "Update", + "name": "Creation", "item": [ { "name": "Create Scheme", @@ -10406,12 +10499,12 @@ "schemes" ] }, - "description": "Creates a test scheme" + "description": "Creates a new test scheme" }, "response": [] }, { - "name": "Create ContentType", + "name": "Create ContentType with workflow id and variable name", "event": [ { "listen": "test", @@ -10425,7 +10518,6 @@ " var jsonData = pm.response.json();", " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", "});", "", "pm.test(\"Validate response\", function () {", @@ -10452,7 +10544,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"indexed\": true,\n \"dataType\": \"TEXT\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"listed\": true,\n \"unique\": false,\n \"name\": \"Name\",\n \"variable\": \"name\",\n \"fixed\": true\n }\n ],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" }, "url": { "raw": "{{serverURL}}/api/v1/contenttype", @@ -10465,7 +10557,7 @@ "contenttype" ] }, - "description": "Creates a content type with a workflow using an id and variable name." + "description": "Creates a content type specifying a workflow id and variable name." }, "response": [] }, @@ -10516,7 +10608,7 @@ "response": [] }, { - "name": "Update Content Type with workflow id and variable name", + "name": "Delete ContentType", "event": [ { "listen": "test", @@ -10524,16 +10616,6 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var jsonData = pm.response.json();", - "", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -10542,17 +10624,8 @@ } ], "request": { - "method": "PUT", + "method": "DELETE", "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -10565,13 +10638,12 @@ "id", "{{contentTypeId}}" ] - }, - "description": "Updates a content type using a workflow with id and variable name." + } }, "response": [] }, { - "name": "Update Content Type with workflow variable name", + "name": "Create ContentType with workflow variable name", "event": [ { "listen": "test", @@ -10581,11 +10653,16 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Validate response\", function () {", - "", + "pm.test(\"Storing content type data\", function () {", " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", "", - " var workflows = jsonData.entity.workflows;", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", " pm.expect(1).to.eql(workflows.length);", " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", @@ -10597,17 +10674,51 @@ } ], "request": { - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] }, + "description": "Creates a content type using just the workflow variable name." + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -10620,13 +10731,12 @@ "id", "{{contentTypeId}}" ] - }, - "description": "Updates a content type using a workflow with just a variable name." + } }, "response": [] }, { - "name": "Update Content Type with workflow id", + "name": "Create ContentType with workflow id", "event": [ { "listen": "test", @@ -10636,11 +10746,16 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Validate response\", function () {", - "", + "pm.test(\"Storing content type data\", function () {", " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", "", - " var workflows = jsonData.entity.workflows;", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", " pm.expect(1).to.eql(workflows.length);", " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", @@ -10652,17 +10767,51 @@ } ], "request": { - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n }\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] }, + "description": "Creates a content type using just the workflow id." + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -10675,13 +10824,12 @@ "id", "{{contentTypeId}}" ] - }, - "description": "Updates a content type using a workflow with just an id." + } }, "response": [] }, { - "name": "Update Content Type with with multiple workflows", + "name": "Create ContentType with multiple workflows", "event": [ { "listen": "test", @@ -10691,6 +10839,12 @@ " pm.response.to.have.status(200);", "});", "", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", "pm.test(\"Validate response\", function () {", "", " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", @@ -10698,7 +10852,7 @@ "", " var jsonData = pm.response.json();", " ", - " var workflows = jsonData.entity.workflows;", + " var workflows = jsonData.entity[0].workflows;", " workflows = workflows.sort(compareBy);", " pm.expect(2).to.eql(workflows.length);", " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", @@ -10711,7 +10865,8 @@ " if (a.variableName < b.variableName) { return -1; }", " if (a.variableName > b.variableName) { return 1; }", " return 0;", - "}" + "}", + "" ], "type": "text/javascript", "packages": {} @@ -10719,36 +10874,34 @@ } ], "request": { - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n },\n {\n \"id\": \"{{schemeId}}\",\n \"variableName\": \"{{schemeVariableName}}\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n },\n {\n \"id\": \"{{schemeId}}\",\n \"variableName\": \"{{schemeVariableName}}\"\n }\n ]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "contenttype" ] }, - "description": "Updates a content type with multiple workflow." + "description": "Creates a content type with multiple workflows" }, "response": [] }, { - "name": "Update Content Type with non existing id but valid variable", + "name": "Delete ContentType", "event": [ { "listen": "test", @@ -10756,16 +10909,6 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var jsonData = pm.response.json();", - "", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -10774,17 +10917,8 @@ } ], "request": { - "method": "PUT", + "method": "DELETE", "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bf12345\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -10797,13 +10931,12 @@ "id", "{{contentTypeId}}" ] - }, - "description": "Updates a content type with a workflow where the id is invalid but with a valid variable name." + } }, "response": [] }, { - "name": "Update Content Type with non existing variable but valid id", + "name": "Create ContentType with non existing id but valid variable", "event": [ { "listen": "test", @@ -10813,15 +10946,21 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Validate response\", function () {", - "", + "pm.test(\"Storing content type data\", function () {", " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", "", - " var workflows = jsonData.entity.workflows;", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", " pm.expect(1).to.eql(workflows.length);", " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" + "});", + "" ], "type": "text/javascript", "packages": {} @@ -10829,44 +10968,58 @@ } ], "request": { - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"doesNotExit\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bf12345\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "contenttype" ] }, - "description": "Updates a content type with a workflow where the id valid but with an invalid variable name." + "description": "Creates a content type with with a workflow using a non existing id but with a valid variable name." }, "response": [] }, { - "name": "Update Content Type with wrong workflow #1", + "name": "Create ContentType with non existing variable but valid id", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", - "});" + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});", + "" ], "type": "text/javascript", "packages": {} @@ -10874,551 +11027,3253 @@ } ], "request": { - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"doesNotExist\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"doesNotExit\"\n }\n ]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "contenttype" ] }, - "description": "Validates the proper error handling when a wrong workflow id is used." + "description": "Creates a content type with with a workflow using a non existing variable but with a valid id." + }, + "response": [] + }, + { + "name": "Create ContentType with wrong workflow #1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"doesNotExist\"\n }\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Validates the proper error handling when a wrong workflow is used." + }, + "response": [] + }, + { + "name": "Create ContentType with wrong workflow #2", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"doesNotExist\"\n }\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Validates the proper error handling when a wrong workflow is used." + }, + "response": [] + }, + { + "name": "Archive Scheme", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\"schemeName\": \"{{schemeName}}\", \"schemeArchived\": \"true\"}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "schemes", + "{{schemeId}}" + ] + }, + "description": "\n### Update Workflow Scheme\n\nUpdates an existing workflow scheme.\n\n#### Request Body\n- `schemeName` (string, optional): The name of the scheme.\n- `schemeArchived` (boolean, optional): Indicates if the scheme is archived.\n\n#### Response\nThe response for this request is documented as a JSON schema.\n" + }, + "response": [] + }, + { + "name": "Delete Scheme", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "schemes", + "{{schemeId}}" + ] + } }, "response": [] + } + ], + "description": "Covering different save scenarios for saving workflows in a content type.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Update", + "item": [ + { + "name": "Create Scheme", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing workflow data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"schemeId\", jsonData.entity.id);", + " pm.collectionVariables.set(\"schemeName\", jsonData.entity.name);", + " pm.collectionVariables.set(\"schemeVariableName\", jsonData.entity.variableName);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\"schemeName\": \"Test Schema {{$timestamp}}\", \"schemeDescription\": \"Test sechema\", \"schemeArchived\": \"false\"}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/schemes", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "schemes" + ] + }, + "description": "Creates a test scheme" + }, + "response": [] + }, + { + "name": "Create ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[2].id);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Creates a content type with a workflow using an id and variable name." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + } + }, + "response": [] + }, + { + "name": "Update Content Type with workflow id and variable name", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var jsonData = pm.response.json();", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type using a workflow with id and variable name." + }, + "response": [] + }, + { + "name": "Update Content Type with workflow variable name", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var jsonData = pm.response.json();", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type using a workflow with just a variable name." + }, + "response": [] + }, + { + "name": "Update Content Type with workflow id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var jsonData = pm.response.json();", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type using a workflow with just an id." + }, + "response": [] + }, + { + "name": "Update Content Type with with multiple workflows", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", + " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", + "", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity.workflows;", + " workflows = workflows.sort(compareBy);", + " pm.expect(2).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + " pm.expect(workflows[1].id).to.eql(testSchemeId);", + " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", + "});", + "", + "function compareBy(a, b) {", + " if (a.variableName < b.variableName) { return -1; }", + " if (a.variableName > b.variableName) { return 1; }", + " return 0;", + "}" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n },\n {\n \"id\": \"{{schemeId}}\",\n \"variableName\": \"{{schemeVariableName}}\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type with multiple workflow." + }, + "response": [] + }, + { + "name": "Update Content Type with non existing id but valid variable", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var jsonData = pm.response.json();", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bf12345\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type with a workflow where the id is invalid but with a valid variable name." + }, + "response": [] + }, + { + "name": "Update Content Type with non existing variable but valid id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var jsonData = pm.response.json();", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"doesNotExit\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type with a workflow where the id valid but with an invalid variable name." + }, + "response": [] + }, + { + "name": "Update Content Type with wrong workflow #1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"doesNotExist\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Validates the proper error handling when a wrong workflow id is used." + }, + "response": [] + }, + { + "name": "Update Content Type with wrong workflow #2", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"doesNotExist\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Validates the proper error handling when a wrong workflow variable name is used." + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + } + }, + "response": [] + }, + { + "name": "Archive Scheme", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\"schemeName\": \"{{schemeName}}\", \"schemeArchived\": \"true\"}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "schemes", + "{{schemeId}}" + ] + } + }, + "response": [] + }, + { + "name": "Delete Scheme", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "schemes", + "{{schemeId}}" + ] + } + }, + "response": [] + } + ], + "description": "Covering different update scenarios for saving workflows in a content type.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + } + ], + "description": "The content type allows to pass also a more estructured array of workflows where you can specify the id and variable for each workflow, these tests cases will cover diferent escenarios for this workflows list." + } + ], + "description": "Testing the diferent scenarios for saving workflows in a Content Type", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Layout fields", + "item": [ + { + "name": "Create", + "item": [ + { + "name": "Create ContentType without layout fields", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity[0].fields;", + " pm.expect(3).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity[0].fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Test to validate the layout fields are created even if not layout fields are sent." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(3).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Validates the content type and fields were created as expected." + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Cleanup" + }, + "response": [] + }, + { + "name": "Create ContentType with layout fields", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity[0].fields;", + " pm.expect(3).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity[0].fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"testContentType{{$timestamp}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fixed\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name\"\n }\n ],\n \"workflow\": [\n \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Test to validate the layout fields are respected when sent in the request." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(3).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Validates the content type and fields were created as expected." + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Cleanup" + }, + "response": [] + }, + { + "name": "Create ContentType with wrong layout", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity[0].fields;", + " pm.expect(4).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity[0].fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"testContentType{{$timestamp}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 10,\n \"unique\": false\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name\"\n }\n ],\n \"workflow\": [\n \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Test to validate the layout is fixed even if the layout in the body is wrong." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(4).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Validates the content type and fields were created as expected." + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Cleanup" + }, + "response": [] + } + ], + "description": "Folder to encapsulate multiple tests to validate the proper creation and handling of layout fields." + }, + { + "name": "Update", + "item": [ + { + "name": "Create ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", + " pm.collectionVariables.set(\"contentTypeField1Variable\", jsonData.entity[0].fields[0].variable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Simple creation to sep up the data for the update tests." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(3).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Validates the content type and fields were created as expected." + }, + "response": [] + }, + { + "name": "Update fields exceeding maximum columns", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(11).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[7].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[10].clazz);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field4\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 7,\n \"unique\": false,\n \"variable\": \"columnField4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field5\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"columnField5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field6\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 11,\n \"unique\": false,\n \"variable\": \"columnField6\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 12,\n \"unique\": false,\n \"variable\": \"name6\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates the fields exceeding maximum ammounts of columns per row." + }, + "response": [] + }, + { + "name": "Update fields exceeding maximum columns with multiple rows", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(22).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[7].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[10].clazz);", + "", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[11].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[12].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[13].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[14].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[15].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[16].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[17].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[18].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[19].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[20].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[21].clazz); ", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field4\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 7,\n \"unique\": false,\n \"variable\": \"columnField4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field5\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"columnField5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field6\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 11,\n \"unique\": false,\n \"variable\": \"columnField6\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 12,\n \"unique\": false,\n \"variable\": \"name6\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 13,\n \"unique\": false,\n \"variable\": \"rowField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field11\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 14,\n \"unique\": false,\n \"variable\": \"columnField11\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name11\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 15,\n \"unique\": false,\n \"variable\": \"name11\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field22\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 16,\n \"unique\": false,\n \"variable\": \"columnField22\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name22\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 17,\n \"unique\": false,\n \"variable\": \"name22\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field33\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 18,\n \"unique\": false,\n \"variable\": \"columnField33\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name33\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 19,\n \"unique\": false,\n \"variable\": \"name33\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field44\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 20,\n \"unique\": false,\n \"variable\": \"columnField44\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name44\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 21,\n \"unique\": false,\n \"variable\": \"name44\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field55\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 22,\n \"unique\": false,\n \"variable\": \"columnField55\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name55\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 23,\n \"unique\": false,\n \"variable\": \"name55\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field66\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 24,\n \"unique\": false,\n \"variable\": \"columnField66\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name66\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 25,\n \"unique\": false,\n \"variable\": \"name66\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates the fields exceeding maximum ammounts of columns per row." + }, + "response": [] + }, + { + "name": "Update fields validating order is respected", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(11).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields type order\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[7].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[10].clazz);", + "});", + "", + "pm.test(\"Validate fields order\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"rowField1\").to.eql(fields[0].variable);", + " pm.expect(\"columnField1\").to.eql(fields[1].variable);", + " pm.expect(\"name1\").to.eql(fields[2].variable);", + " pm.expect(\"columnField2\").to.eql(fields[3].variable);", + " pm.expect(\"name2\").to.eql(fields[4].variable);", + " pm.expect(\"columnField3\").to.eql(fields[5].variable);", + " pm.expect(\"name3\").to.eql(fields[6].variable);", + " pm.expect(\"columnField4\").to.eql(fields[7].variable);", + " pm.expect(\"name4\").to.eql(fields[8].variable);", + " pm.expect(\"name5\").to.eql(fields[9].variable);", + " pm.expect(\"name6\").to.eql(fields[10].variable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field4\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 7,\n \"unique\": false,\n \"variable\": \"columnField4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name6\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates the fields validating the given order is respected." + }, + "response": [] + }, + { + "name": "Update fields changing order", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(11).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields type order\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[7].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[10].clazz);", + "});", + "", + "pm.test(\"Validate fields order\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"rowField1\").to.eql(fields[0].variable);", + " pm.expect(\"columnField1\").to.eql(fields[1].variable);", + " pm.expect(\"name1\").to.eql(fields[2].variable);", + " pm.expect(\"columnField2\").to.eql(fields[3].variable);", + " pm.expect(\"name2\").to.eql(fields[4].variable);", + " pm.expect(\"columnField3\").to.eql(fields[5].variable);", + " pm.expect(\"name3\").to.eql(fields[6].variable);", + " pm.expect(\"columnField4\").to.eql(fields[7].variable);", + " pm.expect(\"name6\").to.eql(fields[8].variable);", + " pm.expect(\"name4\").to.eql(fields[9].variable);", + " pm.expect(\"name5\").to.eql(fields[10].variable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field4\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 7,\n \"unique\": false,\n \"variable\": \"columnField4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name6\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates the fields changing the order of the fields" + }, + "response": [] + }, + { + "name": "Update fields changing order again", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(11).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields type order\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[7].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[10].clazz);", + "});", + "", + "pm.test(\"Validate fields order\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"rowField1\").to.eql(fields[0].variable);", + " pm.expect(\"columnField1\").to.eql(fields[1].variable);", + " pm.expect(\"name1\").to.eql(fields[2].variable);", + " pm.expect(\"columnField2\").to.eql(fields[3].variable);", + " pm.expect(\"name3\").to.eql(fields[4].variable);", + " pm.expect(\"columnField3\").to.eql(fields[5].variable);", + " pm.expect(\"name2\").to.eql(fields[6].variable);", + " pm.expect(\"columnField4\").to.eql(fields[7].variable);", + " pm.expect(\"name6\").to.eql(fields[8].variable);", + " pm.expect(\"name4\").to.eql(fields[9].variable);", + " pm.expect(\"name5\").to.eql(fields[10].variable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field4\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 7,\n \"unique\": false,\n \"variable\": \"columnField4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name6\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates the fields changing the order of the fields" + }, + "response": [] + }, + { + "name": "Update fields removing column", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(10).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields type order\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[7].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", + "});", + "", + "pm.test(\"Validate fields order\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"rowField1\").to.eql(fields[0].variable);", + " pm.expect(\"columnField1\").to.eql(fields[1].variable);", + " pm.expect(\"name1\").to.eql(fields[2].variable);", + " pm.expect(\"columnField2\").to.eql(fields[3].variable);", + " pm.expect(\"name3\").to.eql(fields[4].variable);", + " pm.expect(\"columnField3\").to.eql(fields[5].variable);", + " pm.expect(\"name2\").to.eql(fields[6].variable);", + " pm.expect(\"name6\").to.eql(fields[7].variable);", + " pm.expect(\"name4\").to.eql(fields[8].variable);", + " pm.expect(\"name5\").to.eql(fields[9].variable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name6\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates the fields removing a column an validating the layout is correct." + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Cleanup" + }, + "response": [] + } + ], + "description": "Folder to encapsulate multiple tests to validate the proper update and handling of layout fields." + } + ], + "description": "Multiple tests validating the proper handling of layout fields when saving content types", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "System Action Mappings", + "item": [ + { + "name": "Create", + "item": [ + { + "name": "Create ContentType without systemActionMappings", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate systemActionMappings is empty\", function () {", + " var systemActionMappings = pm.response.json().entity[0].systemActionMappings;", + " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType1{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Test to validate the content type is created without `systemActionMappings`." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings is empty\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Validates the content type and `systemActionMappings` were created as expected." + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Cleanup" + }, + "response": [] + }, + { + "name": "Create ContentType with empty systemActionMappings", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate systemActionMappings is empty\", function () {", + " var systemActionMappings = pm.response.json().entity[0].systemActionMappings;", + " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType2{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"systemActionMappings\": {},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Test to validate the content type is created with empty `systemActionMappings`." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings is empty\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Validates the content type and `systemActionMappings` were created as expected." + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Cleanup" + }, + "response": [] + }, + { + "name": "Create ContentType with systemActionMappings", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate systemActionMappings exist\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity[0]).to.have.property('systemActionMappings');", + "});", + "", + "pm.test(\"Validate systemActionMappings contain 'NEW' and 'ARCHIVE'\", function () {", + " var systemActionMappings = pm.response.json().entity[0].systemActionMappings;", + " pm.expect(systemActionMappings).to.have.property('NEW');", + " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", + "});", + "", + "pm.test(\"Validate workflowAction.id inside 'NEW' and 'ARCHIVE'\", function () {", + " var systemActionMappings = pm.response.json().entity[0].systemActionMappings;", + " ", + " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", + " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType3{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"systemActionMappings\" : {\n \"NEW\" : \"b9d89c80-3d88-4311-8365-187323c96436\",\n \"ARCHIVE\": \"4da13a42-5d59-480c-ad8f-94a3adf809fe\"\n },\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Test to validate the content type is created with `systemActionMappings`." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings exist\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", + "});", + "", + "pm.test(\"Validate systemActionMappings contain 'NEW' and 'ARCHIVE'\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.have.property('NEW');", + " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", + "});", + "", + "pm.test(\"Validate workflowAction.id inside 'NEW' and 'ARCHIVE'\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " ", + " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", + " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Validates the content type and `systemActionMappings` were created as expected." + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ { - "name": "Update Content Type with wrong workflow #2", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"doesNotExist\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Validates the proper error handling when a wrong workflow variable name is used." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Cleanup" + }, + "response": [] + } + ], + "description": "Folder to encapsulate multiple tests to validate the proper creation and handling of `systemActionMappings`." + }, + { + "name": "Update", + "item": [ + { + "name": "Create ContentType", + "event": [ { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate systemActionMappings is empty\", function () {", + " var systemActionMappings = pm.response.json().entity[0].systemActionMappings;", + " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType1{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - } - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype" + ] }, + "description": "Simple creation to sep up the data for the update tests." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ { - "name": "Archive Scheme", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200 \", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings is empty\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Validates the content type and `systemActionMappings` were created as expected." + }, + "response": [] + }, + { + "name": "Update without systemActionMappings", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings is empty\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", + "});" ], - "body": { - "mode": "raw", - "raw": "{\"schemeName\": \"{{schemeName}}\", \"schemeArchived\": \"true\"}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "schemes", - "{{schemeId}}" - ] + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Updates a content type without `systemActionMappings`." + }, + "response": [] + }, + { + "name": "Update with empty systemActionMappings", + "event": [ { - "name": "Delete Scheme", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200 \", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings is empty\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\": {},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "schemes", - "{{schemeId}}" - ] - } - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type with emtpy `systemActionMappings`." + }, + "response": [] + }, + { + "name": "Update with systemActionMappings", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings exist\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", + "});", + "", + "pm.test(\"Validate systemActionMappings\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.have.property('NEW');", + " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", + "});", + "", + "pm.test(\"Validate workflowAction.id\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " ", + " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", + " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } } ], - "description": "Covering different update scenarios for saving workflows in a content type.", + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\" : {\n \"NEW\" : \"b9d89c80-3d88-4311-8365-187323c96436\",\n \"ARCHIVE\": \"4da13a42-5d59-480c-ad8f-94a3adf809fe\"\n },\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type with `systemActionMappings`." + }, + "response": [] + }, + { + "name": "Update without systemActionMappings again", "event": [ { - "listen": "prerequest", + "listen": "test", "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings exist\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", + "});", + "", + "pm.test(\"Validate systemActionMappings\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.have.property('NEW');", + " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", + "});", + "", + "pm.test(\"Validate workflowAction.id\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " ", + " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", + " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", + "});" + ], "type": "text/javascript", - "packages": {}, + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type without `systemActionMappings` existing mappings should be unaffected." + }, + "response": [] + }, + { + "name": "Update with empty systemActionMappings again", + "event": [ + { + "listen": "test", + "script": { "exec": [ - "" - ] + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings is empty\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\": {},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "options": { + "raw": { + "language": "json" + } } }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type with empty `systemActionMappings` removing all existing mappings." + }, + "response": [] + }, + { + "name": "Update with systemActionMappings adding mappings again", + "event": [ { "listen": "test", "script": { - "type": "text/javascript", - "packages": {}, "exec": [ - "" - ] + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings exist\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", + "});", + "", + "pm.test(\"Validate systemActionMappings\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.have.property('NEW');", + " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", + "});", + "", + "pm.test(\"Validate workflowAction.id\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " ", + " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", + " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", + "});" + ], + "type": "text/javascript", + "packages": {} } } - ] - } - ], - "description": "The content type allows to pass also a more estructured array of workflows where you can specify the id and variable for each workflow, these tests cases will cover diferent escenarios for this workflows list." - } - ], - "description": "Testing the diferent scenarios for saving workflows in a Content Type", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "ContentTypeForPages", - "item": [ - { - "name": "GetCurrentSite", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200 \", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing workflow data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"currentSiteJost\", jsonData.entity.hostname);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\" : {\n \"NEW\" : \"b9d89c80-3d88-4311-8365-187323c96436\",\n \"ARCHIVE\": \"4da13a42-5d59-480c-ad8f-94a3adf809fe\"\n },\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type with `systemActionMappings` adding mappings again as previous test deleted existing mappings." + }, + "response": [] }, { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/site/currentSite", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "site", - "currentSite" - ] - } - }, - "response": [] - }, - { - "name": "CreatePageWithSystemTemplate", - "request": { - "auth": { - "type": "bearer", - "bearer": [ + "name": "Update with systemActionMappings adding more mappings", + "event": [ { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \n}", - "options": { - "raw": { - "language": "json" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings exist\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", + "});", + "", + "pm.test(\"Validate systemActionMappings\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.have.property('NEW');", + " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", + " pm.expect(systemActionMappings).to.have.property('PUBLISH');", + "});", + "", + "pm.test(\"Validate workflowAction.id\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " ", + " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", + " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", + " pm.expect(systemActionMappings.PUBLISH.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "PUBLISH" - ] - } - }, - "response": [] - }, - { - "name": "CheckContentTypeForPages", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200 \", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing workflow data\", function () {", - " let jsonData = pm.response.json();", - " let length = jsonData.entity.length;", - " let currentPage = jsonData.pagination.currentPage;", - " let perPage = jsonData.pagination.perPage;", - " let totalEntries = jsonData.pagination.totalEntries;", - " ", - " pm.expect(length).to.greaterThan(0)", - " pm.expect(totalEntries).to.greaterThan(0)", - " pm.expect(perPage).to.eql(10)", - " pm.expect(currentPage).to.eql(1)", - "", - "});", - "", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/page?pagePathOrId={{currentPageId}}", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "page" - ], - "query": [ + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\" : {\n \"NEW\" : \"b9d89c80-3d88-4311-8365-187323c96436\",\n \"ARCHIVE\": \"4da13a42-5d59-480c-ad8f-94a3adf809fe\",\n \"PUBLISH\": \"b9d89c80-3d88-4311-8365-187323c96436\"\n },\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type with `systemActionMappings` adding extra mappings to the existing ones." + }, + "response": [] + }, + { + "name": "Update by removing systemActionMappings", + "event": [ { - "key": "pagePathOrId", - "value": "{{currentPageId}}" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings exist\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", + "});", + "", + "pm.test(\"Validate systemActionMappings\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.not.have.property('NEW');", + " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", + " pm.expect(systemActionMappings).to.have.property('PUBLISH');", + "});", + "", + "pm.test(\"Validate workflowAction.id\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " ", + " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", + " pm.expect(systemActionMappings.PUBLISH.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - ] - } - }, - "response": [] - }, - { - "name": "CheckContentTypeForPagesByUrl", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200 \", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing workflow data\", function () {", - " let jsonData = pm.response.json();", - " let length = jsonData.entity.length;", - " let currentPage = jsonData.pagination.currentPage;", - " let perPage = jsonData.pagination.perPage;", - " let totalEntries = jsonData.pagination.totalEntries;", - " ", - " pm.expect(length).to.greaterThan(0)", - " pm.expect(totalEntries).to.greaterThan(0)", - " pm.expect(perPage).to.eql(10)", - " pm.expect(currentPage).to.eql(1)", - "", - "});", - "", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/page?pagePathOrId={{currentPageUrl}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "page" ], - "query": [ + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\" : {\n \"ARCHIVE\": \"4da13a42-5d59-480c-ad8f-94a3adf809fe\",\n \"PUBLISH\": \"b9d89c80-3d88-4311-8365-187323c96436\"\n },\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type by removing one `systemActionMappings`." + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ { - "key": "pagePathOrId", - "value": "{{currentPageUrl}}" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - ] + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Cleanup" + }, + "response": [] } - }, - "response": [] + ], + "description": "Folder to encapsulate multiple tests to validate the proper update and handling of `systemActionMappings`." + } + ], + "description": "Group of tests to cover the most common operations on the content type `systemActionMappings`.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } }, { - "name": "CheckContentTypeForPagesBadRequest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 400 \", function () {", - " pm.response.to.have.status(400);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/page?pagePathOrId=NONEXIST", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "page" - ], - "query": [ - { - "key": "pagePathOrId", - "value": "NONEXIST" - } - ] - } - }, - "response": [] + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } } ] } @@ -11492,175 +14347,5 @@ ] } } - ], - "variable": [ - { - "key": "testDetailPagePageId1", - "value": "" - }, - { - "key": "testDetailPagePageURL1", - "value": "" - }, - { - "key": "testDetailPagePageId2", - "value": "" - }, - { - "key": "testDetailPagePageURL2", - "value": "" - }, - { - "key": "testDetailPagePageInode1", - "value": "" - }, - { - "key": "testDetailPagePageInode2", - "value": "" - }, - { - "key": "contentTypeID", - "value": "" - }, - { - "key": "contentTypeVAR", - "value": "" - }, - { - "key": "contentTypeFieldID", - "value": "" - }, - { - "key": "pageDetailSiteId", - "value": "" - }, - { - "key": "pageDetailSiteName", - "value": "" - }, - { - "key": "contentTypeId", - "value": "" - }, - { - "key": "pageDetailPageId1", - "value": "" - }, - { - "key": "pageDetailPageInode1", - "value": "" - }, - { - "key": "pageDetailPageURL1", - "value": "" - }, - { - "key": "pageDetailPageId2", - "value": "" - }, - { - "key": "pageDetailPageInode2", - "value": "" - }, - { - "key": "pageDetailPageURL2", - "value": "" - }, - { - "key": "contentTypeVariable", - "value": "" - }, - { - "key": "contentTypeField1Id", - "value": "" - }, - { - "key": "contentTypeField1Variable", - "value": "" - }, - { - "key": "skipPreResquest", - "value": "" - }, - { - "key": "currentSiteJost", - "value": "" - }, - { - "key": "currentPageId", - "value": "" - }, - { - "key": "url", - "value": "" - }, - { - "key": "currentPageUrl", - "value": "" - }, - { - "key": "contentTypeIdWithStoryBlock", - "value": "" - }, - { - "key": "contentType.host", - "value": "" - }, - { - "key": "contentType.field1", - "value": "" - }, - { - "key": "contentType.field2", - "value": "" - }, - { - "key": "contentType.field3", - "value": "" - }, - { - "key": "contentType.field4", - "value": "" - }, - { - "key": "contentType.field4.varName", - "value": "" - }, - { - "key": "contentType.divider", - "value": "" - }, - { - "key": "contentType.columnDivider", - "value": "" - }, - { - "key": "contentType.field4.fieldVarOne.id", - "value": "" - }, - { - "key": "contentType.field4.fieldVarOne.key", - "value": "" - }, - { - "key": "fieldTypesArr", - "value": "" - }, - { - "key": "schemeId", - "value": "" - }, - { - "key": "schemeName", - "value": "" - }, - { - "key": "schemeVariableName", - "value": "" - }, - { - "key": "fields", - "value": "" - } ] } \ No newline at end of file From 201418de4af1ddd0f7c5b113b14a2c8c2a1613d7 Mon Sep 17 00:00:00 2001 From: jdotcms Date: Mon, 14 Jul 2025 15:09:47 -0600 Subject: [PATCH 13/24] #32238 adding postman fixes --- .../pagination/ContentTypesPaginator.java | 2 +- .../postman/ContentTypeResourceTests.json | 19495 +++++++--------- 2 files changed, 8357 insertions(+), 11140 deletions(-) diff --git a/dotCMS/src/main/java/com/dotcms/util/pagination/ContentTypesPaginator.java b/dotCMS/src/main/java/com/dotcms/util/pagination/ContentTypesPaginator.java index daf842da52af..2f85759191dd 100644 --- a/dotCMS/src/main/java/com/dotcms/util/pagination/ContentTypesPaginator.java +++ b/dotCMS/src/main/java/com/dotcms/util/pagination/ContentTypesPaginator.java @@ -175,7 +175,7 @@ private void setEntriesAttribute(final User user, final List if (systemActionMappings.containsKey(variable)) { - contentTypeEntry.put(SYSTEM_ACTION_MAPPINGS, workflowSchemes.get(variable)); + contentTypeEntry.put(SYSTEM_ACTION_MAPPINGS, systemActionMappings.get(variable)); } } } diff --git a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json index c493aa5937da..7f27dce0d2da 100644 --- a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json +++ b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json @@ -1,9 +1,9 @@ { "info": { - "_postman_id": "173bf579-93b9-497b-baee-8f9c48e58b71", + "_postman_id": "4eaa447a-cad4-46a5-ba2d-0cd107dfbc79", "name": "ContentType Resource", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "36604690" + "_exporter_id": "781456" }, "item": [ { @@ -20,7 +20,7 @@ "", "pm.collectionVariables.set(\"contentTypeID\", jsonData.entity[0].id);", "pm.collectionVariables.set(\"contentTypeVAR\", jsonData.entity[0].variable);", - "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[2].id);", + "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[0].id);", "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", @@ -41,26 +41,12 @@ ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" } ] }, @@ -109,34 +95,23 @@ "", "pm.test(\"sortOrder check\", function () {", " pm.expect(jsonData.entity.sortOrder).to.eql(3);", - "});" + "});", + "", + "pm.collectionVariables.set(\"fields\", JSON.stringify(jsonData.entity.fields));" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" } ] }, @@ -180,32 +155,19 @@ " pm.expect(jsonData.entity.sortOrder).to.eql(2);", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" } ] }, @@ -213,7 +175,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"My Custom Structure {{$randomBankAccount}}\",\n\t\"variable\": \"{{contentTypeVAR}}\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeID}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": true,\n \"iDate\": 1631719532000,\n \"id\": \"{{contentTypeFieldID}}\",\n \"indexed\": true,\n \"listed\": true,\n \"modDate\": 1631719532000,\n \"name\": \"Name\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name\"\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"My Custom Structure {{$randomBankAccount}}\",\n\t\"variable\": \"{{contentTypeVAR}}\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n\t\"fields\": {{fields}},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", "options": { "raw": { "language": "json" @@ -258,32 +220,19 @@ " pm.expect(jsonData.entity.sortOrder).to.eql(2);", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" } ] }, @@ -291,7 +240,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure test\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"My Custom Structure {{$randomBankAccount}}\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeID}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": true,\n \"iDate\": 1631719532000,\n \"id\": \"{{contentTypeFieldID}}\",\n \"indexed\": true,\n \"listed\": true,\n \"modDate\": 1631719532000,\n \"name\": \"Name\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name\"\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure test\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"My Custom Structure {{$randomBankAccount}}\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n\t\"fields\": {{fields}},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", "options": { "raw": { "language": "json" @@ -326,32 +275,19 @@ " pm.response.to.have.status(200);", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" } ] }, @@ -380,3166 +316,120 @@ "name": "Test CRUD Fields", "item": [ { - "name": "Filtering Fields", - "item": [ + "name": "Create ContentType", + "event": [ { - "name": "Generate Test Data", - "item": [ - { - "name": "Create Test Content Type", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.collectionVariables.set(\"typeNameWithMetadata\", \"test-type-\" + \"{{$randomInt}}\");" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Test Content Type was created successfully\", function () {", - " const jsonData = pm.response.json();", - " const entity = jsonData.entity[0];", - " pm.expect(jsonData.errors.length).to.eql(0);", - " pm.collectionVariables.set(\"contentTypeId\", entity.id);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"defaultType\": false,\n \"icon\": null,\n \"fixed\": false,\n \"system\": false,\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\": \"\",\n \"host\": \"48190c8c-42c4-46af-8d1a-0cd5db894797\",\n \"name\": \"My Test CT\",\n \"metadata\": {\n \"edit_mode\": true\n },\n \"systemActionMappings\": {\n \"NEW\": \"\"\n },\n \"workflow\": [\n \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - } - }, - "response": [] - }, - { - "name": "Add Fields to Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Test Content Type Fields were created successfully\", function () {", - " const jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"layout\": [\n {\n \"divider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"iDate\": 1705078587000,\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1705078587000,\n \"name\": \"Row Field\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": -1,\n \"unique\": false\n },\n \"columns\": [\n {\n \"columnDivider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"iDate\": 1705078587000,\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1705078587000,\n \"name\": \"Column Field\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": -1,\n \"unique\": false\n },\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"name\": \"Title\",\n \"dataType\": \"TEXT\",\n \"regexCheck\": \"\",\n \"defaultValue\": \"\",\n \"hint\": \"\",\n \"required\": true,\n \"searchable\": true,\n \"listed\": true,\n \"unique\": false,\n \"id\": null\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"name\": \"Description\",\n \"dataType\": \"TEXT\",\n \"regexCheck\": \"\",\n \"defaultValue\": \"\",\n \"hint\": \"\",\n \"required\": false,\n \"searchable\": true,\n \"listed\": false,\n \"unique\": false,\n \"id\": null\n }\n ]\n }\n ]\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/move", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v3", - "contenttype", - "{{contentTypeId}}", - "fields", - "move" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - }, + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.collectionVariables.set(\"contentTypeID\", jsonData.entity[0].id);", + "pm.collectionVariables.set(\"contentTypeVAR\", jsonData.entity[0].variable);", + "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[0].id);", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"fields check\", function () {", + " ", + " pm.expect(jsonData.entity[0].fields.length).to.be.above(2);", + "});", + "", + "pm.test(\"description check\", function () {", + " pm.expect(jsonData.entity[0].description).to.eql('THE DESCRIPTION');", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "pm.test(\"HTTP Status code must be successful\", function () {", - " pm.response.to.have.status(200);", - "});", - "" - ] - } + "key": "token", + "value": "{{jwt}}", + "type": "string" } ] }, - { - "name": "Success", - "item": [ - { - "name": "Filter By Required Fields", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Data was returned successfully\", function () {", - " const jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});", - "", - "pm.test(\"There must be only one 'Required' field\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.equal(1, \"Just one field must be marked as 'Required'\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=REQUIRED", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v3", - "contenttype", - "{{contentTypeId}}", - "fields", - "allfields" - ], - "query": [ - { - "key": "filter", - "value": "REQUIRED" - } - ] - } - }, - "response": [] - }, - { - "name": "Filter By Indexed Fields", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Data was returned successfully\", function () {", - " const jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});", - "", - "pm.test(\"There must be two 'System Indexed' fields\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.equal(2, \"Two fields must be marked as 'System Indexed'\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=SYSTEM_INDEXED", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v3", - "contenttype", - "{{contentTypeId}}", - "fields", - "allfields" - ], - "query": [ - { - "key": "filter", - "value": "SYSTEM_INDEXED" - } - ] - } - }, - "response": [] - }, - { - "name": "Filter By Several Criteria", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Data was returned successfully\", function () {", - " const jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});", - "", - "pm.test(\"There must be only one 'Required', 'User Searchable', and 'Show in List' field\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.equal(1, \"Just one field must be marked as 'Required', 'User Searchable', and 'Show in List' field\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=REQUIRED&filter=USER_SEARCHABLE&filter=SHOW_IN_LIST", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v3", - "contenttype", - "{{contentTypeId}}", - "fields", - "allfields" - ], - "query": [ - { - "key": "filter", - "value": "REQUIRED" - }, - { - "key": "filter", - "value": "USER_SEARCHABLE" - }, - { - "key": "filter", - "value": "SHOW_IN_LIST" - } - ] - } - }, - "response": [] - }, - { - "name": "Filter By Non-met Criteria", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Data was returned successfully\", function () {", - " const jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});", - "", - "pm.test(\"No field must match 'Required', 'User Searchable', 'Show in List' and 'Unique'\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.equal(0, \"No field must match the four specified filters\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=REQUIRED&filter=USER_SEARCHABLE&filter=SHOW_IN_LIST&filter=UNIQUE", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v3", - "contenttype", - "{{contentTypeId}}", - "fields", - "allfields" - ], - "query": [ - { - "key": "filter", - "value": "REQUIRED" - }, - { - "key": "filter", - "value": "USER_SEARCHABLE" - }, - { - "key": "filter", - "value": "SHOW_IN_LIST" - }, - { - "key": "filter", - "value": "UNIQUE" - } - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "pm.test(\"HTTP Status code must be successful\", function () {", - " pm.response.to.have.status(200);", - "});", - "" - ] - } - } - ] - }, - { - "name": "Failure", - "item": [ - { - "name": "Log User out", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/dotAdmin/logout", - "host": [ - "{{serverURL}}" - ], - "path": [ - "dotAdmin", - "logout" - ] - }, - "description": "This request just makes sure that the next request does NOT have an authenticated User." - }, - "response": [] - }, - { - "name": "No Authentication", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 'Unauthorized'\", function () {", - " pm.response.to.have.status(401);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=REQUIRED", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v3", - "contenttype", - "{{contentTypeId}}", - "fields", - "allfields" - ], - "query": [ - { - "key": "filter", - "value": "REQUIRED" - } - ] - } - }, - "response": [] - }, - { - "name": "Using Invalid Filter", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 'Bad Request'\", function () {", - " pm.response.to.have.status(400);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=INVALID_FILTER", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v3", - "contenttype", - "{{contentTypeId}}", - "fields", - "allfields" - ], - "query": [ - { - "key": "filter", - "value": "INVALID_FILTER" - } - ] - } - }, - "response": [] - }, - { - "name": "Using Invalid Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 'Not Found'\", function () {", - " pm.response.to.have.status(404);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v3/contenttype/INVALID_CONTENT_TYPE/fields/allfields?filter=REQUIRED", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v3", - "contenttype", - "INVALID_CONTENT_TYPE", - "fields", - "allfields" - ], - "query": [ - { - "key": "filter", - "value": "REQUIRED" - } - ] - } - }, - "response": [] - } - ] - } - ] - }, - { - "name": "Create ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.collectionVariables.set(\"contentTypeID\", jsonData.entity[0].id);", - "pm.collectionVariables.set(\"contentTypeVAR\", jsonData.entity[0].variable);", - "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[2].id);", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"fields check\", function () {", - " pm.expect(jsonData.entity[0].fields.length).to.eql(4);", - "});", - "", - "pm.test(\"description check\", function () {", - " pm.expect(jsonData.entity[0].description).to.eql('THE DESCRIPTION');", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\", \n \"defaultType\": false, \n \"name\": \"Test Content Type\", \n \"description\": \"THE DESCRIPTION\", \n \"host\": \"SYSTEM_HOST\", \n \"owner\": \"dotcms.org.1\", \n \"fixed\": false, \n \"system\": false, \n \"folder\": \"SYSTEM_FOLDER\",\n \"fields\": [\n {\n \"dataType\": \"SYSTEM\",\n \"dbColumn\": \"system_field1\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Host/Folder\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n },\n {\n \"dataType\": \"LONG_TEXT\",\n \"dbColumn\": \"text_area2\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1453474468000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTagField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Tags\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"tags\"\n }],\n \"workflow\": [\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}\n" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "", - "pm.test(\"fields check\", function () {", - " pm.expect(jsonData.entity.fields.length).to.eql(4);", - "});", - "", - "pm.test(\"description check\", function () {", - " pm.expect(jsonData.entity.description).to.eql('THE DESCRIPTION');", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeID}}" - ] - }, - "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." - }, - "response": [] - }, - { - "name": "Update Content Type without sending variable success", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"fields check\", function () {", - " pm.expect(jsonData.entity.fields.length).to.eql(3);", - "});", - "", - "pm.test(\"description check\", function () {", - " pm.expect(jsonData.entity.description).to.eql('THE DESCRIPTION');", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"THE DESCRIPTION\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"contentTypeId\": \"{{contentTypeID}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Host-Folder\",\n \"fieldTypeLabel\": \"Site or Folder\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"id\": \"{{contentTypeFieldID}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1632506750000,\n \"name\": \"Host/Folder CHANGED\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n }\n ],\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"Test Content Type\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeID}}" - ] - }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." - }, - "response": [] - }, - { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeID}}" - ] - }, - "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." - }, - "response": [] - }, - { - "name": "Create ContentType Unsupported Media Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Validate the response status is 415", - "pm.test(\"Response status is 415\", function () {", - " pm.response.to.have.status(415);", - "});", - "", - "// Validate that the response body contains the 'message' property and it is not empty", - "pm.test(\"Response should have an error message\", function () {", - " const responseBody = pm.response.json();", - " pm.expect(responseBody).to.have.property('message').that.is.not.empty;", - " pm.expect(responseBody.message).to.equal('HTTP 415 Unsupported Media Type');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/javascript" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\", \n \"defaultType\": false, \n \"name\": \"Test Content Type\", \n \"description\": \"THE DESCRIPTION\", \n \"host\": \"SYSTEM_HOST\", \n \"owner\": \"dotcms.org.1\", \n \"fixed\": false, \n \"system\": false, \n \"folder\": \"SYSTEM_FOLDER\",\n \"fields\": [\n {\n \"dataType\": \"SYSTEM\",\n \"dbColumn\": \"system_field1\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Host/Folder\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n },\n {\n \"dataType\": \"LONG_TEXT\",\n \"dbColumn\": \"text_area2\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1453474468000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTagField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Tags\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"tags\"\n }],\n \"workflow\": [\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}\n" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." - }, - "response": [] - }, - { - "name": "Filter ContentType Unsupported Media Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Validate the response status is 415", - "pm.test(\"Response status is 415\", function () {", - " pm.response.to.have.status(415);", - "});", - "", - "// Validate that the response body contains the 'message' property and it is not empty", - "pm.test(\"Response should have an error message\", function () {", - " const responseBody = pm.response.json();", - " pm.expect(responseBody).to.have.property('message').that.is.not.empty;", - " pm.expect(responseBody.message).to.equal('HTTP 415 Unsupported Media Type');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/javascript" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\", \n \"defaultType\": false, \n \"name\": \"Test Content Type\", \n \"description\": \"THE DESCRIPTION\", \n \"host\": \"SYSTEM_HOST\", \n \"owner\": \"dotcms.org.1\", \n \"fixed\": false, \n \"system\": false, \n \"folder\": \"SYSTEM_FOLDER\",\n \"fields\": [\n {\n \"dataType\": \"SYSTEM\",\n \"dbColumn\": \"system_field1\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Host/Folder\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n },\n {\n \"dataType\": \"LONG_TEXT\",\n \"dbColumn\": \"text_area2\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1453474468000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTagField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Tags\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"tags\"\n }],\n \"workflow\": [\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}\n" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/_filter", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "_filter" - ] - }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." - }, - "response": [] - }, - { - "name": "Update Content Type Unsupported Media Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Validate the response status is 415", - "pm.test(\"Response status is 415\", function () {", - " pm.response.to.have.status(415);", - "});", - "", - "// Validate that the response body contains the 'message' property and it is not empty", - "pm.test(\"Response should have an error message\", function () {", - " const responseBody = pm.response.json();", - " pm.expect(responseBody).to.have.property('message').that.is.not.empty;", - " pm.expect(responseBody.message).to.equal('HTTP 415 Unsupported Media Type');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "protocolProfileBehavior": { - "disabledSystemHeaders": { - "content-type": true - } - }, - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/javascript", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"THE DESCRIPTION\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"contentTypeId\": \"{{contentTypeID}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Host-Folder\",\n \"fieldTypeLabel\": \"Site or Folder\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"id\": \"{{contentTypeFieldID}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1632506750000,\n \"name\": \"Host/Folder CHANGED\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n }\n ],\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"Test Content Type\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeID}}" - ] - }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Tests For New StoryBlockField", - "item": [ - { - "name": "Create ContentType with StoryBlockField Success", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "var contentType = jsonData.entity[0];", - "pm.collectionVariables.set(\"contentTypeIdWithStoryBlock\", contentType.id);", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200);", - "});", - "pm.test(\"Content Type should have 4 fields\", function() {", - " pm.expect(contentType.fields.length).to.eql(4);", - "});", - "pm.test(\"Content Type has a Story_block_field\", function() {", - " pm.expect(contentType.fields[3].fieldType).to.eql(\"Story-Block\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"system\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"\",\n \"host\": \"SYSTEM_HOST\",\n \"folder\":\"SYSTEM_FOLDER\",\n \"name\":\"TestContentTypeWithStoryBlockField\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t},\n {\n \"clazz\":\"com.dotcms.contenttype.model.field.ImmutableStoryBlockField\",\n \"required\":false,\n \"name\":\"block\",\n \"defaultValue\":\"\",\n \"hint\":\"\",\n \"searchable\":true\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a contentType with 2 fields:\n- A text field named Title\n- A story block field named block" - }, - "response": [] - }, - { - "name": "Create contentlet with StoryBlockField", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200);", - "});", - "pm.test(\"Contentlet StoryBlock has value\", function() {", - " pm.expect(jsonData.entity.block.content[0].content[0].text).contains(\"Wow, this editor instance exports its content as JSON\");", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"contentlet\": {\n \"contentType\": \"{{contentTypeIdWithStoryBlock}}\",\n \"name\": \"test with data block field\",\n \"title\": \"test with data block field\",\n \"block\": \"{\\\"type\\\": \\\"doc\\\",\\\"content\\\": [{\\\"type\\\": \\\"paragraph\\\",\\\"content\\\": [{\\\"type\\\": \\\"text\\\",\\\"text\\\": \\\"Wow, this editor instance exports its content as JSON.\\\"}]}]}\"\n }\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "PUBLISH" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Test Get ContentTypes", - "item": [ - { - "name": "Get ContentTypes sending HostID", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?host=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ], - "query": [ - { - "key": "host", - "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d" - } - ] - } - }, - "response": [] - }, - { - "name": "Get ContentTypes sending SYSTEM_HOST", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Amount of ContentTypes could be greather or eql than 10\", function () {", - " pm.expect(jsonData.entity.length).to.be.gte(10);", - "});", - "", - "pm.test(\"Status code should be 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?host=SYSTEM_HOST", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ], - "query": [ - { - "key": "host", - "value": "SYSTEM_HOST" - } - ] - } - }, - "response": [] - }, - { - "name": "Get ContentTypes without any param", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Amount of ContentTypes could be greather or eql than 10\", function () {", - " pm.expect(jsonData.entity.length).to.be.gte(10);", - "});", - "", - "pm.test(\"Status code should be 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - } - }, - "response": [] - }, - { - "name": "Get ContentTypes sending not existing hostID", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?host=aaaaa-aaaa-aaaa-aaaaaa", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ], - "query": [ - { - "key": "host", - "value": "aaaaa-aaaa-aaaa-aaaaaa" - } - ] - } - }, - "response": [] - }, - { - "name": "Get existing Base Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there are at least 1 Content Type of Base Type 'dotAsset'\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.gte(1, \"There MUST be at least one Content Type of Base Type 'dotAsset'\");", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "password", - "value": "admin", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?type=DOTASSET&orderby=name", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ], - "query": [ - { - "key": "type", - "value": "DOTASSET" - }, - { - "key": "orderby", - "value": "name" - } - ] - }, - "description": "Returns all Content Types whose Base Type is 'dotAsset'. **There must be AT LEAST one Content Type of such a Base Type.**" - }, - "response": [] - }, - { - "name": "Get non-existing Base Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 400\", function () {", - " pm.response.to.have.status(400);", - "});", - "", - "pm.test(\"Checking that the error message is present\", function () {", - " const message = pm.response.json().message;", - " pm.expect(message).to.contain(\"FORM2\", \"The returned error message may not be\")", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "password", - "value": "admin", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?filter=filter&page=3&per_page=4&type=FORM2&orderby=name", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ], - "query": [ - { - "key": "filter", - "value": "filter" - }, - { - "key": "page", - "value": "3" - }, - { - "key": "per_page", - "value": "4" - }, - { - "key": "type", - "value": "FORM2" - }, - { - "key": "orderby", - "value": "name" - } - ] - }, - "description": "Requesting an invalid Base Content Type will return an error message and an HTTP Status 400." - }, - "response": [] - } - ] - }, - { - "name": "Test ContentType With Field Variables", - "item": [ - { - "name": "Create Test Data", - "item": [ - { - "name": "Create ContentType with field variables", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "var contentType = jsonData.entity[0];", - "pm.collectionVariables.set(\"contentTypeId\", contentType.id);", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200);", - "});", - "pm.test(\"Content Type has the provided name\", function() {", - " pm.expect(contentType.name).to.eql(\"WYSIWYG-Content\");", - "});", - "pm.test(\"Content Type should have 4 fields\", function() {", - " pm.expect(contentType.fields.length).to.eql(4);", - "});", - "pm.collectionVariables.set(\"contentType.host\", contentType.host);", - "pm.collectionVariables.set(\"contentType.field1\", contentType.fields[0].id);", - "pm.collectionVariables.set(\"contentType.field2\", contentType.fields[1].id);", - "pm.collectionVariables.set(\"contentType.field3\", contentType.fields[2].id);", - "pm.collectionVariables.set(\"contentType.field4\", contentType.fields[3].id);", - "pm.collectionVariables.set(\"contentType.field4.varName\", contentType.fields[3].variable);", - "pm.collectionVariables.set(\"contentType.divider\", contentType.layout[0].divider.id);", - "pm.collectionVariables.set(\"contentType.columnDivider\", contentType.layout[0].columns[0].columnDivider.id);", - "var wysigygField = contentType.fields[3];", - "var secondVar = wysigygField.fieldVariables[1];", - "pm.test(\"Variable should have its key and value with hello:world\", function() {", - " pm.expect(secondVar.key).to.eql(\"hello\");", - " pm.expect(secondVar.value).to.eql(\"world\");", - "});", - "pm.test(\"WYSIWYG must exist and have 3 variables\", function() {", - " pm.expect(wysigygField.fieldType).to.eql(\"WYSIWYG\");", - " pm.expect(wysigygField.fieldVariables.length).to.eql(3);", - "});", - "var tinyMcePropsVar = wysigygField.fieldVariables[2];", - "pm.test(\"WYSIWYG tinymceoprops variable is present with value\", function() {", - " pm.expect(tinyMcePropsVar.key).to.eql(\"tinymceprops\");", - " pm.expect(tinyMcePropsVar.value).to.eql(\"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "password", - "value": "admin", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\t\"baseType\": \"CONTENT\",\n\t\t\"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n\t\t\"defaultType\": false,\n\t\t\"fields\": [{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\"fieldType\": \"Row\",\n\t\t\t\"fieldTypeLabel\": \"Row\",\n\t\t\t\"fieldVariables\": [],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168604000,\n\t\t\t\"indexed\": false,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168642000,\n\t\t\t\"name\": \"fields-0\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": false,\n\t\t\t\"sortOrder\": 0,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"fields0\"\n\t\t}, {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\"fieldType\": \"Column\",\n\t\t\t\"fieldTypeLabel\": \"Column\",\n\t\t\t\"fieldVariables\": [],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168604000,\n\t\t\t\"indexed\": false,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168642000,\n\t\t\t\"name\": \"fields-1\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": false,\n\t\t\t\"sortOrder\": 1,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"fields1\"\n\t\t}, {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"fieldType\": \"Text\",\n\t\t\t\"fieldTypeLabel\": \"Text\",\n\t\t\t\"fieldVariables\": [],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168746000,\n\t\t\t\"indexed\": true,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168746000,\n\t\t\t\"name\": \"Title\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"title\"\n\t\t}, {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n\t\t\t\"dataType\": \"LONG_TEXT\",\n\t\t\t\"fieldType\": \"WYSIWYG\",\n\t\t\t\"fieldTypeLabel\": \"WYSIWYG\",\n\t\t\t\"fieldVariables\": [{\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\"key\": \"foo\",\n\t\t\t\t\"value\": \"bar\"\n\t\t\t}, {\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\"key\": \"hello\",\n\t\t\t\t\"value\": \"world\"\n\t\t\t}, {\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\"key\": \"tinymceprops\",\n\t\t\t\t\"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n\t\t\t}],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168642000,\n\t\t\t\"indexed\": true,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168746000,\n\t\t\t\"name\": \"component\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": true,\n\t\t\t\"sortOrder\": 3,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"component\"\n\t\t}],\n\t\t\"fixed\": false,\n\t\t\"folder\": \"SYSTEM_FOLDER\",\n\t\t\"host\": \"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n\t\t\"iDate\": 1606168519000,\n\t\t\"layout\": [{\n\t\t\t\"divider\": {\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n\t\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\t\"fieldType\": \"Row\",\n\t\t\t\t\"fieldTypeLabel\": \"Row\",\n\t\t\t\t\"fieldVariables\": [],\n\t\t\t\t\"fixed\": false,\n\t\t\t\t\"iDate\": 1606168604000,\n\t\t\t\t\"indexed\": false,\n\t\t\t\t\"listed\": false,\n\t\t\t\t\"modDate\": 1606168642000,\n\t\t\t\t\"name\": \"fields-0\",\n\t\t\t\t\"readOnly\": false,\n\t\t\t\t\"required\": false,\n\t\t\t\t\"searchable\": false,\n\t\t\t\t\"sortOrder\": 0,\n\t\t\t\t\"unique\": false,\n\t\t\t\t\"variable\": \"fields0\"\n\t\t\t},\n\t\t\t\"columns\": [{\n\t\t\t\t\"columnDivider\": {\n\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n\t\t\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\t\t\"fieldType\": \"Column\",\n\t\t\t\t\t\"fieldTypeLabel\": \"Column\",\n\t\t\t\t\t\"fieldVariables\": [],\n\t\t\t\t\t\"fixed\": false,\n\t\t\t\t\t\"iDate\": 1606168604000,\n\t\t\t\t\t\"indexed\": false,\n\t\t\t\t\t\"listed\": false,\n\t\t\t\t\t\"modDate\": 1606168642000,\n\t\t\t\t\t\"name\": \"fields-1\",\n\t\t\t\t\t\"readOnly\": false,\n\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\"searchable\": false,\n\t\t\t\t\t\"sortOrder\": 1,\n\t\t\t\t\t\"unique\": false,\n\t\t\t\t\t\"variable\": \"fields1\"\n\t\t\t\t},\n\t\t\t\t\"fields\": [{\n\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n\t\t\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\t\t\"fieldType\": \"Text\",\n\t\t\t\t\t\"fieldTypeLabel\": \"Text\",\n\t\t\t\t\t\"fieldVariables\": [],\n\t\t\t\t\t\"fixed\": false,\n\t\t\t\t\t\"iDate\": 1606168746000,\n\t\t\t\t\t\"indexed\": true,\n\t\t\t\t\t\"listed\": false,\n\t\t\t\t\t\"modDate\": 1606168746000,\n\t\t\t\t\t\"name\": \"Title\",\n\t\t\t\t\t\"readOnly\": false,\n\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\"searchable\": true,\n\t\t\t\t\t\"sortOrder\": 2,\n\t\t\t\t\t\"unique\": false,\n\t\t\t\t\t\"variable\": \"title\"\n\t\t\t\t}, {\n\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n\t\t\t\t\t\"dataType\": \"LONG_TEXT\",\n\t\t\t\t\t\"fieldType\": \"WYSIWYG\",\n\t\t\t\t\t\"fieldTypeLabel\": \"WYSIWYG\",\n\t\t\t\t\t\"fieldVariables\": [{\n\t\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\t\t\"key\": \"foo\",\n\t\t\t\t\t\t\"value\": \"bar\"\n\t\t\t\t\t}, {\n\t\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\t\t\"key\": \"hello\",\n\t\t\t\t\t\t\"value\": \"world\"\n\t\t\t\t\t}, {\n\t\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\t\t\"key\": \"tinymceprops\",\n\t\t\t\t\t\t\"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n\t\t\t\t\t}],\n\t\t\t\t\t\"fixed\": false,\n\t\t\t\t\t\"iDate\": 1606168642000,\n\t\t\t\t\t\"indexed\": true,\n\t\t\t\t\t\"listed\": false,\n\t\t\t\t\t\"modDate\": 1606168746000,\n\t\t\t\t\t\"name\": \"component\",\n\t\t\t\t\t\"readOnly\": false,\n\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\"searchable\": true,\n\t\t\t\t\t\"sortOrder\": 3,\n\t\t\t\t\t\"unique\": false,\n\t\t\t\t\t\"variable\": \"component\"\n\t\t\t\t}]\n\t\t\t}]\n\t\t}],\n\t\t\"modDate\": 1606177211000,\n\t\t\"multilingualable\": false,\n\t\t\"name\": \"WYSIWYG-Content\",\n\t\t\"system\": false,\n\t\t\"systemActionMappings\": {},\n\t\t\"variable\": \"WysiwygContent\",\n\t\t\"versionable\": true,\n\t\t\"workflows\": []\n\t}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that WYSIWYG field is created with provided field variables." - }, - "response": [] - }, - { - "name": "Update ContentType with field variables", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "var contentType = jsonData.entity", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200);", - "});", - "pm.test(\"Content Type has the provided name\", function() {", - " pm.expect(contentType.name).to.eql(\"WYSIWYG-Content-Renamed\");", - "});", - "pm.test(\"Content Type should have 4 fields\", function() {", - " pm.expect(contentType.fields.length).to.eql(4);", - "});", - "var wysigygField = contentType.fields[3];", - "pm.test(\"WYSIWYG must exist and have 2 variables\", function() {", - " pm.expect(wysigygField.fieldType).to.eql(\"WYSIWYG\");", - " pm.expect(wysigygField.fieldVariables.length).to.eql(2);", - "});", - "var firstVar = wysigygField.fieldVariables[0];", - "pm.test(\"Variable should have its key and value modified to hola:mundo\", function() {", - " pm.expect(firstVar.key).to.eql(\"hola\");", - " pm.expect(firstVar.value).to.eql(\"mundo\");", - "});", - "var tinyMcePropsVar = wysigygField.fieldVariables[1];", - "pm.test(\"WYSIWYG tinymceoprops variable is present with value\", function() {", - " pm.expect(tinyMcePropsVar.key).to.eql(\"tinymceprops\");", - " pm.expect(tinyMcePropsVar.value).to.eql(\"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\");", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"baseType\": \"CONTENT\",\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"defaultType\": false,\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field2}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field3}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"title\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"id\": \"6bf0f909-7f33-43a3-9b9c-fd7551fa73d7\",\n \"key\": \"hola\",\n \"value\": \"mundo\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ],\n \"fixed\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"host\": \"{{contentType.host}}\",\n \"iDate\": 1606168519000,\n \"id\": \"{{contentTypeId}}\",\n \"layout\": [\n {\n \"divider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.divider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n \"columns\": [\n {\n \"columnDivider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.columnDivider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"title\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6bf0f909-7f33-43a3-9b9c-fd7551fa73d7\",\n \"key\": \"hola\",\n \"value\": \"mundo\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ]\n }\n ]\n }\n ],\n \"modDate\": 1607013655000,\n \"multilingualable\": false,\n \"name\": \"WYSIWYG-Content-Renamed\",\n \"system\": false,\n \"systemActionMappings\": {},\n \"variable\": \"WysiwygContent\",\n \"versionable\": true,\n \"workflows\": [\n {\n \"archived\": false,\n \"creationDate\": 1607013267018,\n \"defaultScheme\": false,\n \"description\": \"\",\n \"entryActionId\": null,\n \"id\": \"{{contentType.workflow}}\",\n \"mandatory\": false,\n \"modDate\": 1607013261505,\n \"name\": \"System Workflow\",\n \"system\": true\n }\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Given a content type payload containing field variables.\nWhen sending a PUT.\nExpect that code is 200.\nExpect content type is updated with the provided fields.\nExpect that WYSIWYG field is updated with provided field variables." - }, - "response": [] - }, - { - "name": "Update ContentType with field variables - delete - update - add", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "var contentType = jsonData.entity", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200);", - "});", - "pm.test(\"Content Type has the provided name\", function() {", - " pm.expect(contentType.name).to.eql(\"WYSIWYG-Content-Renamed2\");", - "});", - "pm.test(\"Content Type should have 4 fields\", function() {", - " pm.expect(contentType.fields.length).to.eql(4);", - "});", - "var wysigygField = contentType.fields[3];", - "pm.test(\"WYSIWYG must exist and have 2 variables\", function() {", - " pm.expect(wysigygField.fieldType).to.eql(\"WYSIWYG\");", - " pm.expect(wysigygField.fieldVariables.length).to.eql(2);", - "});", - "var firstVar = wysigygField.fieldVariables[0];", - "pm.test(\"Variable should have its key and value modified to hola:mundo\", function() {", - " pm.expect(firstVar.key).to.eql(\"hi\");", - " pm.expect(firstVar.value).to.eql(\"all\");", - " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", firstVar.id);", - " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.key\", firstVar.key);", - "});", - "var tinyMcePropsVar = wysigygField.fieldVariables[1];", - "pm.test(\"WYSIWYG tinymceoprops variable is present with value\", function() {", - " pm.expect(tinyMcePropsVar.key).to.eql(\"tinymceprops\");", - " pm.expect(tinyMcePropsVar.value).to.eql(\"{toolbar:\\\"true\\\",menu:\\\"true\\\", theme:\\\"advanced\\\"}\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"baseType\": \"CONTENT\",\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"defaultType\": false,\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field2}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field3}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"titleNew\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"key\": \"hi\",\n \"value\": \"all\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"true\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ],\n \"fixed\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"host\": \"{{contentType.host}}\",\n \"iDate\": 1606168519000,\n \"id\": \"{{contentTypeId}}\",\n \"layout\": [\n {\n \"divider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.divider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n \"columns\": [\n {\n \"columnDivider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.columnDivider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"title\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6bf0f909-7f33-43a3-9b9c-fd7551fa73d7\",\n \"key\": \"hola\",\n \"value\": \"mundo\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ]\n }\n ]\n }\n ],\n \"modDate\": 1607013655000,\n \"multilingualable\": false,\n \"name\": \"WYSIWYG-Content-Renamed2\",\n \"system\": false,\n \"systemActionMappings\": {},\n \"variable\": \"WysiwygContent\",\n \"versionable\": true,\n \"workflows\": [\n {\n \"archived\": false,\n \"creationDate\": 1607013267018,\n \"defaultScheme\": false,\n \"description\": \"\",\n \"entryActionId\": null,\n \"id\": \"{{contentType.workflow}}\",\n \"mandatory\": false,\n \"modDate\": 1607013261505,\n \"name\": \"System Workflow\",\n \"system\": true\n }\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Given a content type payload containing field variables.\nWhen sending a PUT.\nExpect that code is 200.\nExpect content type is updated with the provided fields.\nExpect that WYSIWYG field is updated with provided field variables." - }, - "response": [] - } - ] - }, - { - "name": "Field Variables - With User", - "item": [ - { - "name": "Create Field Variable using Field ID", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", jsonData.entity.id);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable created with ID\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "id", - "{{contentType.field4}}", - "variables" - ] - }, - "description": "Attempts to create a new Field Variable without User authentication." - }, - "response": [] - }, - { - "name": "Create Field Variable using Var Name", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", jsonData.entity.id);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable created with Var Name\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "var", - "{{contentType.field4.varName}}", - "variables" - ] - }, - "description": "Attempts to create a new Field Variable without User authentication." - }, - "response": [] - }, - { - "name": "Get All Field Variables using Field ID", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - "});", - "", - "pm.test(\"There must be only two Field Variables\", function () {", - " pm.expect(pm.response.json().entity.length).to.equal(2, 'There must be only 2 Field Variables at this point');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "id", - "{{contentType.field4}}", - "variables" - ] - }, - "description": "Attempts to create a new Field Variable without User authentication." - }, - "response": [] - }, - { - "name": "Get All Field Variables using Field Var Name", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - "});", - "", - "pm.test(\"There must be only two Field Variables\", function () {", - " pm.expect(pm.response.json().entity.length).to.equal(2, 'There must be only 2 Field Variables at this point');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "var", - "{{contentType.field4.varName}}", - "variables" - ] - }, - "description": "Attempts to create a new Field Variable without User authentication." - }, - "response": [] - }, - { - "name": "Get Field Variable using Field ID", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "id", - "{{contentType.field4}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" - ] - }, - "description": "Attempts to create a new Field Variable without User authentication." - }, - "response": [] - }, - { - "name": "Get Field Variable using Var Name", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "var", - "{{contentType.field4.varName}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" - ] - }, - "description": "Attempts to create a new Field Variable without User authentication." - }, - "response": [] - }, - { - "name": "Update Field Variable using Field ID", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable updated with ID\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "id", - "{{contentType.field4}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" - ] - }, - "description": "Attempts to update a Field Variable without User authentication." - }, - "response": [] - }, - { - "name": "Update Field Variable using Var Name", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable updated with Var Name\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "var", - "{{contentType.field4.varName}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" - ] - }, - "description": "Attempts to update a Field Variable without User authentication." - }, - "response": [] - }, - { - "name": "Delete Field Variable using Field ID", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "id", - "{{contentType.field4}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" - ] - }, - "description": "Attempts to delete a Field Variable without User authentication." - }, - "response": [] - }, - { - "name": "Re-Create Test Field Variable", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", jsonData.entity.id);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable created with ID\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "id", - "{{contentType.field4}}", - "variables" - ] - }, - "description": "Attempts to create a new Field Variable without User authentication." - }, - "response": [] - }, - { - "name": "Delete Field Variable using Var Name", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "var", - "{{contentType.field4.varName}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" - ] - }, - "description": "Attempts to delete a Field Variable without User authentication." - }, - "response": [] - } - ], - "description": "Verifies that CRUD operations on Field Variables are working as expected." - }, - { - "name": "Field Variables - No User", - "item": [ - { - "name": "invalidate User Session", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/logout", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "logout" - ] - } - }, - "response": [] - }, - { - "name": "Create Field Variable using Field ID", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"An error message must be returned\", function () {", - " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"key\": \"test-field-variable\",\n \"value\": \"Value for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "id", - "{{contentType.field4}}", - "variables" - ] - }, - "description": "Attempts to create a new Field Variable without User authentication." - }, - "response": [] - }, - { - "name": "Create Field Variable using Var Name", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"An error message must be returned\", function () {", - " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"key\": \"test-field-variable\",\n \"value\": \"NEW VALUE for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "var", - "{{contentType.field4.varName}}", - "variables" - ] - }, - "description": "Attempts to create a new Field Variable without User authentication." - }, - "response": [] - }, - { - "name": "Update Field Variable using Field ID", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"An error message must be returned\", function () {", - " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"UPDATED VALUE USING ID for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "id", - "{{contentType.field4}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" - ] - }, - "description": "Attempts to update a Field Variable without User authentication." - }, - "response": [] - }, - { - "name": "Update Field Variable using Var Name", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"An error message must be returned\", function () {", - " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"UPDATED VALUE USING VAR NAME for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "var", - "{{contentType.field4.varName}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" - ] - }, - "description": "Attempts to update a Field Variable without User authentication." - }, - "response": [] - }, - { - "name": "Delete Field Variable using Field ID", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"An error message must be returned\", function () {", - " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "id", - "{{contentType.field4}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" - ] - }, - "description": "Attempts to delete a Field Variable without User authentication." - }, - "response": [] - }, - { - "name": "Update Field Variable using Var Name", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"An error message must be returned\", function () {", - " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "var", - "{{contentType.field4.varName}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" - ] - }, - "description": "Attempts to delete a Field Variable without User authentication." - }, - "response": [] - } - ], - "description": "Verifies that CRUD operations on Field Variables DO NOT WORK for the Anonymous User." - }, - { - "name": "Cleanup Content Type", - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - } - ] + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\", \n \"defaultType\": false, \n \"name\": \"Test Content Type\", \n \"description\": \"THE DESCRIPTION\", \n \"host\": \"SYSTEM_HOST\", \n \"owner\": \"dotcms.org.1\", \n \"fixed\": false, \n \"system\": false, \n \"folder\": \"SYSTEM_FOLDER\",\n \"fields\": [\n {\n \"dataType\": \"SYSTEM\",\n \"dbColumn\": \"system_field1\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Host/Folder\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n },\n {\n \"dataType\": \"LONG_TEXT\",\n \"dbColumn\": \"text_area2\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1453474468000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTagField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Tags\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"tags\"\n }],\n \"workflow\": [\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}\n" }, - "method": "DELETE", - "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "contenttype" ] - } + }, + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." }, "response": [] - } - ], - "description": "Verifies that creating Field Variables for Fields in a Content Type is working as expected." - }, - { - "name": "Test Copy ContentType", - "item": [ + }, { - "name": "Copy FileAsset Success", + "name": "Get Content Type", "event": [ { "listen": "test", "script": { "exec": [ "var jsonData = pm.response.json();", - "var contentType = jsonData.entity;", "", - "pm.test(\"Status code should be 200\", function() {", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", "});", - "pm.test(\"Content Type has the provided name\", function() {", - " pm.expect(contentType.name).to.eql(\"File Asset Copy\");", + "", + "", + "pm.test(\"fields check\", function () {", + " pm.expect(jsonData.entity.fields.length).to.gte(2);", "});", - "pm.test(\"Content Type should have 9 fields\", function() {", - " pm.expect(contentType.fields.length).to.gt(8);", - "});" + "", + "pm.test(\"description check\", function () {", + " pm.expect(jsonData.entity.description).to.eql('THE DESCRIPTION');", + "});", + "", + "let fields = jsonData.entity.fields.filter(field => field.variable !== 'tags');", + "", + "", + "pm.collectionVariables.set(\"fields\", JSON.stringify(fields));" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] }, - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"File Asset Copy\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", "host": [ "{{serverURL}}" ], @@ -3547,108 +437,56 @@ "api", "v1", "contenttype", - "fileAsset", - "_copy" - ] - } - }, - "response": [] - }, - { - "name": "ContentType Source does not exist", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 400\", function() {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - } + "id", + "{{contentTypeID}}" ] }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"File Asset Copy\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/fileAssetNotExist/_copy", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "fileAssetNotExist", - "_copy" - ] - } + "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." }, "response": [] }, { - "name": "ContentType Name Not Sent", + "name": "Update Content Type without sending variable success", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 400\", function() {", - " pm.response.to.have.status(400);", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", "});", - "" + "", + "pm.test(\"fields check\", function () {", + " pm.expect(jsonData.entity.fields.length).to.eql(3);", + "});", + "", + "pm.test(\"description check\", function () {", + " pm.expect(jsonData.entity.description).to.eql('THE DESCRIPTION');", + "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] }, - "method": "POST", + "method": "PUT", "header": [], "body": { "mode": "raw", - "raw": "{\n \"variable\": \"FileAssetCopyTestNot\"\n}", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"THE DESCRIPTION\",\n \"fields\":{{fields}},\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"Test Content Type\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", "options": { "raw": { "language": "json" @@ -3656,7 +494,7 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", "host": [ "{{serverURL}}" ], @@ -3664,49 +502,45 @@ "api", "v1", "contenttype", - "fileAsset", - "_copy" + "id", + "{{contentTypeID}}" ] - } + }, + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." }, "response": [] }, { - "name": "ContentType Copy no body", + "name": "Delete ContentType", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 400\", function() {", - " pm.response.to.have.status(400);", - "});", - "" + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] }, - "method": "POST", + "method": "DELETE", "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", "host": [ "{{serverURL}}" ], @@ -3714,70 +548,62 @@ "api", "v1", "contenttype", - "fileAsset", - "_copy" + "id", + "{{contentTypeID}}" ] - } + }, + "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." }, "response": [] - }, + } + ] + }, + { + "name": "Tests For New StoryBlockField", + "item": [ { - "name": "Copy FileAsset Unsupported Media Type", + "name": "Create ContentType with StoryBlockField Success", "event": [ { "listen": "test", "script": { "exec": [ - "// Validate the response status is 415", - "pm.test(\"Response status is 415\", function () {", - " pm.response.to.have.status(415);", + "var jsonData = pm.response.json();", + "var contentType = jsonData.entity[0];", + "pm.collectionVariables.set(\"contentTypeIdWithStoryBlock\", contentType.id);", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200);", "});", - "", - "// Validate that the response body contains the 'message' property and it is not empty", - "pm.test(\"Response should have an error message\", function () {", - " const responseBody = pm.response.json();", - " pm.expect(responseBody).to.have.property('message').that.is.not.empty;", - " pm.expect(responseBody.message).to.equal('HTTP 415 Unsupported Media Type');", + "pm.test(\"Content Type should have 2 fields\", function() {", + " pm.expect(contentType.fields.length).to.gte(2);", "});", - "" + "pm.test(\"Content Type has a Story_block_field\", function() {", + "", + " const hasStoryBlock = contentType.fields.some(field => field.fieldType === \"Story-Block\");", + " pm.expect(hasStoryBlock).to.be.true;", + "});" ], "type": "text/javascript", "packages": {} } } ], - "protocolProfileBehavior": { - "disabledSystemHeaders": { - "content-type": true - } - }, "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] }, "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/javascript", - "type": "text" - } - ], + "header": [], "body": { "mode": "raw", - "raw": "{\n \"name\": \"File Asset Copy\"\n}", + "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"system\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"\",\n \"host\": \"SYSTEM_HOST\",\n \"folder\":\"SYSTEM_FOLDER\",\n \"name\":\"TestContentTypeWithStoryBlockField\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t},\n {\n \"clazz\":\"com.dotcms.contenttype.model.field.ImmutableStoryBlockField\",\n \"required\":false,\n \"name\":\"block\",\n \"defaultValue\":\"\",\n \"hint\":\"\",\n \"searchable\":true\n }\n ]\n}", "options": { "raw": { "language": "json" @@ -3785,3600 +611,4103 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "fileAsset", - "_copy" + "contenttype" ] - } + }, + "description": "Creates a contentType with 2 fields:\n- A text field named Title\n- A story block field named block" }, "response": [] - } - ] - }, - { - "name": "Test Filtered Content Types", - "item": [ + }, { - "name": "pre - Import Test Content Types", + "name": "Create contentlet with StoryBlockField", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Bundle 'bundle-with-content-types-issue-22039.tar.gz' was not uploaded!\", function () {", + "var jsonData = pm.response.json();", + "pm.test(\"Status code should be 200\", function() {", " pm.response.to.have.status(200);", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData[\"bundleName\"]).to.eql(\"bundle-with-content-types-issue-22039.tar.gz\");", - " pm.expect(jsonData[\"status\"]).to.eql(\"SUCCESS\");", + "});", + "pm.test(\"Contentlet StoryBlock has value\", function() {", + " pm.expect(jsonData.entity.block.content[0].content[0].text).contains(\"Wow, this editor instance exports its content as JSON\");", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "password", - "value": "admin", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/octet-stream" - }, - { - "key": "Content-Disposition", - "value": "attachment" - } - ], + "method": "PUT", + "header": [], "body": { - "mode": "formdata", - "formdata": [ - { - "key": "file", - "type": "file", - "src": "resources/ContentTypeResource/bundle-with-content-types-issue-22039.tar.gz" + "mode": "raw", + "raw": "{\n \"contentlet\": {\n \"contentType\": \"{{contentTypeIdWithStoryBlock}}\",\n \"name\": \"test with data block field\",\n \"title\": \"test with data block field\",\n \"block\": \"{\\\"type\\\": \\\"doc\\\",\\\"content\\\": [{\\\"type\\\": \\\"paragraph\\\",\\\"content\\\": [{\\\"type\\\": \\\"text\\\",\\\"text\\\": \\\"Wow, this editor instance exports its content as JSON.\\\"}]}]}\"\n }\n}", + "options": { + "raw": { + "language": "json" } - ] + } }, "url": { - "raw": "{{serverURL}}/api/bundle/sync", + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", "host": [ "{{serverURL}}" ], "path": [ "api", - "bundle", - "sync" - ], - "query": [ - { - "key": "AUTH_TOKEN", - "value": "", - "disabled": true - } + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" ] - }, - "description": "Imports a Bundle containing the Content Types that are supposed to exist for the subsequent tests to work as expected." + } }, "response": [] - }, + } + ] + }, + { + "name": "Test Get ContentTypes", + "item": [ { - "name": "Get Content Types - First page", + "name": "Get ContentTypes sending HostID", "event": [ { "listen": "test", "script": { "exec": [ - "", - "pm.test(\"Status code must be ok 200\", function () {", + "pm.test(\"Status code should be 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"The 'Content (Generic)' type must come first!'\", function () {", - " pm.expect(\"Content (Generic)\").to.equal(jsonData.entity[0].name);", - "});", - "", - "pm.test(\"There must be 3 Content Types in the response only!'\", function () {", - " pm.expect(3).to.equal(jsonData.entity.length);", - "});", - "" + "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] }, - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,htmlpageasset,FileAsset\"\n },\n \"page\": 1,\n \"perPage\": 3\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "raw": "{{serverURL}}/api/v1/contenttype?host=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "_filter" + "contenttype" + ], + "query": [ + { + "key": "host", + "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d" + } ] - }, - "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the pagination parameters**." + } }, "response": [] }, { - "name": "Get Content Types - Second page", + "name": "Get ContentTypes sending SYSTEM_HOST", "event": [ { "listen": "test", "script": { "exec": [ - "", - "pm.test(\"Status code must be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", "var jsonData = pm.response.json();", "", - "pm.test(\"The 'dotAsset' type must come first!'\", function () {", - " pm.expect(\"dotAsset\").to.equal(jsonData.entity[0].name);", + "pm.test(\"Amount of ContentTypes could be greather or eql than 10\", function () {", + " pm.expect(jsonData.entity.length).to.be.gte(10);", "});", "", - "pm.test(\"There must be 2 Content Types in the response only!'\", function () {", - " pm.expect(2).to.equal(jsonData.entity.length);", - "});", - "" + "pm.test(\"Status code should be 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ + "type": "bearer", + "bearer": [ { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] }, - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\"\n },\n \"page\": 2,\n \"perPage\": 3\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "raw": "{{serverURL}}/api/v1/contenttype?host=SYSTEM_HOST", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "_filter" + "contenttype" + ], + "query": [ + { + "key": "host", + "value": "SYSTEM_HOST" + } ] - }, - "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the pagination parameters**." + } }, "response": [] }, { - "name": "Get Content Types - Not paginated", + "name": "Get ContentTypes without any param", "event": [ { "listen": "test", "script": { "exec": [ - "", - "pm.test(\"Status code must be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", "var jsonData = pm.response.json();", "", - "pm.test(\"All 5 Content Types in the response only!'\", function () {", - " pm.expect(5).to.equal(jsonData.entity.length);", + "pm.test(\"Amount of ContentTypes could be greather or eql than 10\", function () {", + " pm.expect(jsonData.entity.length).to.be.gte(10);", "});", - "" + "", + "pm.test(\"Status code should be 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] }, - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\"\n }\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "_filter" + "contenttype" ] - }, - "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **without any pagination parameters.**" + } }, "response": [] }, { - "name": "Get Content Types - Filtered", + "name": "Get ContentTypes sending not existing hostID", "event": [ { "listen": "test", "script": { "exec": [ - "", - "pm.test(\"Status code must be ok 200\", function () {", + "pm.test(\"Status code should be 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Only 2 Content Types with the letters 'ent' should be returned!'\", function () {", - " pm.expect(2).to.equal(jsonData.entity.length);", - "});", - "" + "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] }, - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\",\n \"query\": \"ent\"\n }\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "raw": "{{serverURL}}/api/v1/contenttype?host=aaaaa-aaaa-aaaa-aaaaaa", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "_filter" + "contenttype" + ], + "query": [ + { + "key": "host", + "value": "aaaaa-aaaa-aaaa-aaaaaa" + } ] - }, - "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the specified filter including the letters that might be present in either the Content Type's name or Velocity Var Name.**" + } }, "response": [] }, { - "name": "Get Content Types - Filtered Paginated", + "name": "Get existing Base Content Type", "event": [ { "listen": "test", "script": { "exec": [ - "", - "pm.test(\"Status code must be ok 200\", function () {", + "pm.test(\"HTTP Status code must be 200\", function () {", " pm.response.to.have.status(200);", "});", "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Only 1 Content Type with the letters 'set' should be returned!'\", function () {", - " pm.expect(1).to.equal(jsonData.entity.length);", + "pm.test(\"Checking that there are at least 1 Content Type of Base Type 'dotAsset'\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.gte(1, \"There MUST be at least one Content Type of Base Type 'dotAsset'\");", "});", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] }, - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\",\n \"query\": \"set\"\n },\n \"page\": 1,\n \"perPage\": 3\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "raw": "{{serverURL}}/api/v1/contenttype?type=DOTASSET&orderby=name", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "_filter" + "contenttype" + ], + "query": [ + { + "key": "type", + "value": "DOTASSET" + }, + { + "key": "orderby", + "value": "name" + } ] }, - "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the specified filter including the letters that might be present in either the Content Type's name or Velocity Var Name.**\n\nIn this case, the second page is being requested." + "description": "Returns all Content Types whose Base Type is 'dotAsset'. **There must be AT LEAST one Content Type of such a Base Type.**" }, "response": [] }, { - "name": "Get Content Types - All types", + "name": "Get non-existing Base Content Type", "event": [ { "listen": "test", "script": { "exec": [ - "", - "pm.test(\"Status code must be ok 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"HTTP Status code must be 400\", function () {", + " pm.response.to.have.status(400);", "});", "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"At least 12 Content Types must be returned, as not filter is set!'\", function () {", - " pm.expect(jsonData.entity.length).to.greaterThan(11)", + "pm.test(\"Checking that the error message is present\", function () {", + " const message = pm.response.json().message;", + " pm.expect(message).to.contain(\"FORM2\", \"The returned error message may not be\")", "});", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] }, - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"orderBy\": \"name\",\n \"direction\": \"ASC\",\n \"perPage\": 40\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "raw": "{{serverURL}}/api/v1/contenttype?filter=filter&page=3&per_page=4&type=FORM2&orderby=name", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "_filter" + "contenttype" + ], + "query": [ + { + "key": "filter", + "value": "filter" + }, + { + "key": "page", + "value": "3" + }, + { + "key": "per_page", + "value": "4" + }, + { + "key": "type", + "value": "FORM2" + }, + { + "key": "orderby", + "value": "name" + } ] }, - "description": "Returns the appropriate JSON data with **ALL** the Content Types in the content repo as no filtering parameters were provided." + "description": "Requesting an invalid Base Content Type will return an error message and an HTTP Status 400." }, "response": [] } - ], - "description": "This Test Collection will verify that the Content Type Filtering Endpoint works as expected. This endpoint can take a list of specific Content Types and perform filtering and pagination operations on them." + ] }, { - "name": "Test Accept Site Names and Folder Path", + "name": "Test ContentType With Field Variables", "item": [ { - "name": "createFolders Success", - "event": [ + "name": "Create Test Data", + "item": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 200\", function () {", - " pm.response.to.have.status(200);", - " let jsonData = pm.response.json();", - " pm.expect(jsonData.entity.length).to.be.above(0); ", - " let folder = jsonData.entity[0];", - " pm.expect(folder.title).eql(\"foo2\");", - " pm.expect(folder.type).eql(\"folder\");", - " pm.expect(folder.path).eql(\"/foo1/foo2/\");", - " pm.collectionVariables.set(\"folder\", folder);", - " pm.collectionVariables.set(\"folder.identifier\", folder.identifier);", - " pm.collectionVariables.set(\"folder.hostId\", folder.hostId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Create ContentType with field variables", + "event": [ { - "key": "password", - "value": "admin", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "var contentType = jsonData.entity[0];", + "pm.collectionVariables.set(\"contentTypeId\", contentType.id);", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200);", + "});", + "pm.test(\"Content Type has the provided name\", function() {", + " pm.expect(contentType.name).to.eql(\"WYSIWYG-Content\");", + "});", + "pm.test(\"Content Type should have 4 fields\", function() {", + " pm.expect(contentType.fields.length).to.eql(4);", + "});", + "pm.collectionVariables.set(\"contentType.host\", contentType.host);", + "pm.collectionVariables.set(\"contentType.field1\", contentType.fields[0].id);", + "pm.collectionVariables.set(\"contentType.field2\", contentType.fields[1].id);", + "pm.collectionVariables.set(\"contentType.field3\", contentType.fields[2].id);", + "pm.collectionVariables.set(\"contentType.field4\", contentType.fields[3].id);", + "pm.collectionVariables.set(\"contentType.field4.varName\", contentType.fields[3].variable);", + "pm.collectionVariables.set(\"contentType.divider\", contentType.layout[0].divider.id);", + "pm.collectionVariables.set(\"contentType.columnDivider\", contentType.layout[0].columns[0].columnDivider.id);", + "var wysigygField = contentType.fields[3];", + "var secondVar = wysigygField.fieldVariables[1];", + "pm.test(\"Variable should have its key and value with hello:world\", function() {", + " pm.expect(secondVar.key).to.eql(\"hello\");", + " pm.expect(secondVar.value).to.eql(\"world\");", + "});", + "pm.test(\"WYSIWYG must exist and have 3 variables\", function() {", + " pm.expect(wysigygField.fieldType).to.eql(\"WYSIWYG\");", + " pm.expect(wysigygField.fieldVariables.length).to.eql(3);", + "});", + "var tinyMcePropsVar = wysigygField.fieldVariables[2];", + "pm.test(\"WYSIWYG tinymceoprops variable is present with value\", function() {", + " pm.expect(tinyMcePropsVar.key).to.eql(\"tinymceprops\");", + " pm.expect(tinyMcePropsVar.value).to.eql(\"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } } - ] + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\t\"baseType\": \"CONTENT\",\n\t\t\"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n\t\t\"defaultType\": false,\n\t\t\"fields\": [{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\"fieldType\": \"Row\",\n\t\t\t\"fieldTypeLabel\": \"Row\",\n\t\t\t\"fieldVariables\": [],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168604000,\n\t\t\t\"indexed\": false,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168642000,\n\t\t\t\"name\": \"fields-0\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": false,\n\t\t\t\"sortOrder\": 0,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"fields0\"\n\t\t}, {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\"fieldType\": \"Column\",\n\t\t\t\"fieldTypeLabel\": \"Column\",\n\t\t\t\"fieldVariables\": [],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168604000,\n\t\t\t\"indexed\": false,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168642000,\n\t\t\t\"name\": \"fields-1\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": false,\n\t\t\t\"sortOrder\": 1,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"fields1\"\n\t\t}, {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"fieldType\": \"Text\",\n\t\t\t\"fieldTypeLabel\": \"Text\",\n\t\t\t\"fieldVariables\": [],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168746000,\n\t\t\t\"indexed\": true,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168746000,\n\t\t\t\"name\": \"Title\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"title\"\n\t\t}, {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n\t\t\t\"dataType\": \"LONG_TEXT\",\n\t\t\t\"fieldType\": \"WYSIWYG\",\n\t\t\t\"fieldTypeLabel\": \"WYSIWYG\",\n\t\t\t\"fieldVariables\": [{\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\"key\": \"foo\",\n\t\t\t\t\"value\": \"bar\"\n\t\t\t}, {\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\"key\": \"hello\",\n\t\t\t\t\"value\": \"world\"\n\t\t\t}, {\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\"key\": \"tinymceprops\",\n\t\t\t\t\"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n\t\t\t}],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168642000,\n\t\t\t\"indexed\": true,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168746000,\n\t\t\t\"name\": \"component\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": true,\n\t\t\t\"sortOrder\": 3,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"component\"\n\t\t}],\n\t\t\"fixed\": false,\n\t\t\"folder\": \"SYSTEM_FOLDER\",\n\t\t\"host\": \"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n\t\t\"iDate\": 1606168519000,\n\t\t\"layout\": [{\n\t\t\t\"divider\": {\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n\t\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\t\"fieldType\": \"Row\",\n\t\t\t\t\"fieldTypeLabel\": \"Row\",\n\t\t\t\t\"fieldVariables\": [],\n\t\t\t\t\"fixed\": false,\n\t\t\t\t\"iDate\": 1606168604000,\n\t\t\t\t\"indexed\": false,\n\t\t\t\t\"listed\": false,\n\t\t\t\t\"modDate\": 1606168642000,\n\t\t\t\t\"name\": \"fields-0\",\n\t\t\t\t\"readOnly\": false,\n\t\t\t\t\"required\": false,\n\t\t\t\t\"searchable\": false,\n\t\t\t\t\"sortOrder\": 0,\n\t\t\t\t\"unique\": false,\n\t\t\t\t\"variable\": \"fields0\"\n\t\t\t},\n\t\t\t\"columns\": [{\n\t\t\t\t\"columnDivider\": {\n\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n\t\t\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\t\t\"fieldType\": \"Column\",\n\t\t\t\t\t\"fieldTypeLabel\": \"Column\",\n\t\t\t\t\t\"fieldVariables\": [],\n\t\t\t\t\t\"fixed\": false,\n\t\t\t\t\t\"iDate\": 1606168604000,\n\t\t\t\t\t\"indexed\": false,\n\t\t\t\t\t\"listed\": false,\n\t\t\t\t\t\"modDate\": 1606168642000,\n\t\t\t\t\t\"name\": \"fields-1\",\n\t\t\t\t\t\"readOnly\": false,\n\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\"searchable\": false,\n\t\t\t\t\t\"sortOrder\": 1,\n\t\t\t\t\t\"unique\": false,\n\t\t\t\t\t\"variable\": \"fields1\"\n\t\t\t\t},\n\t\t\t\t\"fields\": [{\n\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n\t\t\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\t\t\"fieldType\": \"Text\",\n\t\t\t\t\t\"fieldTypeLabel\": \"Text\",\n\t\t\t\t\t\"fieldVariables\": [],\n\t\t\t\t\t\"fixed\": false,\n\t\t\t\t\t\"iDate\": 1606168746000,\n\t\t\t\t\t\"indexed\": true,\n\t\t\t\t\t\"listed\": false,\n\t\t\t\t\t\"modDate\": 1606168746000,\n\t\t\t\t\t\"name\": \"Title\",\n\t\t\t\t\t\"readOnly\": false,\n\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\"searchable\": true,\n\t\t\t\t\t\"sortOrder\": 2,\n\t\t\t\t\t\"unique\": false,\n\t\t\t\t\t\"variable\": \"title\"\n\t\t\t\t}, {\n\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n\t\t\t\t\t\"dataType\": \"LONG_TEXT\",\n\t\t\t\t\t\"fieldType\": \"WYSIWYG\",\n\t\t\t\t\t\"fieldTypeLabel\": \"WYSIWYG\",\n\t\t\t\t\t\"fieldVariables\": [{\n\t\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\t\t\"key\": \"foo\",\n\t\t\t\t\t\t\"value\": \"bar\"\n\t\t\t\t\t}, {\n\t\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\t\t\"key\": \"hello\",\n\t\t\t\t\t\t\"value\": \"world\"\n\t\t\t\t\t}, {\n\t\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\t\t\"key\": \"tinymceprops\",\n\t\t\t\t\t\t\"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n\t\t\t\t\t}],\n\t\t\t\t\t\"fixed\": false,\n\t\t\t\t\t\"iDate\": 1606168642000,\n\t\t\t\t\t\"indexed\": true,\n\t\t\t\t\t\"listed\": false,\n\t\t\t\t\t\"modDate\": 1606168746000,\n\t\t\t\t\t\"name\": \"component\",\n\t\t\t\t\t\"readOnly\": false,\n\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\"searchable\": true,\n\t\t\t\t\t\"sortOrder\": 3,\n\t\t\t\t\t\"unique\": false,\n\t\t\t\t\t\"variable\": \"component\"\n\t\t\t\t}]\n\t\t\t}]\n\t\t}],\n\t\t\"modDate\": 1606177211000,\n\t\t\"multilingualable\": false,\n\t\t\"name\": \"WYSIWYG-Content\",\n\t\t\"system\": false,\n\t\t\"systemActionMappings\": {},\n\t\t\"variable\": \"WysiwygContent\",\n\t\t\"versionable\": true,\n\t\t\"workflows\": []\n\t}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that WYSIWYG field is created with provided field variables." + }, + "response": [] }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "[\"/foo1/foo2\"]\n", - "options": { - "raw": { - "language": "json" + { + "name": "Update ContentType with field variables", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "var contentType = jsonData.entity", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200);", + "});", + "pm.test(\"Content Type has the provided name\", function() {", + " pm.expect(contentType.name).to.eql(\"WYSIWYG-Content-Renamed\");", + "});", + "pm.test(\"Content Type should have 4 fields\", function() {", + " pm.expect(contentType.fields.length).to.eql(4);", + "});", + "var wysigygField = contentType.fields[3];", + "pm.test(\"WYSIWYG must exist and have 2 variables\", function() {", + " pm.expect(wysigygField.fieldType).to.eql(\"WYSIWYG\");", + " pm.expect(wysigygField.fieldVariables.length).to.eql(2);", + "});", + "var firstVar = wysigygField.fieldVariables[0];", + "pm.test(\"Variable should have its key and value modified to hola:mundo\", function() {", + " pm.expect(firstVar.key).to.eql(\"hola\");", + " pm.expect(firstVar.value).to.eql(\"mundo\");", + "});", + "var tinyMcePropsVar = wysigygField.fieldVariables[1];", + "pm.test(\"WYSIWYG tinymceoprops variable is present with value\", function() {", + " pm.expect(tinyMcePropsVar.key).to.eql(\"tinymceprops\");", + " pm.expect(tinyMcePropsVar.value).to.eql(\"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"baseType\": \"CONTENT\",\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"defaultType\": false,\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field2}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field3}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"title\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"id\": \"6bf0f909-7f33-43a3-9b9c-fd7551fa73d7\",\n \"key\": \"hola\",\n \"value\": \"mundo\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ],\n \"fixed\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"host\": \"{{contentType.host}}\",\n \"iDate\": 1606168519000,\n \"id\": \"{{contentTypeId}}\",\n \"layout\": [\n {\n \"divider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.divider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n \"columns\": [\n {\n \"columnDivider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.columnDivider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"title\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6bf0f909-7f33-43a3-9b9c-fd7551fa73d7\",\n \"key\": \"hola\",\n \"value\": \"mundo\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ]\n }\n ]\n }\n ],\n \"modDate\": 1607013655000,\n \"multilingualable\": false,\n \"name\": \"WYSIWYG-Content-Renamed\",\n \"system\": false,\n \"systemActionMappings\": {},\n \"variable\": \"WysiwygContent\",\n \"versionable\": true,\n \"workflows\": [\n {\n \"archived\": false,\n \"creationDate\": 1607013267018,\n \"defaultScheme\": false,\n \"description\": \"\",\n \"entryActionId\": null,\n \"id\": \"{{contentType.workflow}}\",\n \"mandatory\": false,\n \"modDate\": 1607013261505,\n \"name\": \"System Workflow\",\n \"system\": true\n }\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Given a content type payload containing field variables.\nWhen sending a PUT.\nExpect that code is 200.\nExpect content type is updated with the provided fields.\nExpect that WYSIWYG field is updated with provided field variables." + }, + "response": [] }, - "url": { - "raw": "{{serverURL}}/api/v1/folder/createfolders/default", - "host": [ - "{{serverURL}}" + { + "name": "Update ContentType with field variables - delete - update - add", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "var contentType = jsonData.entity", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200);", + "});", + "pm.test(\"Content Type has the provided name\", function() {", + " pm.expect(contentType.name).to.eql(\"WYSIWYG-Content-Renamed2\");", + "});", + "pm.test(\"Content Type should have 4 fields\", function() {", + " pm.expect(contentType.fields.length).to.eql(4);", + "});", + "var wysigygField = contentType.fields[3];", + "pm.test(\"WYSIWYG must exist and have 2 variables\", function() {", + " pm.expect(wysigygField.fieldType).to.eql(\"WYSIWYG\");", + " pm.expect(wysigygField.fieldVariables.length).to.eql(2);", + "});", + "var firstVar = wysigygField.fieldVariables[0];", + "pm.test(\"Variable should have its key and value modified to hola:mundo\", function() {", + " pm.expect(firstVar.key).to.eql(\"hi\");", + " pm.expect(firstVar.value).to.eql(\"all\");", + " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", firstVar.id);", + " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.key\", firstVar.key);", + "});", + "var tinyMcePropsVar = wysigygField.fieldVariables[1];", + "pm.test(\"WYSIWYG tinymceoprops variable is present with value\", function() {", + " pm.expect(tinyMcePropsVar.key).to.eql(\"tinymceprops\");", + " pm.expect(tinyMcePropsVar.value).to.eql(\"{toolbar:\\\"true\\\",menu:\\\"true\\\", theme:\\\"advanced\\\"}\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "folder", - "createfolders", - "default" - ] + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"baseType\": \"CONTENT\",\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"defaultType\": false,\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field2}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field3}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"titleNew\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"key\": \"hi\",\n \"value\": \"all\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"true\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ],\n \"fixed\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"host\": \"{{contentType.host}}\",\n \"iDate\": 1606168519000,\n \"id\": \"{{contentTypeId}}\",\n \"layout\": [\n {\n \"divider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.divider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n \"columns\": [\n {\n \"columnDivider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.columnDivider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"title\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6bf0f909-7f33-43a3-9b9c-fd7551fa73d7\",\n \"key\": \"hola\",\n \"value\": \"mundo\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ]\n }\n ]\n }\n ],\n \"modDate\": 1607013655000,\n \"multilingualable\": false,\n \"name\": \"WYSIWYG-Content-Renamed2\",\n \"system\": false,\n \"systemActionMappings\": {},\n \"variable\": \"WysiwygContent\",\n \"versionable\": true,\n \"workflows\": [\n {\n \"archived\": false,\n \"creationDate\": 1607013267018,\n \"defaultScheme\": false,\n \"description\": \"\",\n \"entryActionId\": null,\n \"id\": \"{{contentType.workflow}}\",\n \"mandatory\": false,\n \"modDate\": 1607013261505,\n \"name\": \"System Workflow\",\n \"system\": true\n }\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Given a content type payload containing field variables.\nWhen sending a PUT.\nExpect that code is 200.\nExpect content type is updated with the provided fields.\nExpect that WYSIWYG field is updated with provided field variables." + }, + "response": [] } - }, - "response": [] + ] }, { - "name": "Create ContentType From Given Host Idenifier and Folder Identifier", - "event": [ + "name": "Field Variables - With User", + "item": [ { - "listen": "test", - "script": { - "exec": [ - "let jsonData = pm.response.json();", - "let contentType = jsonData.entity[0];", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200);", - " let folder = pm.collectionVariables.get(\"folder\");", - " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", - " pm.expect(contentType.folder).to.eql(folder.identifier);", - " pm.expect(contentType.host).to.eql(folder.hostId);", - "})", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Create Field Variable using Field ID", + "event": [ { - "key": "password", - "value": "admin", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", jsonData.entity.id);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable created with ID\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "id", + "{{contentType.field4}}", + "variables" + ] }, + "description": "Attempts to create a new Field Variable without User authentication." + }, + "response": [] + }, + { + "name": "Create Field Variable using Var Name", + "event": [ { - "key": "saveHelperData", - "type": "any" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"system\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"CT created using the folderPath property\", \n \"host\":\"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n \"folder\":\"{{folder.identifier}}\",\n \"name\":\"SimpleContentTypeFromFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", - "options": { - "raw": { - "language": "json" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", jsonData.entity.id);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a contentType using the folderPath property\n\nExpect success." - }, - "response": [] - }, - { - "name": "Create ContentType From Given Folder Path", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "let jsonData = pm.response.json();", - "let contentType = jsonData.entity[0];", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200);", - " let folder = pm.collectionVariables.get(\"folder\");", - " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", - " pm.expect(contentType.folder).to.eql(folder.identifier);", - " pm.expect(contentType.host).to.eql(folder.hostId);", - "})", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable created with Var Name\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "var", + "{{contentType.field4.varName}}", + "variables" + ] }, + "description": "Attempts to create a new Field Variable without User authentication." + }, + "response": [] + }, + { + "name": "Get All Field Variables using Field ID", + "event": [ { - "key": "saveHelperData", - "type": "any" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"defaultType\":false,\n \"fixed\":false, \n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"CT created using the folderPath property\", \n \"folderPath\":\"default:/foo1/foo2\",\n \"name\":\"SimpleContentTypeFromFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", - "options": { - "raw": { - "language": "json" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "});", + "", + "pm.test(\"There must be only two Field Variables\", function () {", + " pm.expect(pm.response.json().entity.length).to.equal(2, 'There must be only 2 Field Variables at this point');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a contentType using the folderPath property\n\nExpect success." - }, - "response": [] - }, - { - "name": "Create ContentType From Given Host Name and Folder Path", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "let jsonData = pm.response.json();", - "let contentType = jsonData.entity[0];", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200);", - " let folder = pm.collectionVariables.get(\"folder\");", - " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", - " pm.expect(contentType.folder).to.eql(folder.identifier);", - " pm.expect(contentType.host).to.eql(folder.hostId);", - "})", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "id", + "{{contentType.field4}}", + "variables" + ] }, + "description": "Attempts to create a new Field Variable without User authentication." + }, + "response": [] + }, + { + "name": "Get All Field Variables using Field Var Name", + "event": [ { - "key": "saveHelperData", - "type": "any" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"system\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"Here we're sending host name an the folder path separately\", \n \"host\":\"default\",\n \"folderPath\":\"/foo1/foo2\",\n \"name\":\"SimpleContentTypeUsingHostNameAndFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", - "options": { - "raw": { - "language": "json" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "});", + "", + "pm.test(\"There must be only two Field Variables\", function () {", + " pm.expect(pm.response.json().entity.length).to.equal(2, 'There must be only 2 Field Variables at this point');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a contentType using a host name and folderPath\n\nHere we're sending host name and the folder path only contains the folders bit without the site name portion" - }, - "response": [] - }, - { - "name": "Create ContentType From Given Host Identifier and Folder Path (no host)", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "let jsonData = pm.response.json();", - "let contentType = jsonData.entity[0];", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200);", - " let folder = pm.collectionVariables.get(\"folder\");", - " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", - " pm.expect(contentType.folder).to.eql(folder.identifier);", - " pm.expect(contentType.host).to.eql(folder.hostId);", - "})", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "var", + "{{contentType.field4.varName}}", + "variables" + ] }, + "description": "Attempts to create a new Field Variable without User authentication." + }, + "response": [] + }, + { + "name": "Get Field Variable using Field ID", + "event": [ { - "key": "saveHelperData", - "type": "any" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"Here we're sending host name an the folder path separately\", \n \"host\":\"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n \"folderPath\":\"/foo1/foo2\",\n \"name\":\"SimpleContentTypeUsingHostIdAndFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", - "options": { - "raw": { - "language": "json" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a contentType using a host name and folderPath\n\nHere we're sending host name and the folder path only contains the folders bit without the site name portion" - }, - "response": [] - }, - { - "name": "Create FIXED ContentType Expect System-Host and System-Folder", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "let jsonData = pm.response.json();", - "let contentType = jsonData.entity[0];", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200); ", - " pm.expect(contentType.folderPath).to.eql(\"/\");", - " pm.expect(contentType.folder).to.eql(\"SYSTEM_FOLDER\");", - " pm.expect(contentType.host).to.eql(\"SYSTEM_HOST\");", - "})" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "id", + "{{contentType.field4}}", + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" + ] }, + "description": "Attempts to create a new Field Variable without User authentication." + }, + "response": [] + }, + { + "name": "Get Field Variable using Var Name", + "event": [ { - "key": "saveHelperData", - "type": "any" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"defaultType\":false,\n \"fixed\":true, \n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"CT created using the folderPath property\", \n \"folderPath\":\"any:/non-existing-folder\",\n \"name\":\"SimpleContentTypeFromFolderPathNonExistingFolder\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", - "options": { - "raw": { - "language": "json" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a simple contentType, that uses the folderPath property to set the location" - }, - "response": [] - } - ] - }, - { - "name": "Field Data", - "item": [ - { - "name": "Get All Field Types", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status must be successful\", function() {", - " pm.response.to.have.status(200);", - "});", - "", - "const expectedFieldTypes = pm.collectionVariables.get(\"fieldTypesArr\");", - "", - "pm.test(\"Checking the total number of Field Types\", function () {", - " const fieldTypes = pm.response.json().entity;", - " pm.expect(expectedFieldTypes.length).to.eql(fieldTypes.length, \"There must be exactly \" + expectedFieldTypes.length + \" Field Types in dotCMS\");", - "});", - "", - "pm.test(\"Checking the classes in all Field Types\", function () {", - " const fieldTypes = pm.response.json().entity;", - " fieldTypes.forEach(type => {", - "", - " pm.expect(expectedFieldTypes.includes(type.clazz)).to.equal(true, \"Type '\" + type.clazz + \"' doesn't exist in the official Field Type list\");", - "", - " })", - "});", - "" - ], - "type": "text/javascript" - } + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "var", + "{{contentType.field4.varName}}", + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" + ] + }, + "description": "Attempts to create a new Field Variable without User authentication." + }, + "response": [] }, { - "listen": "prerequest", - "script": { - "exec": [ - "const fieldTypesArr = [ ", - " \"com.dotcms.contenttype.model.field.ImmutableBinaryField\",", - " \"com.dotcms.contenttype.model.field.ImmutableStoryBlockField\",", - " \"com.dotcms.contenttype.model.field.ImmutableCategoryField\",", - " \"com.dotcms.contenttype.model.field.ImmutableCheckboxField\",", - " \"com.dotcms.contenttype.model.field.ImmutableConstantField\",", - " \"com.dotcms.contenttype.model.field.ImmutableCustomField\",", - " \"com.dotcms.contenttype.model.field.ImmutableDateField\",", - " \"com.dotcms.contenttype.model.field.ImmutableDateTimeField\",", - " \"com.dotcms.contenttype.model.field.ImmutableFileField\",", - " \"com.dotcms.contenttype.model.field.ImmutableHiddenField\",", - " \"com.dotcms.contenttype.model.field.ImmutableImageField\",", - " \"com.dotcms.contenttype.model.field.ImmutableJSONField\",", - " \"com.dotcms.contenttype.model.field.ImmutableKeyValueField\",", - " \"com.dotcms.contenttype.model.field.ImmutableLineDividerField\",", - " \"com.dotcms.contenttype.model.field.ImmutableMultiSelectField\",", - " \"com.dotcms.contenttype.model.field.ImmutablePermissionTabField\",", - " \"com.dotcms.contenttype.model.field.ImmutableRadioField\",", - " \"com.dotcms.contenttype.model.field.ImmutableRelationshipField\",", - " \"com.dotcms.contenttype.model.field.ImmutableRelationshipsTabField\",", - " \"com.dotcms.contenttype.model.field.ImmutableSelectField\",", - " \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",", - " \"com.dotcms.contenttype.model.field.ImmutableTabDividerField\",", - " \"com.dotcms.contenttype.model.field.ImmutableTagField\",", - " \"com.dotcms.contenttype.model.field.ImmutableTextField\",", - " \"com.dotcms.contenttype.model.field.ImmutableTextAreaField\",", - " \"com.dotcms.contenttype.model.field.ImmutableTimeField\",", - " \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\"", - "];", - "pm.collectionVariables.set(\"fieldTypesArr\", fieldTypesArr);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Update Field Variable using Field ID", + "event": [ { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "password", - "value": "admin", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/fieldTypes", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "fieldTypes" - ] + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable updated with ID\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "id", + "{{contentType.field4}}", + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" + ] + }, + "description": "Attempts to update a Field Variable without User authentication." + }, + "response": [] }, - "description": "Verifies that there's a specific number of Field Types in dotCMS, and that they all match one of the expected Field Types." - }, - "response": [] - }, - { - "name": "Site or Folder Field with No Searchable Option", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status must be successful\", function() {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that 'Searchable' option in 'Site or Folder' field is NOT present anymore\", function () {", - " const fieldTypes = pm.response.json().entity;", - " var isPropertyPresent = false;", - " fieldTypes.forEach(type => {", - "", - " if (\"com.dotcms.contenttype.model.field.ImmutableHostFolderField\" === type.clazz && type.properties.includes(\"searchable\")) {", - " isPropertyPresent = true;", - " }", - "", - " });", - " if (isPropertyPresent) {", - " pm.expect(false).to.equal(isPropertyPresent, \"The 'searchable' property must not be present for 'Site or Folder' fields\");", - " }", - "});", - "" - ], - "type": "text/javascript" - } + "name": "Update Field Variable using Var Name", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable updated with Var Name\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "var", + "{{contentType.field4.varName}}", + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" + ] + }, + "description": "Attempts to update a Field Variable without User authentication." + }, + "response": [] }, { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Delete Field Variable using Field ID", + "event": [ { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "password", - "value": "admin", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - ] + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "id", + "{{contentType.field4}}", + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" + ] + }, + "description": "Attempts to delete a Field Variable without User authentication." + }, + "response": [] }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/fieldTypes", - "host": [ - "{{serverURL}}" + { + "name": "Re-Create Test Field Variable", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", jsonData.entity.id);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "fieldTypes" - ] - } - }, - "response": [] - } - ], - "description": "Verifies that operations related to retrieving data from fields in Content Types are aworking as expected." - }, - { - "name": "Test delete publish/expire field", - "item": [ - { - "name": "Create ContentType with publish/expire fields", - "event": [ + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable created with ID\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "id", + "{{contentType.field4}}", + "variables" + ] + }, + "description": "Attempts to create a new Field Variable without User authentication." + }, + "response": [] + }, { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.collectionVariables.set(\"contentTypeID\", jsonData.entity[0].id);", - "pm.collectionVariables.set(\"contentTypeVAR\", jsonData.entity[0].variable);", - "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[2].id);", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"icon check\", function () {", - " pm.expect(jsonData.entity[0].icon).to.eql('testIcon');", - "});", - "", - "pm.test(\"Fields check\", function () {", - " pm.expect(jsonData.entity[0].fields.length).to.eql(4);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Delete Field Variable using Var Name", + "event": [ { - "key": "password", - "value": "admin", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] }, - { - "key": "saveHelperData", - "type": "any" + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "var", + "{{contentType.field4.varName}}", + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" + ] }, + "description": "Attempts to delete a Field Variable without User authentication." + }, + "response": [] + } + ], + "description": "Verifies that CRUD operations on Field Variables are working as expected." + }, + { + "name": "Field Variables - No User", + "item": [ + { + "name": "invalidate User Session", + "event": [ { - "key": "showPassword", - "value": false, - "type": "boolean" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test dates content {{$randomBankAccount}}\",\n\t\"variable\": \"testDatesContent{{$randomBankAccount}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"testIcon\",\n \"sortOrder\": 3,\n \"publishDateVar\": \"publishDate\",\n \"expireDateVar\": \"expireDate\",\n\t\"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableDateTimeField\",\n \"dataType\": \"DATE\",\n \"fieldType\": \"Date-and-Time\",\n \"fieldTypeLabel\": \"Date and Time\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Publish Date\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"publishDate\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableDateTimeField\",\n \"dataType\": \"DATE\",\n \"fieldType\": \"Date-and-Time\",\n \"fieldTypeLabel\": \"Date and Time\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"iDate\": 1685054935000,\n \"indexed\": true,\n \"listed\": true,\n \"modDate\": 1685054935000,\n \"name\": \"Expire Date\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"expireDate\"\n }\n\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype" - ] + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/logout", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "logout" + ] + } + }, + "response": [] }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." - }, - "response": [] - }, - { - "name": "Delete dateTime field", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, + "name": "Create Field Variable using Field ID", + "event": [ { - "key": "saveHelperData", - "type": "any" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "DELETE", - "header": [], - "body": { - "mode": "raw", - "raw": "{\"fieldsID\": [\"{{contentTypeFieldID}}\"]}", - "options": { - "raw": { - "language": "json" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"An error message must be returned\", function () {", + " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeID}}/fields", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v3", - "contenttype", - "{{contentTypeID}}", - "fields" - ] + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"key\": \"test-field-variable\",\n \"value\": \"Value for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "id", + "{{contentType.field4}}", + "variables" + ] + }, + "description": "Attempts to create a new Field Variable without User authentication." + }, + "response": [] }, - "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." - }, - "response": [] - } - ] - }, - { - "name": "Get Types from one or more Sites", - "item": [ - { - "name": "(Legacy) Types from System Host", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there at least 10 Content Types living under System Host\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(10, \"There MUST be at least 10 Content Types living in System Host -- unless some were added/removed\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(10, \"The 'totalEntries' parameter must be at least 10\");", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Create Field Variable using Var Name", + "event": [ { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "password", - "value": "admin", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"An error message must be returned\", function () {", + " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?host=SYSTEM_HOST&per_page=40", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" ], - "query": [ + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"key\": \"test-field-variable\",\n \"value\": \"NEW VALUE for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "var", + "{{contentType.field4.varName}}", + "variables" + ] + }, + "description": "Attempts to create a new Field Variable without User authentication." + }, + "response": [] + }, + { + "name": "Update Field Variable using Field ID", + "event": [ { - "key": "host", - "value": "SYSTEM_HOST" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "per_page", - "value": "40" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"An error message must be returned\", function () {", + " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - ] + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"UPDATED VALUE USING ID for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "id", + "{{contentType.field4}}", + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" + ] + }, + "description": "Attempts to update a Field Variable without User authentication." + }, + "response": [] }, - "description": "Returns the Content Types living in System Host." - }, - "response": [] - }, - { - "name": "(Legacy) Types from Default site", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there at least 2 Content Types living under the Default Site\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(2, \"There MUST be at least 2 Content Types living in the Default Site\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(10, \"The 'perPage' parameter must be 10\");", - " pm.expect(pagination.totalEntries).to.be.gte(2, \"The 'totalEntries' parameter must be at least 2\");", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Update Field Variable using Var Name", + "event": [ { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "password", - "value": "admin", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"An error message must be returned\", function () {", + " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?host=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" ], - "query": [ - { - "key": "host", - "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d" - } - ] + "request": { + "auth": { + "type": "noauth" + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"UPDATED VALUE USING VAR NAME for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "var", + "{{contentType.field4.varName}}", + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" + ] + }, + "description": "Attempts to update a Field Variable without User authentication." + }, + "response": [] }, - "description": "Returns all the Content Types living in the Default site." - }, - "response": [] - }, - { - "name": "Get Types from System Host", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there are at least 10 Content Types living under the System Host\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(10, \"There MUST be at least 10 Content Types living in System Host -- unless some were added/removed\");", - "});", - "", - "pm.test(\"Checking that there is no Content Type from another Site\", function () {", - " const entity = pm.response.json().entity;", - " const typeFromDefaultSite = entity.find(type => type.host !== 'SYSTEM_HOST');", - " pm.expect(typeFromDefaultSite).equals(undefined, \"There must be no Content Types from sites other than System Host\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(10, \"The 'totalEntries' parameter must be at least 10\");", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Delete Field Variable using Field ID", + "event": [ { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "password", - "value": "admin", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"An error message must be returned\", function () {", + " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=SYSTEM_HOST&per_page=40", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" ], - "query": [ - { - "key": "sites", - "value": "SYSTEM_HOST" + "request": { + "auth": { + "type": "noauth" }, - { - "key": "per_page", - "value": "40" - } - ] + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "id", + "{{contentType.field4}}", + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" + ] + }, + "description": "Attempts to delete a Field Variable without User authentication." + }, + "response": [] }, - "description": "Returns all the Content Types living in the Default site, using the new query string parameter." - }, - "response": [] - }, - { - "name": "Get Types from Default site", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there are at least 2 Content Types living under the Default site\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(2, \"There MUST be at least 2 Content Types living in the Default site\");", - "});", - "", - "pm.test(\"Checking that there is no Content Type from another Site\", function () {", - " const entity = pm.response.json().entity;", - " const typeFromDefaultSite = entity.find(type => type.host !== '8a7d5e23-da1e-420a-b4f0-471e7da8ea2d');", - " pm.expect(typeFromDefaultSite).equals(undefined, \"There must be no Content Types from sites other than Default\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(2, \"The 'totalEntries' parameter must be at least 2\");", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Update Field Variable using Var Name", + "event": [ { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "password", - "value": "admin", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"An error message must be returned\", function () {", + " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=default&per_page=40", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" ], - "query": [ - { - "key": "sites", - "value": "default" + "request": { + "auth": { + "type": "noauth" }, - { - "key": "per_page", - "value": "40" - } - ] - }, - "description": "Returns all the Content Types living in the Default site, using the new query string parameter, and passing down the Site Key." - }, - "response": [] - }, - { - "name": "Get Types from Default Site (ID) and System Host", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there are at least 12 Content Types living under the Default and System Host sites\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(12, \"There MUST be at least 12 Content Types living in the Default and System Host sites -- unless some were added/removed\");", - "});", - "", - "pm.test(\"Checking that there is at least 1 Content Type from the Default Site\", function () {", - " const entity = pm.response.json().entity;", - " const typeFromDefaultSite = entity.find(type => type.host === '8a7d5e23-da1e-420a-b4f0-471e7da8ea2d');", - " pm.expect(typeFromDefaultSite).to.not.equal(undefined, \"There MUST be at least one Content Type from the Default Site\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(12, \"The 'totalEntries' parameter must be at least 12\");", - "});", - "" - ], - "type": "text/javascript" - } + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "var", + "{{contentType.field4.varName}}", + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" + ] + }, + "description": "Attempts to delete a Field Variable without User authentication." + }, + "response": [] } ], + "description": "Verifies that CRUD operations on Field Variables DO NOT WORK for the Anonymous User." + }, + { + "name": "Cleanup Content Type", "request": { "auth": { "type": "basic", "basic": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "password", + "value": "admin", "type": "string" }, { - "key": "password", - "value": "admin", + "key": "username", + "value": "admin@dotcms.com", "type": "string" } ] }, - "method": "GET", + "method": "DELETE", "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d,SYSTEM_HOST&per_page=40", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" - ], - "query": [ - { - "key": "sites", - "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d,SYSTEM_HOST" - }, - { - "key": "per_page", - "value": "40" - } + "contenttype", + "id", + "{{contentTypeId}}" ] - }, - "description": "Returns all the Content Types living in both the Default and System Host sites, using the IDs." + } }, "response": [] - }, + } + ], + "description": "Verifies that creating Field Variables for Fields in a Content Type is working as expected." + }, + { + "name": "Test Copy ContentType", + "item": [ { - "name": "Get Types from Default Site (Site Key) and System Host Copy", + "name": "Copy FileAsset Success", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there are at least 12 Content Types living under the Default and System Host sites\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(12, \"There MUST be at least 12 Content Types living in the Default and System Host sites -- unless some were added/removed\");", - "});", + "var jsonData = pm.response.json();", + "var contentType = jsonData.entity;", "", - "pm.test(\"Checking that there is at least 1 Content Type from the Default Site\", function () {", - " const entity = pm.response.json().entity;", - " const typeFromDefaultSite = entity.find(type => type.host === '8a7d5e23-da1e-420a-b4f0-471e7da8ea2d');", - " pm.expect(typeFromDefaultSite).to.not.equal(undefined, \"There MUST be at least one Content Type from the Default Site\");", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200);", "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(12, \"The 'totalEntries' parameter must be at least 12\");", + "pm.test(\"Content Type has the provided name\", function() {", + " pm.expect(contentType.name).to.eql(\"File Asset Copy\");", "});", - "" + "pm.test(\"Content Type should have 9 fields\", function() {", + " pm.expect(contentType.fields.length).to.gt(8);", + "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "password", - "value": "admin", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] }, - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"File Asset Copy\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=default,SYSTEM_HOST&per_page=40", + "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" - ], - "query": [ - { - "key": "sites", - "value": "default,SYSTEM_HOST" - }, - { - "key": "per_page", - "value": "40" - } + "contenttype", + "fileAsset", + "_copy" ] - }, - "description": "Returns all the Content Types living in both the Default and System Host sites, using the Site Key." + } }, "response": [] }, { - "name": "Get Types from non-existing Site", + "name": "ContentType Source does not exist", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that no Content Types are returned\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).equals(0, \"There must be no Content Types in the results\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).equals(0, \"The 'totalEntries' parameter must be zero\");", - "});", - "" + "pm.test(\"Status code should be 400\", function() {", + " pm.response.to.have.status(400);", + "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "password", - "value": "admin", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] }, - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"File Asset Copy\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=non-existing-site&per_page=40", + "raw": "{{serverURL}}/api/v1/contenttype/fileAssetNotExist/_copy", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" - ], - "query": [ - { - "key": "sites", - "value": "non-existing-site" - }, - { - "key": "per_page", - "value": "40" - } + "contenttype", + "fileAssetNotExist", + "_copy" ] - }, - "description": "Returns all the Content Types living in the non-existing site, which must return an empty list." + } }, "response": [] }, { - "name": "Get Types from non-existing Site (ID) and System Host", + "name": "ContentType Name Not Sent", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there are at least 10 Content Types living under the Default and System Host sites\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(10, \"There MUST be at least 10 Content Types living in System Host -- unless some were added/removed\");", - "});", - "", - "pm.test(\"Checking that all Content Types come from System Host only\", function () {", - " const entity = pm.response.json().entity;", - " const typeFromDefaultSite = entity.find(type => type.host === '12312312-abcd-1234-dcba-456456456456');", - " pm.expect(typeFromDefaultSite).equals(undefined, \"All Content Types must come from System Host only\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(10, \"The 'totalEntries' parameter must be at least 10\");", + "pm.test(\"Status code should be 400\", function() {", + " pm.response.to.have.status(400);", "});", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "password", - "value": "admin", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] }, - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"variable\": \"FileAssetCopyTestNot\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=12312312-abcd-1234-dcba-456456456456,SYSTEM_HOST&per_page=40", + "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" - ], - "query": [ - { - "key": "sites", - "value": "12312312-abcd-1234-dcba-456456456456,SYSTEM_HOST" - }, - { - "key": "per_page", - "value": "40" - } + "contenttype", + "fileAsset", + "_copy" ] - }, - "description": "Returns all the Content Types living in a non-existing site and System Host, which must return only the types living in System Host." + } }, "response": [] }, { - "name": "Get Types from non-existing Site (ID) and Default site", + "name": "ContentType Copy no body", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there are at least 2 Content Types living under the Default site\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(2, \"There MUST be at least 2 Content Types living in the Default site\");", - "});", - "", - "pm.test(\"Checking that all Content Types come from the Default site only\", function () {", - " const entity = pm.response.json().entity;", - " const typeFromDefaultSite = entity.find(type => type.host === '12312312-abcd-1234-dcba-456456456456');", - " pm.expect(typeFromDefaultSite).equals(undefined, \"All Content Types must come from the Default site only\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(2, \"The 'totalEntries' parameter must be at least 2\");", + "pm.test(\"Status code should be 400\", function() {", + " pm.response.to.have.status(400);", "});", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "password", - "value": "admin", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] }, - "method": "GET", + "method": "POST", "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=invalid-site,default&per_page=40", + "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" - ], - "query": [ - { - "key": "sites", - "value": "invalid-site,default" - }, - { - "key": "per_page", - "value": "40" - } + "contenttype", + "fileAsset", + "_copy" ] - }, - "description": "Returns all the Content Types living in a non-existing site and the Defaut site, which must return only the types living in the Default site." + } }, "response": [] } - ], - "description": "These requests allow you to verify that dotCMS can retrieve a filtered paginated list of Content Types from a specific list of Sites only, and not from the whole repository. You can use both the Site's Identifier, or its Key -- aka, Site Name.\n\nThis suite is testing both the existing per-Site Endpoint -- flagged with **`(Legacy)`** -- and the new multi-site parameter." + ] }, { - "name": "Test detail page", + "name": "Test Filtered Content Types", "item": [ { - "name": "Test update detail page with id and URI", - "item": [ - { - "name": "Create Test Site", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Storing page data for subsequent tests\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"pageDetailSiteId\", jsonData.entity.identifier);", - " pm.collectionVariables.set(\"pageDetailSiteName\", jsonData.entity.siteName);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"siteName\":\"page.detail.host.com.{{$timestamp}}\",\n \"variables\":[]\n}\n", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/site", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "site" - ] - } - }, - "response": [] - }, - { - "name": "Create test Page1", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Storing page id and path for subsequent tests\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"pageDetailPageId1\", jsonData.entity.identifier);", - " pm.collectionVariables.set(\"pageDetailPageInode1\", jsonData.entity.inode);", - " pm.collectionVariables.set(\"pageDetailPageURL1\", jsonData.entity.url);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"contentlet\":{\n\t\t\"stName\": \"htmlpageasset\",\n\t\t\"title\": \"Page1 {{$timestamp}}\",\n \"url\": \"page1-{{$timestamp}}\",\n \"friendlyName\":\"page1-{{$timestamp}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"100\",\n \"hostFolder\":\"{{pageDetailSiteId}}\"\n\t}\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "PUBLISH" - ] - } - }, - "response": [] - }, - { - "name": "Create test Page2", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Storing page id and path for subsequent tests\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"pageDetailPageId2\", jsonData.entity.identifier);", - " pm.collectionVariables.set(\"pageDetailPageInode2\", jsonData.entity.inode);", - " pm.collectionVariables.set(\"pageDetailPageURL2\", jsonData.entity.url);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"contentlet\":{\n\t\t\"stName\": \"htmlpageasset\",\n\t\t\"title\": \"Pag2 {{$timestamp}}\",\n \"url\": \"page2-{{$timestamp}}\",\n \"friendlyName\":\"page2-{{$timestamp}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"100\",\n \"hostFolder\":\"{{pageDetailSiteId}}\"\n\t}\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "PUBLISH" - ] - } - }, - "response": [] - }, + "name": "pre - Import Test Content Types", + "event": [ { - "name": "Create ContentType with page detail id", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Bundle 'bundle-with-content-types-issue-22039.tar.gz' was not uploaded!\", function () {", + " pm.response.to.have.status(200);", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData[\"bundleName\"]).to.eql(\"bundle-with-content-types-issue-22039.tar.gz\");", + " pm.expect(jsonData[\"status\"]).to.eql(\"SUCCESS\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity[0].detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity[0].detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" }, { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"{{pageDetailPageId1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." - }, - "response": [] + ] }, - { - "name": "Get Content Type", - "event": [ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/octet-stream" + }, + { + "key": "Content-Disposition", + "value": "attachment" + } + ], + "body": { + "mode": "formdata", + "formdata": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "file", + "type": "file", + "src": "resources/ContentTypeResource/bundle-with-content-types-issue-22039.tar.gz" } + ] + }, + "url": { + "raw": "{{serverURL}}/api/bundle/sync", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." - }, - "response": [] + "path": [ + "api", + "bundle", + "sync" + ], + "query": [ + { + "key": "AUTH_TOKEN", + "value": "", + "disabled": true + } + ] }, + "description": "Imports a Bundle containing the Content Types that are supposed to exist for the subsequent tests to work as expected." + }, + "response": [] + }, + { + "name": "Get Content Types - First page", + "event": [ { - "name": "Update Content Type with page detail with URI", - "event": [ + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code must be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"The 'Content (Generic)' type must come first!'\", function () {", + " pm.expect(\"Content (Generic)\").to.equal(jsonData.entity[0].name);", + "});", + "", + "pm.test(\"There must be 3 Content Types in the response only!'\", function () {", + " pm.expect(3).to.equal(jsonData.entity.length);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,htmlpageasset,FileAsset\"\n },\n \"page\": 1,\n \"perPage\": 3\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL2}}\",\n \"urlMapPattern\" : \"/{name}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "path": [ + "api", + "v1", + "contenttype", + "_filter" + ] + }, + "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the pagination parameters**." + }, + "response": [] + }, + { + "name": "Get Content Types - Second page", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code must be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"The 'dotAsset' type must come first!'\", function () {", + " pm.expect(\"dotAsset\").to.equal(jsonData.entity[0].name);", + "});", + "", + "pm.test(\"There must be 2 Content Types in the response only!'\", function () {", + " pm.expect(2).to.equal(jsonData.entity.length);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." - }, - "response": [] + ] }, - { - "name": "Update Content Type with page detail id", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\"\n },\n \"page\": 2,\n \"perPage\": 3\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"{{pageDetailPageId1}}\",\n \"urlMapPattern\" : \"/{name}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "_filter" + ] }, + "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the pagination parameters**." + }, + "response": [] + }, + { + "name": "Get Content Types - Not paginated", + "event": [ { - "name": "Get Content Type", - "event": [ + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code must be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"All 5 Content Types in the response only!'\", function () {", + " pm.expect(5).to.equal(jsonData.entity.length);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\"\n }\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "path": [ + "api", + "v1", + "contenttype", + "_filter" + ] + }, + "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **without any pagination parameters.**" + }, + "response": [] + }, + { + "name": "Get Content Types - Filtered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code must be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Only 2 Content Types with the letters 'ent' should be returned!'\", function () {", + " pm.expect(2).to.equal(jsonData.entity.length);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" }, - "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." - }, - "response": [] - }, - { - "name": "Update Content Type with page detail with URI Again", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL2}}\",\n \"urlMapPattern\" : \"/{name}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." - }, - "response": [] + ] }, - { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\",\n \"query\": \"ent\"\n }\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "_filter" + ] }, + "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the specified filter including the letters that might be present in either the Content Type's name or Velocity Var Name.**" + }, + "response": [] + }, + { + "name": "Get Content Types - Filtered Paginated", + "event": [ { - "name": "Update Content Type removing page detail", - "event": [ + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code must be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Only 1 Content Type with the letters 'set' should be returned!'\", function () {", + " pm.expect(1).to.equal(jsonData.entity.length);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData).not.have.property('detailPage');", - " pm.expect(jsonData).not.have.property('detailPagePath');", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\",\n \"query\": \"set\"\n },\n \"page\": 1,\n \"perPage\": 3\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"urlMapPattern\" : \"/{name}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "_filter" + ] }, + "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the specified filter including the letters that might be present in either the Content Type's name or Velocity Var Name.**\n\nIn this case, the second page is being requested." + }, + "response": [] + }, + { + "name": "Get Content Types - All types", + "event": [ { - "name": "Get Content Type", - "event": [ + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code must be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"At least 12 Content Types must be returned, as not filter is set!'\", function () {", + " pm.expect(jsonData.entity.length).to.greaterThan(11)", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData).not.have.property('detailPage');", - " pm.expect(jsonData).not.have.property('detailPagePath');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"orderBy\": \"name\",\n \"direction\": \"ASC\",\n \"perPage\": 40\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "_filter" + ] }, + "description": "Returns the appropriate JSON data with **ALL** the Content Types in the content repo as no filtering parameters were provided." + }, + "response": [] + } + ], + "description": "This Test Collection will verify that the Content Type Filtering Endpoint works as expected. This endpoint can take a list of specific Content Types and perform filtering and pagination operations on them." + }, + { + "name": "Test Accept Site Names and Folder Path", + "item": [ + { + "name": "createFolders Success", + "event": [ { - "name": "Archive Test Page1", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 200\", function () {", + " pm.response.to.have.status(200);", + " let jsonData = pm.response.json();", + " pm.expect(jsonData.entity.length).to.be.above(0); ", + " let folder = jsonData.entity[0];", + " pm.expect(folder.title).eql(\"foo2\");", + " pm.expect(folder.type).eql(\"folder\");", + " pm.expect(folder.path).eql(\"/foo1/foo2/\");", + " pm.collectionVariables.set(\"folder\", folder);", + " pm.collectionVariables.set(\"folder.identifier\", folder.identifier);", + " pm.collectionVariables.set(\"folder.hostId\", folder.hostId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"No errors must be present\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "[\"/foo1/foo2\"]\n", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/folder/createfolders/default", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Origin", - "value": "{{serverURL}}" - } + "path": [ + "api", + "v1", + "folder", + "createfolders", + "default" + ] + } + }, + "response": [] + }, + { + "name": "Create ContentType From Given Host Idenifier and Folder Identifier", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonData = pm.response.json();", + "let contentType = jsonData.entity[0];", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200);", + " let folder = pm.collectionVariables.get(\"folder\");", + " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", + " pm.expect(contentType.folder).to.eql(folder.identifier);", + " pm.expect(contentType.host).to.eql(folder.hostId);", + "})", + "" ], - "body": { - "mode": "raw", - "raw": "{}", - "options": { - "raw": { - "language": "json" - } - } + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/ARCHIVE?inode={{pageDetailPageInode1}}&identifier={{pageDetailPageId1}}&indexPolicy=WAIT_FOR", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "ARCHIVE" - ], - "query": [ - { - "key": "inode", - "value": "{{pageDetailPageInode1}}" - }, - { - "key": "identifier", - "value": "{{pageDetailPageId1}}" - }, - { - "key": "indexPolicy", - "value": "WAIT_FOR" - } - ] + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } - }, - "response": [] + ] }, - { - "name": "Archive Test Page2", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"No errors must be present\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"system\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"CT created using the folderPath property\", \n \"host\":\"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n \"folder\":\"{{folder.identifier}}\",\n \"name\":\"SimpleContentTypeFromFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Origin", - "value": "{{serverURL}}" - } + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Creates a contentType using the folderPath property\n\nExpect success." + }, + "response": [] + }, + { + "name": "Create ContentType From Given Folder Path", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonData = pm.response.json();", + "let contentType = jsonData.entity[0];", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200);", + " let folder = pm.collectionVariables.get(\"folder\");", + " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", + " pm.expect(contentType.folder).to.eql(folder.identifier);", + " pm.expect(contentType.host).to.eql(folder.hostId);", + "})", + "" ], - "body": { - "mode": "raw", - "raw": "{}", - "options": { - "raw": { - "language": "json" - } - } + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/ARCHIVE?inode={{pageDetailPageInode2}}&identifier={{pageDetailPageId2}}&indexPolicy=WAIT_FOR", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "ARCHIVE" - ], - "query": [ - { - "key": "inode", - "value": "{{pageDetailPageInode2}}" - }, - { - "key": "identifier", - "value": "{{pageDetailPageId2}}" - }, - { - "key": "indexPolicy", - "value": "WAIT_FOR" - } - ] + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } - }, - "response": [] + ] }, - { - "name": "Delete Test Page1", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"No errors must be present\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"defaultType\":false,\n \"fixed\":false, \n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"CT created using the folderPath property\", \n \"folderPath\":\"default:/foo1/foo2\",\n \"name\":\"SimpleContentTypeFromFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Origin", - "value": "{{serverURL}}" - } + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Creates a contentType using the folderPath property\n\nExpect success." + }, + "response": [] + }, + { + "name": "Create ContentType From Given Host Name and Folder Path", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonData = pm.response.json();", + "let contentType = jsonData.entity[0];", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200);", + " let folder = pm.collectionVariables.get(\"folder\");", + " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", + " pm.expect(contentType.folder).to.eql(folder.identifier);", + " pm.expect(contentType.host).to.eql(folder.hostId);", + "})", + "" ], - "body": { - "mode": "raw", - "raw": "{}", - "options": { - "raw": { - "language": "json" - } - } + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/DELETE?inode={{pageDetailPageInode1}}&identifier={{pageDetailPageId1}}&indexPolicy=WAIT_FOR", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "DELETE" - ], - "query": [ - { - "key": "inode", - "value": "{{pageDetailPageInode1}}" - }, - { - "key": "identifier", - "value": "{{pageDetailPageId1}}" - }, - { - "key": "indexPolicy", - "value": "WAIT_FOR" - } - ] + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } - }, - "response": [] + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"system\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"Here we're sending host name an the folder path separately\", \n \"host\":\"default\",\n \"folderPath\":\"/foo1/foo2\",\n \"name\":\"SimpleContentTypeUsingHostNameAndFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] }, + "description": "Creates a contentType using a host name and folderPath\n\nHere we're sending host name and the folder path only contains the folders bit without the site name portion" + }, + "response": [] + }, + { + "name": "Create ContentType From Given Host Identifier and Folder Path (no host)", + "event": [ { - "name": "Delete Test Page2", - "event": [ + "listen": "test", + "script": { + "exec": [ + "let jsonData = pm.response.json();", + "let contentType = jsonData.entity[0];", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200);", + " let folder = pm.collectionVariables.get(\"folder\");", + " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", + " pm.expect(contentType.folder).to.eql(folder.identifier);", + " pm.expect(contentType.host).to.eql(folder.hostId);", + "})", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"No errors must be present\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"Here we're sending host name an the folder path separately\", \n \"host\":\"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n \"folderPath\":\"/foo1/foo2\",\n \"name\":\"SimpleContentTypeUsingHostIdAndFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Origin", - "value": "{{serverURL}}" - } + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Creates a contentType using a host name and folderPath\n\nHere we're sending host name and the folder path only contains the folders bit without the site name portion" + }, + "response": [] + }, + { + "name": "Create FIXED ContentType Expect System-Host and System-Folder", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonData = pm.response.json();", + "let contentType = jsonData.entity[0];", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200); ", + " pm.expect(contentType.folderPath).to.eql(\"/\");", + " pm.expect(contentType.folder).to.eql(\"SYSTEM_FOLDER\");", + " pm.expect(contentType.host).to.eql(\"SYSTEM_HOST\");", + "})" ], - "body": { - "mode": "raw", - "raw": "{}", - "options": { - "raw": { - "language": "json" - } - } + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/DELETE?inode={{pageDetailPageInode2}}&identifier={{pageDetailPageId2}}&indexPolicy=WAIT_FOR", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "DELETE" - ], - "query": [ - { - "key": "inode", - "value": "{{pageDetailPageInode2}}" - }, - { - "key": "identifier", - "value": "{{pageDetailPageId2}}" - }, - { - "key": "indexPolicy", - "value": "WAIT_FOR" - } - ] + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } - }, - "response": [] + ] }, - { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Response entity contains 'deleted'\", function () {", - " pm.expect(pm.response.json().entity).to.include(\"deleted\");", - "});", - "", - "pm.test(\"Errors array is empty\", function () {", - " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"defaultType\":false,\n \"fixed\":true, \n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"CT created using the folderPath property\", \n \"folderPath\":\"any:/non-existing-folder\",\n \"name\":\"SimpleContentTypeFromFolderPathNonExistingFolder\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Creates a simple contentType, that uses the folderPath property to set the location" + }, + "response": [] + } + ] + }, + { + "name": "Field Data", + "item": [ + { + "name": "Get All Field Types", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status must be successful\", function() {", + " pm.response.to.have.status(200);", + "});", + "", + "const expectedFieldTypes = pm.collectionVariables.get(\"fieldTypesArr\");", + "", + "pm.test(\"Checking the total number of Field Types\", function () {", + " const fieldTypes = pm.response.json().entity;", + " pm.expect(expectedFieldTypes.length).to.eql(fieldTypes.length, \"There must be exactly \" + expectedFieldTypes.length + \" Field Types in dotCMS\");", + "});", + "", + "pm.test(\"Checking the classes in all Field Types\", function () {", + " const fieldTypes = pm.response.json().entity;", + " fieldTypes.forEach(type => {", + "", + " pm.expect(expectedFieldTypes.includes(type.clazz)).to.equal(true, \"Type '\" + type.clazz + \"' doesn't exist in the official Field Type list\");", + "", + " })", + "});", + "" + ], + "type": "text/javascript" + } }, { - "name": "Archive Site", - "event": [ + "listen": "prerequest", + "script": { + "exec": [ + "const fieldTypesArr = [ ", + " \"com.dotcms.contenttype.model.field.ImmutableBinaryField\",", + " \"com.dotcms.contenttype.model.field.ImmutableStoryBlockField\",", + " \"com.dotcms.contenttype.model.field.ImmutableCategoryField\",", + " \"com.dotcms.contenttype.model.field.ImmutableCheckboxField\",", + " \"com.dotcms.contenttype.model.field.ImmutableConstantField\",", + " \"com.dotcms.contenttype.model.field.ImmutableCustomField\",", + " \"com.dotcms.contenttype.model.field.ImmutableDateField\",", + " \"com.dotcms.contenttype.model.field.ImmutableDateTimeField\",", + " \"com.dotcms.contenttype.model.field.ImmutableFileField\",", + " \"com.dotcms.contenttype.model.field.ImmutableHiddenField\",", + " \"com.dotcms.contenttype.model.field.ImmutableImageField\",", + " \"com.dotcms.contenttype.model.field.ImmutableJSONField\",", + " \"com.dotcms.contenttype.model.field.ImmutableKeyValueField\",", + " \"com.dotcms.contenttype.model.field.ImmutableLineDividerField\",", + " \"com.dotcms.contenttype.model.field.ImmutableMultiSelectField\",", + " \"com.dotcms.contenttype.model.field.ImmutablePermissionTabField\",", + " \"com.dotcms.contenttype.model.field.ImmutableRadioField\",", + " \"com.dotcms.contenttype.model.field.ImmutableRelationshipField\",", + " \"com.dotcms.contenttype.model.field.ImmutableRelationshipsTabField\",", + " \"com.dotcms.contenttype.model.field.ImmutableSelectField\",", + " \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",", + " \"com.dotcms.contenttype.model.field.ImmutableTabDividerField\",", + " \"com.dotcms.contenttype.model.field.ImmutableTagField\",", + " \"com.dotcms.contenttype.model.field.ImmutableTextField\",", + " \"com.dotcms.contenttype.model.field.ImmutableTextAreaField\",", + " \"com.dotcms.contenttype.model.field.ImmutableTimeField\",", + " \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\"", + "];", + "pm.collectionVariables.set(\"fieldTypesArr\", fieldTypesArr);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Entity archived property is true\", function () {", - " var siteId= pm.collectionVariables.get(\"pageDetailSiteId\")", - " pm.expect(pm.response.json().entity.identifier).contains(siteId);", - " pm.expect(pm.response.json().entity.archived).to.be.true;", - "});", - "", - "pm.test(\"Errors array is empty\", function () {", - " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "password", + "value": "admin", + "type": "string" } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/fieldTypes", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/site/{{pageDetailSiteId}}/_archive", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "site", - "{{pageDetailSiteId}}", - "_archive" - ] - } - }, - "response": [] + "path": [ + "api", + "v1", + "fieldTypes" + ] }, + "description": "Verifies that there's a specific number of Field Types in dotCMS, and that they all match one of the expected Field Types." + }, + "response": [] + }, + { + "name": "Site or Folder Field with No Searchable Option", + "event": [ { - "name": "Delete Site", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status must be successful\", function() {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that 'Searchable' option in 'Site or Folder' field is NOT present anymore\", function () {", + " const fieldTypes = pm.response.json().entity;", + " var isPropertyPresent = false;", + " fieldTypes.forEach(type => {", + "", + " if (\"com.dotcms.contenttype.model.field.ImmutableHostFolderField\" === type.clazz && type.properties.includes(\"searchable\")) {", + " isPropertyPresent = true;", + " }", + "", + " });", + " if (isPropertyPresent) {", + " pm.expect(false).to.equal(isPropertyPresent, \"The 'searchable' property must not be present for 'Site or Folder' fields\");", + " }", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Errors array is empty\", function () {", - " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "password", + "value": "admin", + "type": "string" } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/fieldTypes", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/site/{{pageDetailSiteId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "site", - "{{pageDetailSiteId}}" - ] + "path": [ + "api", + "v1", + "fieldTypes" + ] + } + }, + "response": [] + } + ], + "description": "Verifies that operations related to retrieving data from fields in Content Types are aworking as expected." + }, + { + "name": "Test delete publish/expire field", + "item": [ + { + "name": "Create ContentType with publish/expire fields", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.collectionVariables.set(\"contentTypeID\", jsonData.entity[0].id);", + "pm.collectionVariables.set(\"contentTypeVAR\", jsonData.entity[0].variable);", + "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[0].id);", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"icon check\", function () {", + " pm.expect(jsonData.entity[0].icon).to.eql('testIcon');", + "});", + "", + "pm.test(\"Fields check\", function () {", + " pm.expect(jsonData.entity[0].fields.length).to.gte(2);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } - }, - "response": [] - } - ], - "description": "The `detailPage` attribute supports id and URI for updates, these tests validate both cases are working as expected.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test dates content {{$randomBankAccount}}\",\n\t\"variable\": \"testDatesContent{{$randomBankAccount}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"testIcon\",\n \"sortOrder\": 3,\n \"publishDateVar\": \"publishDate\",\n \"expireDateVar\": \"expireDate\",\n\t\"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableDateTimeField\",\n \"dataType\": \"DATE\",\n \"fieldType\": \"Date-and-Time\",\n \"fieldTypeLabel\": \"Date and Time\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Publish Date\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"publishDate\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableDateTimeField\",\n \"dataType\": \"DATE\",\n \"fieldType\": \"Date-and-Time\",\n \"fieldTypeLabel\": \"Date and Time\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"iDate\": 1685054935000,\n \"indexed\": true,\n \"listed\": true,\n \"modDate\": 1685054935000,\n \"name\": \"Expire Date\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"expireDate\"\n }\n\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] }, + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." + }, + "response": [] + }, + { + "name": "Delete dateTime field", + "event": [ { "listen": "test", "script": { - "type": "text/javascript", - "packages": {}, "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", "});" - ] + ], + "type": "text/javascript" } } - ] - }, - { - "name": "Test create content type with detailPage as URI", - "item": [ - { - "name": "Create Test Site", - "event": [ + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Storing page data for subsequent tests\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"pageDetailSiteId\", jsonData.entity.identifier);", - " pm.collectionVariables.set(\"pageDetailSiteName\", jsonData.entity.siteName);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"siteName\":\"page.detail.host.com.{{$timestamp}}\",\n \"variables\":[]\n}\n", - "options": { - "raw": { - "language": "json" - } - } + "key": "password", + "value": "admin", + "type": "string" }, - "url": { - "raw": "{{serverURL}}/api/v1/site", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "site" - ] - } - }, - "response": [] - }, - { - "name": "Create test Page", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Storing page id and path for subsequent tests\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"pageDetailPageId1\", jsonData.entity.identifier);", - " pm.collectionVariables.set(\"pageDetailPageInode1\", jsonData.entity.inode);", - " pm.collectionVariables.set(\"pageDetailPageURL1\", jsonData.entity.url);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"contentlet\":{\n\t\t\"stName\": \"htmlpageasset\",\n\t\t\"title\": \"Page1 {{$timestamp}}\",\n \"url\": \"page1-{{$timestamp}}\",\n \"friendlyName\":\"page1-{{$timestamp}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"100\",\n \"hostFolder\":\"{{pageDetailSiteId}}\"\n\t}\n}", - "options": { - "raw": { - "language": "json" - } - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "PUBLISH" - ] - } - }, - "response": [] - }, - { - "name": "Create ContentType with page detail as URI", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity[0].detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity[0].detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "saveHelperData", + "type": "any" }, { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "{\"fieldsID\": [\"{{contentTypeFieldID}}\"]}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeID}}/fields", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." - }, - "response": [] + "path": [ + "api", + "v3", + "contenttype", + "{{contentTypeID}}", + "fields" + ] }, + "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." + }, + "response": [] + } + ] + }, + { + "name": "Get Types from one or more Sites", + "item": [ + { + "name": "(Legacy) Types from System Host", + "event": [ { - "name": "Try to create a page detail with non existing URI", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that there at least 10 Content Types living under System Host\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(10, \"There MUST be at least 10 Content Types living in System Host -- unless some were added/removed\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(10, \"The 'totalEntries' parameter must be at least 10\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});", - "", - "pm.test(\"Correct response message\", function () {", - " pm.expect(pm.response.json().message).to.include('Missing required information when creating Content Type(s):');", - "});", - "", - "pm.collectionVariables.set(\"skipPreResquest\", false); " - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" }, { - "listen": "prerequest", - "script": { - "exec": [ - "pm.collectionVariables.set(\"skipPreResquest\", true); " - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?host=SYSTEM_HOST&per_page=40", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}11{{pageDetailPageURL1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "host", + "value": "SYSTEM_HOST" }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." - }, - "response": [] + { + "key": "per_page", + "value": "40" + } + ] }, + "description": "Returns the Content Types living in System Host." + }, + "response": [] + }, + { + "name": "(Legacy) Types from Default site", + "event": [ { - "name": "Try to create ContentType with page detail as URI without credentials", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that there at least 2 Content Types living under the Default Site\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(2, \"There MUST be at least 2 Content Types living in the Default Site\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(10, \"The 'perPage' parameter must be 10\");", + " pm.expect(pagination.totalEntries).to.be.gte(2, \"The 'totalEntries' parameter must be at least 2\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response content type is text/plain\", function () {", - " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"text/plain\");", - "});", - "", - "pm.test(\"Check if the response is invalid\", function () {", - " pm.expect(pm.response.text()).to.include(\"Invalid User\");", - "});", - "", - "", - "pm.collectionVariables.set(\"skipPreResquest\", false);" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" }, { - "listen": "prerequest", - "script": { - "exec": [ - "pm.sendRequest({", - " url: pm.environment.get(\"serverURL\") + \"/api/v1/logout\",", - " method: 'GET'", - "}, function (err, res) {", - " if (err) {", - " console.log('Logout failed:', err);", - " } else {", - " console.log('Logout successful, cookies should be cleared.');", - " }", - "});", - "", - "pm.collectionVariables.set(\"skipPreResquest\", true);" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?host=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d", + "host": [ + "{{serverURL}}" ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "host", + "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d" + } + ] + }, + "description": "Returns all the Content Types living in the Default site." + }, + "response": [] + }, + { + "name": "Get Types from System Host", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that there are at least 10 Content Types living under the System Host\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(10, \"There MUST be at least 10 Content Types living in System Host -- unless some were added/removed\");", + "});", + "", + "pm.test(\"Checking that there is no Content Type from another Site\", function () {", + " const entity = pm.response.json().entity;", + " const typeFromDefaultSite = entity.find(type => type.host !== 'SYSTEM_HOST');", + " pm.expect(typeFromDefaultSite).equals(undefined, \"There must be no Content Types from sites other than System Host\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(10, \"The 'totalEntries' parameter must be at least 10\");", + "});", + "" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?sites=SYSTEM_HOST&per_page=40", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "SYSTEM_HOST" }, - "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." - }, - "response": [] + { + "key": "per_page", + "value": "40" + } + ] }, + "description": "Returns all the Content Types living in the Default site, using the new query string parameter." + }, + "response": [] + }, + { + "name": "Get Types from Default site", + "event": [ { - "name": "Update Content Type removing page detail", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that there are at least 2 Content Types living under the Default site\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(2, \"There MUST be at least 2 Content Types living in the Default site\");", + "});", + "", + "pm.test(\"Checking that there is no Content Type from another Site\", function () {", + " const entity = pm.response.json().entity;", + " const typeFromDefaultSite = entity.find(type => type.host !== '8a7d5e23-da1e-420a-b4f0-471e7da8ea2d');", + " pm.expect(typeFromDefaultSite).equals(undefined, \"There must be no Content Types from sites other than Default\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(2, \"The 'totalEntries' parameter must be at least 2\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData).not.have.property('detailPage');", - " pm.expect(jsonData).not.have.property('detailPagePath');", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "password", + "value": "admin", + "type": "string" } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?sites=default&per_page=40", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"urlMapPattern\" : \"/{name}\"\n}", - "options": { - "raw": { - "language": "json" - } - } + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "default" }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + { + "key": "per_page", + "value": "40" + } + ] + }, + "description": "Returns all the Content Types living in the Default site, using the new query string parameter, and passing down the Site Key." + }, + "response": [] + }, + { + "name": "Get Types from Default Site (ID) and System Host", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that there are at least 12 Content Types living under the Default and System Host sites\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(12, \"There MUST be at least 12 Content Types living in the Default and System Host sites -- unless some were added/removed\");", + "});", + "", + "pm.test(\"Checking that there is at least 1 Content Type from the Default Site\", function () {", + " const entity = pm.response.json().entity;", + " const typeFromDefaultSite = entity.find(type => type.host === '8a7d5e23-da1e-420a-b4f0-471e7da8ea2d');", + " pm.expect(typeFromDefaultSite).to.not.equal(undefined, \"There MUST be at least one Content Type from the Default Site\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(12, \"The 'totalEntries' parameter must be at least 12\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." - }, - "response": [] + { + "key": "password", + "value": "admin", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?sites=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d,SYSTEM_HOST&per_page=40", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d,SYSTEM_HOST" + }, + { + "key": "per_page", + "value": "40" + } + ] }, + "description": "Returns all the Content Types living in both the Default and System Host sites, using the IDs." + }, + "response": [] + }, + { + "name": "Get Types from Default Site (Site Key) and System Host Copy", + "event": [ { - "name": "Get Content Type", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that there are at least 12 Content Types living under the Default and System Host sites\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(12, \"There MUST be at least 12 Content Types living in the Default and System Host sites -- unless some were added/removed\");", + "});", + "", + "pm.test(\"Checking that there is at least 1 Content Type from the Default Site\", function () {", + " const entity = pm.response.json().entity;", + " const typeFromDefaultSite = entity.find(type => type.host === '8a7d5e23-da1e-420a-b4f0-471e7da8ea2d');", + " pm.expect(typeFromDefaultSite).to.not.equal(undefined, \"There MUST be at least one Content Type from the Default Site\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(12, \"The 'totalEntries' parameter must be at least 12\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData).not.have.property('detailPage');", - " pm.expect(jsonData).not.have.property('detailPagePath');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "password", + "value": "admin", + "type": "string" } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?sites=default,SYSTEM_HOST&per_page=40", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "default,SYSTEM_HOST" }, - "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." - }, - "response": [] + { + "key": "per_page", + "value": "40" + } + ] }, + "description": "Returns all the Content Types living in both the Default and System Host sites, using the Site Key." + }, + "response": [] + }, + { + "name": "Get Types from non-existing Site", + "event": [ { - "name": "Archive Test Page", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that no Content Types are returned\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).equals(0, \"There must be no Content Types in the results\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).equals(0, \"The 'totalEntries' parameter must be zero\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"No errors must be present\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "password", + "value": "admin", + "type": "string" } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?sites=non-existing-site&per_page=40", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Origin", - "value": "{{serverURL}}" - } - ], - "body": { - "mode": "raw", - "raw": "{}", - "options": { - "raw": { - "language": "json" - } - } + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "non-existing-site" }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/ARCHIVE?inode={{pageDetailPageInode1}}&identifier={{pageDetailPageId1}}&indexPolicy=WAIT_FOR", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "ARCHIVE" - ], - "query": [ - { - "key": "inode", - "value": "{{pageDetailPageInode1}}" - }, - { - "key": "identifier", - "value": "{{pageDetailPageId1}}" - }, - { - "key": "indexPolicy", - "value": "WAIT_FOR" - } - ] + { + "key": "per_page", + "value": "40" } - }, - "response": [] + ] }, + "description": "Returns all the Content Types living in the non-existing site, which must return an empty list." + }, + "response": [] + }, + { + "name": "Get Types from non-existing Site (ID) and System Host", + "event": [ { - "name": "Delete Test Page", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that there are at least 10 Content Types living under the Default and System Host sites\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(10, \"There MUST be at least 10 Content Types living in System Host -- unless some were added/removed\");", + "});", + "", + "pm.test(\"Checking that all Content Types come from System Host only\", function () {", + " const entity = pm.response.json().entity;", + " const typeFromDefaultSite = entity.find(type => type.host === '12312312-abcd-1234-dcba-456456456456');", + " pm.expect(typeFromDefaultSite).equals(undefined, \"All Content Types must come from System Host only\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(10, \"The 'totalEntries' parameter must be at least 10\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"No errors must be present\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "password", + "value": "admin", + "type": "string" } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?sites=12312312-abcd-1234-dcba-456456456456,SYSTEM_HOST&per_page=40", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Origin", - "value": "{{serverURL}}" - } - ], - "body": { - "mode": "raw", - "raw": "{}", - "options": { - "raw": { - "language": "json" - } - } + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "12312312-abcd-1234-dcba-456456456456,SYSTEM_HOST" }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/DELETE?inode={{pageDetailPageInode1}}&identifier={{pageDetailPageId1}}&indexPolicy=WAIT_FOR", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "DELETE" - ], - "query": [ - { - "key": "inode", - "value": "{{pageDetailPageInode1}}" - }, - { - "key": "identifier", - "value": "{{pageDetailPageId1}}" - }, - { - "key": "indexPolicy", - "value": "WAIT_FOR" - } - ] + { + "key": "per_page", + "value": "40" } - }, - "response": [] + ] }, + "description": "Returns all the Content Types living in a non-existing site and System Host, which must return only the types living in System Host." + }, + "response": [] + }, + { + "name": "Get Types from non-existing Site (ID) and Default site", + "event": [ { - "name": "Delete ContentType", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that there are at least 2 Content Types living under the Default site\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(2, \"There MUST be at least 2 Content Types living in the Default site\");", + "});", + "", + "pm.test(\"Checking that all Content Types come from the Default site only\", function () {", + " const entity = pm.response.json().entity;", + " const typeFromDefaultSite = entity.find(type => type.host === '12312312-abcd-1234-dcba-456456456456');", + " pm.expect(typeFromDefaultSite).equals(undefined, \"All Content Types must come from the Default site only\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(2, \"The 'totalEntries' parameter must be at least 2\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "password", + "value": "admin", + "type": "string" } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?sites=invalid-site,default&per_page=40", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "invalid-site,default" }, - "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." - }, - "response": [] + { + "key": "per_page", + "value": "40" + } + ] }, + "description": "Returns all the Content Types living in a non-existing site and the Defaut site, which must return only the types living in the Default site." + }, + "response": [] + } + ], + "description": "These requests allow you to verify that dotCMS can retrieve a filtered paginated list of Content Types from a specific list of Sites only, and not from the whole repository. You can use both the Site's Identifier, or its Key -- aka, Site Name.\n\nThis suite is testing both the existing per-Site Endpoint -- flagged with **`(Legacy)`** -- and the new multi-site parameter." + }, + { + "name": "Test detail page", + "item": [ + { + "name": "Test update detail page with id and URI", + "item": [ { - "name": "Archive Site", + "name": "Create Test Site", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Entity archived property is true\", function () {", - " var siteId= pm.collectionVariables.get(\"pageDetailSiteId\")", - " pm.expect(pm.response.json().entity.identifier).contains(siteId);", - " pm.expect(pm.response.json().entity.archived).to.be.true;", - "});", - "", - "pm.test(\"Errors array is empty\", function () {", - " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", + "pm.test(\"Storing page data for subsequent tests\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"pageDetailSiteId\", jsonData.entity.identifier);", + " pm.collectionVariables.set(\"pageDetailSiteName\", jsonData.entity.siteName);", "});", "" ], @@ -7388,33 +4717,43 @@ } ], "request": { - "method": "PUT", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"siteName\":\"page.detail.host.com.{{$timestamp}}\",\n \"variables\":[]\n}\n", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/site/{{pageDetailSiteId}}/_archive", + "raw": "{{serverURL}}/api/v1/site", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "site", - "{{pageDetailSiteId}}", - "_archive" + "site" ] } }, "response": [] }, { - "name": "Delete Site", + "name": "Create test Page1", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Errors array is empty\", function () {", - " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", + "pm.test(\"Storing page id and path for subsequent tests\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"pageDetailPageId1\", jsonData.entity.identifier);", + " pm.collectionVariables.set(\"pageDetailPageInode1\", jsonData.entity.inode);", + " pm.collectionVariables.set(\"pageDetailPageURL1\", jsonData.entity.url);", "});" ], "type": "text/javascript", @@ -7423,1747 +4762,1680 @@ } ], "request": { - "method": "DELETE", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"contentlet\":{\n\t\t\"stName\": \"htmlpageasset\",\n\t\t\"title\": \"Page1 {{$timestamp}}\",\n \"url\": \"page1-{{$timestamp}}\",\n \"friendlyName\":\"page1-{{$timestamp}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"100\",\n \"hostFolder\":\"{{pageDetailSiteId}}\"\n\t}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/site/{{pageDetailSiteId}}", + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "site", - "{{pageDetailSiteId}}" + "workflow", + "actions", + "default", + "fire", + "PUBLISH" ] } }, "response": [] - } - ], - "description": "The `detailPage` attribute supports id and URI for updates, these tests validate both cases are working as expected.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } }, { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "skipPreResquest = pm.collectionVariables.get(\"skipPreResquest\");", - "", - "if (!skipPreResquest){", - " pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - " });", - "}" - ] - } - } - ] - } - ], - "description": "when specifying a detail page for a url mapped page, a user should be able to specify a path and not rely on an id, e.g. //demo.dotcms.com/blogs/detail-page", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Test don't relying on id", - "item": [ - { - "name": "Content Type", - "item": [ - { - "name": "Creation without id", - "item": [ + "name": "Create test Page2", + "event": [ { - "name": "Create ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Storing page id and path for subsequent tests\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"pageDetailPageId2\", jsonData.entity.identifier);", + " pm.collectionVariables.set(\"pageDetailPageInode2\", jsonData.entity.inode);", + " pm.collectionVariables.set(\"pageDetailPageURL2\", jsonData.entity.url);", + "});" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a content type without a content type id in the body." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"contentlet\":{\n\t\t\"stName\": \"htmlpageasset\",\n\t\t\"title\": \"Pag2 {{$timestamp}}\",\n \"url\": \"page2-{{$timestamp}}\",\n \"friendlyName\":\"page2-{{$timestamp}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"100\",\n \"hostFolder\":\"{{pageDetailSiteId}}\"\n\t}\n}", + "options": { + "raw": { + "language": "json" } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Searched for a content type by id validating the content type was created." - }, - "response": [] + } }, - { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Cleanup" - }, - "response": [] + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] } - ], - "description": "This test tries to create a content type without provide a content type id in the body, this is the most common escenario creating a content type." + }, + "response": [] }, { - "name": "Creation with non existing id", - "item": [ + "name": "Create ContentType with page detail id", + "event": [ { - "name": "Create ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity[0].detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity[0].detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"123ec8e74bc0fd62172507{{$timestamp}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a content type using in the body a non existing content type id." - }, - "response": [] + "type": "text/javascript", + "packages": {} + } }, { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"{{pageDetailPageId1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Searched for a content type by id validating the content type was created." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype" + ] }, + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Cleanup" - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." + }, + "response": [] + }, + { + "name": "Update Content Type with page detail with URI", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});" + ], + "type": "text/javascript", + "packages": {} + } } ], - "description": "This test creates a content type with a not existing id in the body" + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL2}}\",\n \"urlMapPattern\" : \"/{name}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." + }, + "response": [] }, { - "name": "Multiple update permutations", - "item": [ + "name": "Get Content Type", + "event": [ { - "name": "Create ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[2].id);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});", + "" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Simple content type creation to set up the test data." - }, - "response": [] + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." + }, + "response": [] + }, + { + "name": "Update Content Type with page detail id", + "event": [ { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"{{pageDetailPageId1}}\",\n \"urlMapPattern\" : \"/{name}\"\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Searched for a content type by id validating the content type was created." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ { - "name": "Update Content Type without id in body and variable in body but existing id in path param", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type without an id and variable in the body but with a valid content type id as path param." - }, - "response": [] + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." + }, + "response": [] + }, + { + "name": "Update Content Type with page detail with URI Again", + "event": [ { - "name": "Update Content Type without id in body and variable in body but existing variable in path param", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL2}}\",\n \"urlMapPattern\" : \"/{name}\"\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeVariable}}" - ] - }, - "description": "Updates a content type without an id and variable in the body but with a valid content type id as path param." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ { - "name": "Update Content Type without id in body and variable in body and non existing id in path param", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 404 Not found\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "does-not-exist" - ] - }, - "description": "Updates a content type without an id and variable in the body and without a valid content type id as path param." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." + }, + "response": [] + }, + { + "name": "Update Content Type removing page detail", + "event": [ { - "name": "Update Content Type with existing ids", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData).not.have.property('detailPage');", + " pm.expect(jsonData).not.have.property('detailPagePath');", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"urlMapPattern\" : \"/{name}\"\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type with valid ids and variable name." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ { - "name": "Update Content Type with existing id and variable in body but non existing id in path param", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData).not.have.property('detailPage');", + " pm.expect(jsonData).not.have.property('detailPagePath');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "does-not-exist" - ] - }, - "description": "Updates a content type resolving the content type using the data in the body as the path param id does not exist." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." + }, + "response": [] + }, + { + "name": "Archive Test Page1", + "event": [ { - "name": "Update Content Type with no existing id in body and not existing id in path param", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"No errors must be present\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Origin", + "value": "{{serverURL}}" + } + ], + "body": { + "mode": "raw", + "raw": "{}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/ARCHIVE?inode={{pageDetailPageInode1}}&identifier={{pageDetailPageId1}}&indexPolicy=WAIT_FOR", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"does-not-exist\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "ARCHIVE" + ], + "query": [ + { + "key": "inode", + "value": "{{pageDetailPageInode1}}" }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "does-not-exist" - ] + { + "key": "identifier", + "value": "{{pageDetailPageId1}}" }, - "description": "Updates a content type resolving the content type using the id and variable in the body as the path param id does not exist. \nIn this test the id does not exist but the variable does." - }, - "response": [] - }, + { + "key": "indexPolicy", + "value": "WAIT_FOR" + } + ] + } + }, + "response": [] + }, + { + "name": "Archive Test Page2", + "event": [ { - "name": "Update Content Type without id in body and not existing id in path param", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"No errors must be present\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Origin", + "value": "{{serverURL}}" + } + ], + "body": { + "mode": "raw", + "raw": "{}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/ARCHIVE?inode={{pageDetailPageInode2}}&identifier={{pageDetailPageId2}}&indexPolicy=WAIT_FOR", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "ARCHIVE" + ], + "query": [ + { + "key": "inode", + "value": "{{pageDetailPageInode2}}" }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "does-not-exist" - ] + { + "key": "identifier", + "value": "{{pageDetailPageId2}}" }, - "description": "Updates a content type resolving the content type using variable in the body as the path param id does not exist. \nIn this test the id in the body is not set, so the variable should be used." - }, - "response": [] - }, - { - "name": "Update Content Type with not existing variable", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "indexPolicy", + "value": "WAIT_FOR" + } + ] + } + }, + "response": [] + }, + { + "name": "Delete Test Page1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"No errors must be present\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Origin", + "value": "{{serverURL}}" + } + ], + "body": { + "mode": "raw", + "raw": "{}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/DELETE?inode={{pageDetailPageInode1}}&identifier={{pageDetailPageId1}}&indexPolicy=WAIT_FOR", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"doesnotexist\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "DELETE" + ], + "query": [ + { + "key": "inode", + "value": "{{pageDetailPageInode1}}" }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "does-not-exist" - ] + { + "key": "identifier", + "value": "{{pageDetailPageId1}}" }, - "description": "Updates a content type resolving the content type using the id and variable in the body as the path param id does not exist. \nIn this test the variable in the body does not exist." - }, - "response": [] - }, - { - "name": "Update Content Type with not existing id and variable and path param", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "indexPolicy", + "value": "WAIT_FOR" + } + ] + } + }, + "response": [] + }, + { + "name": "Delete Test Page2", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"No errors must be present\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Origin", + "value": "{{serverURL}}" + } + ], + "body": { + "mode": "raw", + "raw": "{}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/DELETE?inode={{pageDetailPageInode2}}&identifier={{pageDetailPageId2}}&indexPolicy=WAIT_FOR", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"does-not-exist\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"doesnotexist\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "DELETE" + ], + "query": [ + { + "key": "inode", + "value": "{{pageDetailPageInode2}}" }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "does-not-exist" - ] + { + "key": "identifier", + "value": "{{pageDetailPageId2}}" }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." - }, - "response": [] - }, - { - "name": "Delete ContentType", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "indexPolicy", + "value": "WAIT_FOR" } + ] + } + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Response entity contains 'deleted'\", function () {", + " pm.expect(pm.response.json().entity).to.include(\"deleted\");", + "});", + "", + "pm.test(\"Errors array is empty\", function () {", + " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Cleanup" - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." + }, + "response": [] + }, + { + "name": "Archive Site", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Entity archived property is true\", function () {", + " var siteId= pm.collectionVariables.get(\"pageDetailSiteId\")", + " pm.expect(pm.response.json().entity.identifier).contains(siteId);", + " pm.expect(pm.response.json().entity.archived).to.be.true;", + "});", + "", + "pm.test(\"Errors array is empty\", function () {", + " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/site/{{pageDetailSiteId}}/_archive", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "site", + "{{pageDetailSiteId}}", + "_archive" + ] + } + }, + "response": [] + }, + { + "name": "Delete Site", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Errors array is empty\", function () {", + " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/site/{{pageDetailSiteId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "site", + "{{pageDetailSiteId}}" + ] + } + }, + "response": [] + } + ], + "description": "The `detailPage` attribute supports id and URI for updates, these tests validate both cases are working as expected.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] + }, + { + "name": "Test create content type with detailPage as URI", + "item": [ + { + "name": "Create Test Site", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Storing page data for subsequent tests\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"pageDetailSiteId\", jsonData.entity.identifier);", + " pm.collectionVariables.set(\"pageDetailSiteName\", jsonData.entity.siteName);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } ], - "description": "On this set of tests we are going to test multiple updates permutations." - } - ], - "description": "In this folder we test different scenarios for handling the Content Type where we validate cases in order to not always rely on the Content Type ID." - }, - { - "name": "Fields", - "item": [ - { - "name": "Creation without id", - "item": [ - { - "name": "Create ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a content type and field without a field id or content type id in the field." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"siteName\":\"page.detail.host.com.{{$timestamp}}\",\n \"variables\":[]\n}\n", + "options": { + "raw": { + "language": "json" } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Validates the content type and field were created as expected." - }, - "response": [] + } }, - { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "url": { + "raw": "{{serverURL}}/api/v1/site", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Cleanup." - }, - "response": [] + "path": [ + "api", + "v1", + "site" + ] } - ], - "description": "This test tries to create a content type and field without provide a field ID in the body, this is the most common escenario creating a content type." + }, + "response": [] }, { - "name": "Creation with non existing id", - "item": [ + "name": "Create test Page", + "event": [ { - "name": "Create ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[2].id);", - " pm.collectionVariables.set(\"contentTypeField1Variable\", jsonData.entity[0].fields[2].variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Storing page id and path for subsequent tests\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"pageDetailPageId1\", jsonData.entity.identifier);", + " pm.collectionVariables.set(\"pageDetailPageInode1\", jsonData.entity.inode);", + " pm.collectionVariables.set(\"pageDetailPageURL1\", jsonData.entity.url);", + "});" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"123ec8e74bc0fd62172507{{$timestamp}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a field using a non existing field id." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"contentlet\":{\n\t\t\"stName\": \"htmlpageasset\",\n\t\t\"title\": \"Page1 {{$timestamp}}\",\n \"url\": \"page1-{{$timestamp}}\",\n \"friendlyName\":\"page1-{{$timestamp}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"100\",\n \"hostFolder\":\"{{pageDetailSiteId}}\"\n\t}\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Validates the content type and field were created as expected." - }, - "response": [] + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] + } + }, + "response": [] + }, + { + "name": "Create ContentType with page detail as URI", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity[0].detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity[0].detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});" + ], + "type": "text/javascript", + "packages": {} + } }, { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Cleanup" - }, - "response": [] + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } } ], - "description": "This test creates the Content Type with a field with a not existing field id in the body." + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." + }, + "response": [] }, { - "name": "Multiple update permutations", - "item": [ + "name": "Try to create a page detail with non existing URI", + "event": [ { - "name": "Create ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[2].id);", - " pm.collectionVariables.set(\"contentTypeField1Variable\", jsonData.entity[0].fields[2].variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Correct response message\", function () {", + " pm.expect(pm.response.json().message).to.include('Missing required information when creating Content Type(s):');", + "});", + "", + "pm.collectionVariables.set(\"skipPreResquest\", false); " ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Simple creation to sep up the data for the update tests." - }, - "response": [] + "type": "text/javascript", + "packages": {} + } }, { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Validates the content type and field were created as expected." - }, - "response": [] + "listen": "prerequest", + "script": { + "exec": [ + "pm.collectionVariables.set(\"skipPreResquest\", true); " + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}11{{pageDetailPageURL1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, - { - "name": "Update field with no variable name", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates the field with no variable name." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype" + ] }, + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." + }, + "response": [] + }, + { + "name": "Try to create ContentType with page detail as URI without credentials", + "event": [ { - "name": "Update field with no content type id", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", - " pm.expect(jsonData.entity.fields[2].contentTypeId).to.eql(contentTypeId);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates the fields with no content type id in the fields." - }, - "response": [] + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response content type is text/plain\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"text/plain\");", + "});", + "", + "pm.test(\"Check if the response is invalid\", function () {", + " pm.expect(pm.response.text()).to.include(\"Invalid User\");", + "});", + "", + "", + "pm.collectionVariables.set(\"skipPreResquest\", false);" + ], + "type": "text/javascript", + "packages": {} + } }, { - "name": "Update field with content type id", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({", + " url: pm.environment.get(\"serverURL\") + \"/api/v1/logout\",", + " method: 'GET'", + "}, function (err, res) {", + " if (err) {", + " console.log('Logout failed:', err);", + " } else {", + " console.log('Logout successful, cookies should be cleared.');", + " }", + "});", + "", + "pm.collectionVariables.set(\"skipPreResquest\", true);" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates the fields with the content type id in the fields." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." + }, + "response": [] + }, + { + "name": "Update Content Type removing page detail", + "event": [ { - "name": "Update field with existing id", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData).not.have.property('detailPage');", + " pm.expect(jsonData).not.have.property('detailPagePath');", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"urlMapPattern\" : \"/{name}\"\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a field using an existing field id." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ { - "name": "Update field with no existing id", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData).not.have.property('detailPage');", + " pm.expect(jsonData).not.have.property('detailPagePath');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"does-not-exist\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeVariable}}" - ] - }, - "description": "Updates the field with a non existing field id but existing field variable name." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." + }, + "response": [] + }, + { + "name": "Archive Test Page", + "event": [ { - "name": "Update field without id", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"No errors must be present\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Origin", + "value": "{{serverURL}}" + } + ], + "body": { + "mode": "raw", + "raw": "{}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/ARCHIVE?inode={{pageDetailPageInode1}}&identifier={{pageDetailPageId1}}&indexPolicy=WAIT_FOR", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "ARCHIVE" + ], + "query": [ + { + "key": "inode", + "value": "{{pageDetailPageInode1}}" }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeVariable}}" - ] + { + "key": "identifier", + "value": "{{pageDetailPageId1}}" }, - "description": "Updates a field without a field id in the body but with a valid variable name." - }, - "response": [] - }, - { - "name": "Update field without id and variable", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "indexPolicy", + "value": "WAIT_FOR" + } + ] + } + }, + "response": [] + }, + { + "name": "Delete Test Page", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"No errors must be present\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Origin", + "value": "{{serverURL}}" + } + ], + "body": { + "mode": "raw", + "raw": "{}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/DELETE?inode={{pageDetailPageInode1}}&identifier={{pageDetailPageId1}}&indexPolicy=WAIT_FOR", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "DELETE" + ], + "query": [ + { + "key": "inode", + "value": "{{pageDetailPageInode1}}" }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeVariable}}" - ] + { + "key": "identifier", + "value": "{{pageDetailPageId1}}" }, - "description": "Updates a content type with a field without a field id and field variable in the body, as there is not data to use to identify the field, a new field will be created." - }, - "response": [] - }, - { - "name": "Delete ContentType", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "indexPolicy", + "value": "WAIT_FOR" } + ] + } + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." + }, + "response": [] + }, + { + "name": "Archive Site", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Entity archived property is true\", function () {", + " var siteId= pm.collectionVariables.get(\"pageDetailSiteId\")", + " pm.expect(pm.response.json().entity.identifier).contains(siteId);", + " pm.expect(pm.response.json().entity.archived).to.be.true;", + "});", + "", + "pm.test(\"Errors array is empty\", function () {", + " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/site/{{pageDetailSiteId}}/_archive", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "site", + "{{pageDetailSiteId}}", + "_archive" + ] + } + }, + "response": [] + }, + { + "name": "Delete Site", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Errors array is empty\", function () {", + " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/site/{{pageDetailSiteId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Cleanup" - }, - "response": [] + "path": [ + "api", + "v1", + "site", + "{{pageDetailSiteId}}" + ] } - ] + }, + "response": [] } ], - "description": "In this folder we test different scenarios for handling the Content Type fields where we validate cases in order to not always rely on the Content Type field ID." + "description": "The `detailPage` attribute supports id and URI for updates, these tests validate both cases are working as expected.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "skipPreResquest = pm.collectionVariables.get(\"skipPreResquest\");", + "", + "if (!skipPreResquest){", + " pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + " });", + "}" + ] + } + } + ] } ], - "description": "When saving content type and fields, we don't need to rely entirely on ids, if the id does not exist or is not provided, we should use variables as the key.", + "description": "when specifying a detail page for a url mapped page, a user should be able to specify a path and not rely on an id, e.g. //demo.dotcms.com/blogs/detail-page", "event": [ { "listen": "prerequest", @@ -9188,68 +6460,16 @@ ] }, { - "name": "Test Workflows", + "name": "Test don't relying on id", "item": [ { - "name": "Simple workflows array", + "name": "Content Type", "item": [ { - "name": "Creation", + "name": "Creation without id", "item": [ { - "name": "Create Scheme", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200 \", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing workflow data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"schemeId\", jsonData.entity.id);", - " pm.collectionVariables.set(\"schemeName\", jsonData.entity.name);", - " pm.collectionVariables.set(\"schemeVariableName\", jsonData.entity.variableName);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\"schemeName\": \"Test Schema {{$timestamp}}\", \"schemeDescription\": \"Test sechema\", \"schemeArchived\": \"false\"}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "schemes" - ] - }, - "description": "Creates a new test scheme" - }, - "response": [] - }, - { - "name": "Create ContentType with workflow id", + "name": "Create ContentType", "event": [ { "listen": "test", @@ -9259,19 +6479,10 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing content type data\", function () {", + "pm.test(\"Storing content type id\", function () {", " var jsonData = pm.response.json();", " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -9289,7 +6500,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, "url": { "raw": "{{serverURL}}/api/v1/contenttype", @@ -9302,7 +6513,7 @@ "contenttype" ] }, - "description": "Creates a content type using a workflow id." + "description": "Creates a content type without a content type id in the body." }, "response": [] }, @@ -9317,15 +6528,6 @@ "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -9344,104 +6546,12 @@ "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - } - }, - "response": [] - }, - { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - } - }, - "response": [] - }, - { - "name": "Create ContentType with workflow variable name", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeId}}" ] }, - "description": "Creates a content type using a workflow variable name." + "description": "Searched for a content type by id validating the content type was created." }, "response": [] }, @@ -9476,12 +6586,19 @@ "id", "{{contentTypeId}}" ] - } + }, + "description": "Cleanup" }, "response": [] - }, + } + ], + "description": "This test tries to create a content type without provide a content type id in the body, this is the most common escenario creating a content type." + }, + { + "name": "Creation with non existing id", + "item": [ { - "name": "Create ContentType with workflow variable name and id", + "name": "Create ContentType", "event": [ { "listen": "test", @@ -9491,34 +6608,11 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing content type data\", function () {", + "pm.test(\"Storing content type id\", function () {", " var jsonData = pm.response.json();", " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", - " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", - "", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " workflows = workflows.sort(compareBy);", - " pm.expect(2).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - " pm.expect(workflows[1].id).to.eql(testSchemeId);", - " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", - "});", - "", - "function compareBy(a, b) {", - " if (a.variableName < b.variableName) { return -1; }", - " if (a.variableName > b.variableName) { return 1; }", - " return 0;", - "}", - "" + "});" ], "type": "text/javascript", "packages": {} @@ -9535,7 +6629,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"{{schemeId}}\",\"systemworkflow\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"123ec8e74bc0fd62172507{{$timestamp}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, "url": { "raw": "{{serverURL}}/api/v1/contenttype", @@ -9548,17 +6642,19 @@ "contenttype" ] }, - "description": "Creates a content type using a workflow id and a workflow variable name." + "description": "Creates a content type using in the body a non existing content type id." }, "response": [] }, { - "name": "Delete ContentType", + "name": "Get Content Type", "event": [ { "listen": "test", "script": { "exec": [ + "var jsonData = pm.response.json();", + "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", "});" @@ -9569,7 +6665,7 @@ } ], "request": { - "method": "DELETE", + "method": "GET", "header": [], "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", @@ -9583,21 +6679,21 @@ "id", "{{contentTypeId}}" ] - } + }, + "description": "Searched for a content type by id validating the content type was created." }, "response": [] }, { - "name": "Create ContentType with wrong workflow #1", + "name": "Delete ContentType", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", - "});", - "" + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], "type": "text/javascript", "packages": {} @@ -9605,43 +6701,48 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"doesNotExist\",\"systemworkflow\"]\n}" - }, + "method": "DELETE", + "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeId}}" ] }, - "description": "Validates the proper error handling when a wrong workflow is used." + "description": "Cleanup" }, "response": [] - }, + } + ], + "description": "This test creates a content type with a not existing id in the body" + }, + { + "name": "Multiple update permutations", + "item": [ { - "name": "Create ContentType with wrong workflow #2", + "name": "Create ContentType", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", "});", - "" + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", + "});" ], "type": "text/javascript", "packages": {} @@ -9658,7 +6759,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"doesNotExist\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, "url": { "raw": "{{serverURL}}/api/v1/contenttype", @@ -9671,18 +6772,20 @@ "contenttype" ] }, - "description": "Validates the proper error handling when a wrong workflow is used." + "description": "Simple content type creation to set up the test data." }, "response": [] }, { - "name": "Archive Scheme", + "name": "Get Content Type", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 200 \", function () {", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", "});" ], @@ -9692,67 +6795,44 @@ } ], "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\"schemeName\": \"{{schemeName}}\", \"schemeArchived\": \"true\"}" - }, + "method": "GET", + "header": [], "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "workflow", - "schemes", - "{{schemeId}}" + "contenttype", + "id", + "{{contentTypeId}}" ] }, - "description": "\n### Update Workflow Scheme\n\nUpdates an existing workflow scheme.\n\n#### Request Body\n- `schemeName` (string, optional): The name of the scheme.\n- `schemeArchived` (boolean, optional): Indicates if the scheme is archived.\n\n#### Response\nThe response for this request is documented as a JSON schema.\n" + "description": "Searched for a content type by id validating the content type was created." }, "response": [] }, { - "name": "Delete Scheme", + "name": "Update Content Type without id in body and variable in body but existing id in path param", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 200 \", function () {", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", "});" ], "type": "text/javascript", @@ -9761,94 +6841,54 @@ } ], "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" } - ] + } }, - "method": "DELETE", - "header": [], "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "workflow", - "schemes", - "{{schemeId}}" + "contenttype", + "id", + "{{contentTypeId}}" ] - } + }, + "description": "Updates a content type without an id and variable in the body but with a valid content type id as path param." }, "response": [] - } - ], - "description": "Covering different save scenarios for saving workflows in a content type.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } }, { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Update", - "item": [ - { - "name": "Create Scheme", + "name": "Update Content Type without id in body and variable in body but existing variable in path param", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 200 \", function () {", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing workflow data\", function () {", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", + "", " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"schemeId\", jsonData.entity.id);", - " pm.collectionVariables.set(\"schemeName\", jsonData.entity.name);", - " pm.collectionVariables.set(\"schemeVariableName\", jsonData.entity.variableName);", - "});", - "" + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", + "});" ], "type": "text/javascript", "packages": {} @@ -9856,58 +6896,43 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\"schemeName\": \"Test Schema {{$timestamp}}\", \"schemeDescription\": \"Test sechema\", \"schemeArchived\": \"false\"}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "workflow", - "schemes" + "contenttype", + "id", + "{{contentTypeVariable}}" ] }, - "description": "Creates a test scheme" + "description": "Updates a content type without an id and variable in the body but with a valid content type id as path param." }, "response": [] }, { - "name": "Create ContentType", + "name": "Update Content Type without id in body and variable in body and non existing id in path param", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[2].id);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "pm.test(\"Status code should be 404 Not found\", function () {", + " pm.response.to.have.status(404);", "});" ], "type": "text/javascript", @@ -9916,52 +6941,53 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "does-not-exist" ] }, - "description": "Creates a content type using a workflow id." + "description": "Updates a content type without an id and variable in the body and without a valid content type id as path param." }, "response": [] }, { - "name": "Get Content Type", + "name": "Update Content Type with existing ids", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", - "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Validate response\", function () {", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", + "", " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", "});" ], "type": "text/javascript", @@ -9970,8 +6996,17 @@ } ], "request": { - "method": "GET", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -9984,12 +7019,13 @@ "id", "{{contentTypeId}}" ] - } + }, + "description": "Updates a content type with valid ids and variable name." }, "response": [] }, { - "name": "Update Content Type with workflow id", + "name": "Update Content Type with existing id and variable in body but non existing id in path param", "event": [ { "listen": "test", @@ -9999,14 +7035,14 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Validate response\", function () {", + "pm.test(\"Check response\", function () {", "", - " var jsonData = pm.response.json();", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", "", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", "});" ], "type": "text/javascript", @@ -10019,7 +7055,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", "options": { "raw": { "language": "json" @@ -10027,7 +7063,7 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", "host": [ "{{serverURL}}" ], @@ -10036,15 +7072,15 @@ "v1", "contenttype", "id", - "{{contentTypeId}}" + "does-not-exist" ] }, - "description": "Updates a content type using a workflow id." + "description": "Updates a content type resolving the content type using the data in the body as the path param id does not exist." }, "response": [] }, { - "name": "Update Content Type with workflow variable name", + "name": "Update Content Type with no existing id in body and not existing id in path param", "event": [ { "listen": "test", @@ -10054,14 +7090,14 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Validate response\", function () {", + "pm.test(\"Check response\", function () {", "", - " var jsonData = pm.response.json();", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", "", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", "});" ], "type": "text/javascript", @@ -10074,7 +7110,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\"]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"does-not-exist\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", "options": { "raw": { "language": "json" @@ -10082,7 +7118,7 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", "host": [ "{{serverURL}}" ], @@ -10091,15 +7127,15 @@ "v1", "contenttype", "id", - "{{contentTypeId}}" + "does-not-exist" ] }, - "description": "Updates a content type using a workflow variable name." + "description": "Updates a content type resolving the content type using the id and variable in the body as the path param id does not exist. \nIn this test the id does not exist but the variable does." }, "response": [] }, { - "name": "Update Content Type with workflow variable name and id", + "name": "Update Content Type without id in body and not existing id in path param", "event": [ { "listen": "test", @@ -10109,27 +7145,15 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Validate response\", function () {", + "pm.test(\"Check response\", function () {", "", - " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", - " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", "", " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity.workflows;", - " workflows = workflows.sort(compareBy);", - " pm.expect(2).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - " pm.expect(workflows[1].id).to.eql(testSchemeId);", - " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", - "});", - "", - "function compareBy(a, b) {", - " if (a.variableName < b.variableName) { return -1; }", - " if (a.variableName > b.variableName) { return 1; }", - " return 0;", - "}" + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", + "});" ], "type": "text/javascript", "packages": {} @@ -10141,7 +7165,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\", \"{{schemeId}}\"]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", "options": { "raw": { "language": "json" @@ -10149,7 +7173,7 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", "host": [ "{{serverURL}}" ], @@ -10158,22 +7182,32 @@ "v1", "contenttype", "id", - "{{contentTypeId}}" + "does-not-exist" ] }, - "description": "Updates a content type using a workflow variable name and a workflow id." + "description": "Updates a content type resolving the content type using variable in the body as the path param id does not exist. \nIn this test the id in the body is not set, so the variable should be used." }, "response": [] }, { - "name": "Update Content Type with wrong workflow #1", + "name": "Update Content Type with not existing variable", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", "});" ], "type": "text/javascript", @@ -10186,7 +7220,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\", \"doestNotExist\"]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"doesnotexist\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", "options": { "raw": { "language": "json" @@ -10194,7 +7228,7 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", "host": [ "{{serverURL}}" ], @@ -10203,22 +7237,22 @@ "v1", "contenttype", "id", - "{{contentTypeId}}" + "does-not-exist" ] }, - "description": "Validates the proper error handling when a wrong workflow is used." + "description": "Updates a content type resolving the content type using the id and variable in the body as the path param id does not exist. \nIn this test the variable in the body does not exist." }, "response": [] }, { - "name": "Update Content Type with wrong workflow #2", + "name": "Update Content Type with not existing id and variable and path param", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", + "pm.test(\"Status code should be ok 404\", function () {", + " pm.response.to.have.status(404);", "});" ], "type": "text/javascript", @@ -10231,7 +7265,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"doestNotExist\"]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"does-not-exist\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"doesnotexist\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", "options": { "raw": { "language": "json" @@ -10239,7 +7273,7 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", "host": [ "{{serverURL}}" ], @@ -10248,10 +7282,10 @@ "v1", "contenttype", "id", - "{{contentTypeId}}" + "does-not-exist" ] }, - "description": "Validates the proper error handling when a wrong workflow is used." + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." }, "response": [] }, @@ -10286,19 +7320,38 @@ "id", "{{contentTypeId}}" ] - } + }, + "description": "Cleanup" }, "response": [] - }, + } + ], + "description": "On this set of tests we are going to test multiple updates permutations." + } + ], + "description": "In this folder we test different scenarios for handling the Content Type where we validate cases in order to not always rely on the Content Type ID." + }, + { + "name": "Fields", + "item": [ + { + "name": "Creation without id", + "item": [ { - "name": "Archive Scheme", + "name": "Create ContentType", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 200 \", function () {", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", "});" ], "type": "text/javascript", @@ -10307,31 +7360,7 @@ } ], "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "PUT", + "method": "POST", "header": [ { "key": "Content-Type", @@ -10340,32 +7369,33 @@ ], "body": { "mode": "raw", - "raw": "{\"schemeName\": \"{{schemeName}}\", \"schemeArchived\": \"true\"}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "workflow", - "schemes", - "{{schemeId}}" + "contenttype" ] - } + }, + "description": "Creates a content type and field without a field id or content type id in the field." }, "response": [] }, { - "name": "Delete Scheme", + "name": "Get Content Type", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 200 \", function () {", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", "});" ], @@ -10375,100 +7405,35 @@ } ], "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "DELETE", + "method": "GET", "header": [], "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "workflow", - "schemes", - "{{schemeId}}" + "contenttype", + "id", + "{{contentTypeId}}" ] - } + }, + "description": "Validates the content type and field were created as expected." }, "response": [] - } - ], - "description": "Covering different update scenarios for saving workflows in a content type.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } }, { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - } - ] - } - ], - "description": "The content type allows to pass a simple array of workflows ids or variables, these tests cases will cover diferent escenarios for this workflows list." - }, - { - "name": "Structured workflows array", - "item": [ - { - "name": "Creation", - "item": [ - { - "name": "Create Scheme", + "name": "Delete ContentType", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 200 \", function () {", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing workflow data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"schemeId\", jsonData.entity.id);", - " pm.collectionVariables.set(\"schemeName\", jsonData.entity.name);", - " pm.collectionVariables.set(\"schemeVariableName\", jsonData.entity.variableName);", - "});", - "" + "});" ], "type": "text/javascript", "packages": {} @@ -10476,35 +7441,33 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\"schemeName\": \"Test Schema {{$timestamp}}\", \"schemeDescription\": \"Test sechema\", \"schemeArchived\": \"false\"}" - }, + "method": "DELETE", + "header": [], "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "workflow", - "schemes" + "contenttype", + "id", + "{{contentTypeId}}" ] }, - "description": "Creates a new test scheme" + "description": "Cleanup." }, "response": [] - }, + } + ], + "description": "This test tries to create a content type and field without provide a field ID in the body, this is the most common escenario creating a content type." + }, + { + "name": "Creation with non existing id", + "item": [ { - "name": "Create ContentType with workflow id and variable name", + "name": "Create ContentType", "event": [ { "listen": "test", @@ -10514,19 +7477,13 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing content type data\", function () {", + "pm.test(\"Storing content type id\", function () {", " var jsonData = pm.response.json();", " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", + " pm.collectionVariables.set(\"contentTypeField1Variable\", jsonData.entity[0].fields[0].variable);", "});" ], "type": "text/javascript", @@ -10544,7 +7501,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"indexed\": true,\n \"dataType\": \"TEXT\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"listed\": true,\n \"unique\": false,\n \"name\": \"Name\",\n \"variable\": \"name\",\n \"fixed\": true\n }\n ],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"123ec8e74bc0fd62172507{{$timestamp}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, "url": { "raw": "{{serverURL}}/api/v1/contenttype", @@ -10557,7 +7514,7 @@ "contenttype" ] }, - "description": "Creates a content type specifying a workflow id and variable name." + "description": "Creates a field using a non existing field id." }, "response": [] }, @@ -10574,13 +7531,14 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Validate response\", function () {", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + "", " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -10603,7 +7561,8 @@ "id", "{{contentTypeId}}" ] - } + }, + "description": "Validates the content type and field were created as expected." }, "response": [] }, @@ -10638,12 +7597,19 @@ "id", "{{contentTypeId}}" ] - } + }, + "description": "Cleanup" }, "response": [] - }, + } + ], + "description": "This test creates the Content Type with a field with a not existing field id in the body." + }, + { + "name": "Multiple update permutations Copy", + "item": [ { - "name": "Create ContentType with workflow variable name", + "name": "Create ContentType", "event": [ { "listen": "test", @@ -10653,19 +7619,12 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing content type data\", function () {", + "pm.test(\"Storing content type id\", function () {", " var jsonData = pm.response.json();", " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", + " pm.collectionVariables.set(\"contentTypeField1Variable\", jsonData.entity[0].fields[0].variable);", "});" ], "type": "text/javascript", @@ -10683,25 +7642,73 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] }, + "description": "Simple creation to sep up the data for the update tests." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeId}}" ] }, - "description": "Creates a content type using just the workflow variable name." + "description": "Validates the content type and field were created as expected." }, "response": [] }, { - "name": "Delete ContentType", + "name": "Update field with no variable name", "event": [ { "listen": "test", @@ -10709,6 +7716,16 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -10717,8 +7734,17 @@ } ], "request": { - "method": "DELETE", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -10731,12 +7757,13 @@ "id", "{{contentTypeId}}" ] - } + }, + "description": "Updates the field with no variable name." }, "response": [] }, { - "name": "Create ContentType with workflow id", + "name": "Update field with no content type id", "event": [ { "listen": "test", @@ -10746,19 +7773,16 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", "", - "pm.test(\"Validate response\", function () {", " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", + " pm.expect(jsonData.entity.fields[0].contentTypeId).to.eql(contentTypeId);", "});" ], "type": "text/javascript", @@ -10767,34 +7791,36 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n }\n ]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeId}}" ] }, - "description": "Creates a content type using just the workflow id." + "description": "Updates the fields with no content type id in the fields." }, "response": [] }, { - "name": "Delete ContentType", + "name": "Update field with content type id", "event": [ { "listen": "test", @@ -10802,6 +7828,16 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -10810,8 +7846,17 @@ } ], "request": { - "method": "DELETE", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -10824,12 +7869,13 @@ "id", "{{contentTypeId}}" ] - } + }, + "description": "Updates the fields with the content type id in the fields." }, "response": [] }, { - "name": "Create ContentType with multiple workflows", + "name": "Update field with existing id", "event": [ { "listen": "test", @@ -10839,34 +7885,15 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate response\", function () {", + "pm.test(\"Check response\", function () {", "", - " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", - " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", "", " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " workflows = workflows.sort(compareBy);", - " pm.expect(2).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - " pm.expect(workflows[1].id).to.eql(testSchemeId);", - " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", - "});", - "", - "function compareBy(a, b) {", - " if (a.variableName < b.variableName) { return -1; }", - " if (a.variableName > b.variableName) { return 1; }", - " return 0;", - "}", - "" + " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", + "});" ], "type": "text/javascript", "packages": {} @@ -10874,34 +7901,36 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n },\n {\n \"id\": \"{{schemeId}}\",\n \"variableName\": \"{{schemeVariableName}}\"\n }\n ]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeId}}" ] }, - "description": "Creates a content type with multiple workflows" + "description": "Updates a field using an existing field id." }, "response": [] }, { - "name": "Delete ContentType", + "name": "Update field with no existing id", "event": [ { "listen": "test", @@ -10909,6 +7938,16 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -10917,10 +7956,19 @@ } ], "request": { - "method": "DELETE", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"does-not-exist\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", "host": [ "{{serverURL}}" ], @@ -10929,14 +7977,15 @@ "v1", "contenttype", "id", - "{{contentTypeId}}" + "{{contentTypeVariable}}" ] - } + }, + "description": "Updates the field with a non existing field id but existing field variable name." }, "response": [] }, { - "name": "Create ContentType with non existing id but valid variable", + "name": "Update field without id", "event": [ { "listen": "test", @@ -10946,21 +7995,15 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", "", - "pm.test(\"Validate response\", function () {", " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});", - "" + " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", + "});" ], "type": "text/javascript", "packages": {} @@ -10968,34 +8011,36 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bf12345\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeVariable}}" ] }, - "description": "Creates a content type with with a workflow using a non existing id but with a valid variable name." + "description": "Updates a field without a field id in the body but with a valid variable name." }, "response": [] }, { - "name": "Create ContentType with non existing variable but valid id", + "name": "Update field without id and variable", "event": [ { "listen": "test", @@ -11003,67 +8048,52 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});", - "" + "});" ], "type": "text/javascript", "packages": {} } } ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "request": { + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"doesNotExit\"\n }\n ]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeVariable}}" ] }, - "description": "Creates a content type with with a workflow using a non existing variable but with a valid id." + "description": "Updates a content type with a field without a field id and field variable in the body, as there is not data to use to identify the field, a new field will be created." }, "response": [] }, { - "name": "Create ContentType with wrong workflow #1", + "name": "Delete ContentType", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", - "});", - "" + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], "type": "text/javascript", "packages": {} @@ -11071,41 +8101,80 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"doesNotExist\"\n }\n ]\n}" - }, + "method": "DELETE", + "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeId}}" ] }, - "description": "Validates the proper error handling when a wrong workflow is used." + "description": "Cleanup" }, "response": [] - }, + } + ] + } + ], + "description": "In this folder we test different scenarios for handling the Content Type fields where we validate cases in order to not always rely on the Content Type field ID." + } + ], + "description": "When saving content type and fields, we don't need to rely entirely on ids, if the id does not exist or is not provided, we should use variables as the key.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Test Workflows", + "item": [ + { + "name": "Simple workflows array", + "item": [ + { + "name": "Creation", + "item": [ { - "name": "Create ContentType with wrong workflow #2", + "name": "Create Scheme", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing workflow data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"schemeId\", jsonData.entity.id);", + " pm.collectionVariables.set(\"schemeName\", jsonData.entity.name);", + " pm.collectionVariables.set(\"schemeVariableName\", jsonData.entity.variableName);", "});", "" ], @@ -11124,32 +8193,48 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"doesNotExist\"\n }\n ]\n}" + "raw": "{\"schemeName\": \"Test Schema {{$timestamp}}\", \"schemeDescription\": \"Test sechema\", \"schemeArchived\": \"false\"}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/workflow/schemes", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "workflow", + "schemes" ] }, - "description": "Validates the proper error handling when a wrong workflow is used." + "description": "Creates a new test scheme" }, "response": [] }, { - "name": "Archive Scheme", + "name": "Create ContentType with workflow id", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 200 \", function () {", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -11158,31 +8243,7 @@ } ], "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "PUT", + "method": "POST", "header": [ { "key": "Content-Type", @@ -11191,34 +8252,43 @@ ], "body": { "mode": "raw", - "raw": "{\"schemeName\": \"{{schemeName}}\", \"schemeArchived\": \"true\"}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "workflow", - "schemes", - "{{schemeId}}" + "contenttype" ] }, - "description": "\n### Update Workflow Scheme\n\nUpdates an existing workflow scheme.\n\n#### Request Body\n- `schemeName` (string, optional): The name of the scheme.\n- `schemeArchived` (boolean, optional): Indicates if the scheme is archived.\n\n#### Response\nThe response for this request is documented as a JSON schema.\n" + "description": "Creates a content type using a workflow id." }, "response": [] }, { - "name": "Delete Scheme", + "name": "Get Content Type", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 200 \", function () {", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -11227,94 +8297,34 @@ } ], "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "DELETE", + "method": "GET", "header": [], "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "workflow", - "schemes", - "{{schemeId}}" + "contenttype", + "id", + "{{contentTypeId}}" ] } }, "response": [] - } - ], - "description": "Covering different save scenarios for saving workflows in a content type.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } }, { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Update", - "item": [ - { - "name": "Create Scheme", + "name": "Delete ContentType", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 200 \", function () {", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing workflow data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"schemeId\", jsonData.entity.id);", - " pm.collectionVariables.set(\"schemeName\", jsonData.entity.name);", - " pm.collectionVariables.set(\"schemeVariableName\", jsonData.entity.variableName);", - "});", - "" + "});" ], "type": "text/javascript", "packages": {} @@ -11322,35 +8332,26 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\"schemeName\": \"Test Schema {{$timestamp}}\", \"schemeDescription\": \"Test sechema\", \"schemeArchived\": \"false\"}" - }, + "method": "DELETE", + "header": [], "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "workflow", - "schemes" + "contenttype", + "id", + "{{contentTypeId}}" ] - }, - "description": "Creates a test scheme" + } }, "response": [] }, { - "name": "Create ContentType", + "name": "Create ContentType with workflow variable name", "event": [ { "listen": "test", @@ -11364,7 +8365,6 @@ " var jsonData = pm.response.json();", " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[2].id);", "});", "", "pm.test(\"Validate response\", function () {", @@ -11391,7 +8391,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\"]\n}" }, "url": { "raw": "{{serverURL}}/api/v1/contenttype", @@ -11404,30 +8404,19 @@ "contenttype" ] }, - "description": "Creates a content type with a workflow using an id and variable name." + "description": "Creates a content type using a workflow variable name." }, "response": [] }, { - "name": "Get Content Type", + "name": "Delete ContentType", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", - "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -11436,7 +8425,7 @@ } ], "request": { - "method": "GET", + "method": "DELETE", "header": [], "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", @@ -11455,7 +8444,7 @@ "response": [] }, { - "name": "Update Content Type with workflow id and variable name", + "name": "Create ContentType with workflow variable name and id", "event": [ { "listen": "test", @@ -11465,15 +8454,34 @@ " pm.response.to.have.status(200);", "});", "", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", "pm.test(\"Validate response\", function () {", "", - " var jsonData = pm.response.json();", + " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", + " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", "", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", + " workflows = workflows.sort(compareBy);", + " pm.expect(2).to.eql(workflows.length);", " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" + " pm.expect(workflows[1].id).to.eql(testSchemeId);", + " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", + "});", + "", + "function compareBy(a, b) {", + " if (a.variableName < b.variableName) { return -1; }", + " if (a.variableName > b.variableName) { return 1; }", + " return 0;", + "}", + "" ], "type": "text/javascript", "packages": {} @@ -11481,36 +8489,34 @@ } ], "request": { - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"{{schemeId}}\",\"systemworkflow\"]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "contenttype" ] }, - "description": "Updates a content type using a workflow with id and variable name." + "description": "Creates a content type using a workflow id and a workflow variable name." }, "response": [] }, { - "name": "Update Content Type with workflow variable name", + "name": "Delete ContentType", "event": [ { "listen": "test", @@ -11518,16 +8524,6 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var jsonData = pm.response.json();", - "", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -11536,17 +8532,8 @@ } ], "request": { - "method": "PUT", + "method": "DELETE", "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -11559,31 +8546,21 @@ "id", "{{contentTypeId}}" ] - }, - "description": "Updates a content type using a workflow with just a variable name." + } }, "response": [] }, { - "name": "Update Content Type with workflow id", + "name": "Create ContentType with wrong workflow #1", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var jsonData = pm.response.json();", - "", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" + "" ], "type": "text/javascript", "packages": {} @@ -11591,66 +8568,43 @@ } ], "request": { - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"doesNotExist\",\"systemworkflow\"]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "contenttype" ] }, - "description": "Updates a content type using a workflow with just an id." + "description": "Validates the proper error handling when a wrong workflow is used." }, "response": [] }, { - "name": "Update Content Type with with multiple workflows", + "name": "Create ContentType with wrong workflow #2", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", - " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", - "", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity.workflows;", - " workflows = workflows.sort(compareBy);", - " pm.expect(2).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - " pm.expect(workflows[1].id).to.eql(testSchemeId);", - " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", "});", - "", - "function compareBy(a, b) {", - " if (a.variableName < b.variableName) { return -1; }", - " if (a.variableName > b.variableName) { return 1; }", - " return 0;", - "}" + "" ], "type": "text/javascript", "packages": {} @@ -11658,53 +8612,41 @@ } ], "request": { - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n },\n {\n \"id\": \"{{schemeId}}\",\n \"variableName\": \"{{schemeVariableName}}\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"doesNotExist\"]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "contenttype" ] }, - "description": "Updates a content type with multiple workflow." + "description": "Validates the proper error handling when a wrong workflow is used." }, "response": [] }, { - "name": "Update Content Type with non existing id but valid variable", + "name": "Archive Scheme", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", + "pm.test(\"Status code is 200 \", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var jsonData = pm.response.json();", - "", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -11713,53 +8655,67 @@ } ], "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, "method": "PUT", - "header": [], + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bf12345\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\"schemeName\": \"{{schemeName}}\", \"schemeArchived\": \"true\"}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "workflow", + "schemes", + "{{schemeId}}" ] }, - "description": "Updates a content type with a workflow where the id is invalid but with a valid variable name." + "description": "\n### Update Workflow Scheme\n\nUpdates an existing workflow scheme.\n\n#### Request Body\n- `schemeName` (string, optional): The name of the scheme.\n- `schemeArchived` (boolean, optional): Indicates if the scheme is archived.\n\n#### Response\nThe response for this request is documented as a JSON schema.\n" }, "response": [] }, { - "name": "Update Content Type with non existing variable but valid id", + "name": "Delete Scheme", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", + "pm.test(\"Status code is 200 \", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var jsonData = pm.response.json();", - "", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -11768,44 +8724,94 @@ } ], "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"doesNotExit\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } - } + ] }, + "method": "DELETE", + "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "workflow", + "schemes", + "{{schemeId}}" ] - }, - "description": "Updates a content type with a workflow where the id valid but with an invalid variable name." + } }, "response": [] + } + ], + "description": "Covering different save scenarios for saving workflows in a content type.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } }, { - "name": "Update Content Type with wrong workflow #1", + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Update", + "item": [ + { + "name": "Create Scheme", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", - "});" + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing workflow data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"schemeId\", jsonData.entity.id);", + " pm.collectionVariables.set(\"schemeName\", jsonData.entity.name);", + " pm.collectionVariables.set(\"schemeVariableName\", jsonData.entity.variableName);", + "});", + "" ], "type": "text/javascript", "packages": {} @@ -11813,43 +8819,58 @@ } ], "request": { - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"doesNotExist\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\"schemeName\": \"Test Schema {{$timestamp}}\", \"schemeDescription\": \"Test sechema\", \"schemeArchived\": \"false\"}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/workflow/schemes", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "workflow", + "schemes" ] }, - "description": "Validates the proper error handling when a wrong workflow id is used." + "description": "Creates a test scheme" }, "response": [] }, { - "name": "Update Content Type with wrong workflow #2", + "name": "Create ContentType", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -11858,43 +8879,52 @@ } ], "request": { - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"doesNotExist\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "contenttype" ] }, - "description": "Validates the proper error handling when a wrong workflow variable name is used." + "description": "Creates a content type using a workflow id." }, "response": [] }, { - "name": "Delete ContentType", + "name": "Get Content Type", "event": [ { "listen": "test", "script": { "exec": [ + "var jsonData = pm.response.json();", + "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -11903,7 +8933,7 @@ } ], "request": { - "method": "DELETE", + "method": "GET", "header": [], "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", @@ -11922,14 +8952,24 @@ "response": [] }, { - "name": "Archive Scheme", + "name": "Update Content Type with workflow id", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 200 \", function () {", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var jsonData = pm.response.json();", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -11938,66 +8978,53 @@ } ], "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "header": [], "body": { "mode": "raw", - "raw": "{\"schemeName\": \"{{schemeName}}\", \"schemeArchived\": \"true\"}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "workflow", - "schemes", - "{{schemeId}}" + "contenttype", + "id", + "{{contentTypeId}}" ] - } + }, + "description": "Updates a content type using a workflow id." }, "response": [] }, { - "name": "Delete Scheme", + "name": "Update Content Type with workflow variable name", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 200 \", function () {", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var jsonData = pm.response.json();", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -12006,2274 +9033,2294 @@ } ], "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\"]\n}", + "options": { + "raw": { + "language": "json" } - ] + } }, - "method": "DELETE", - "header": [], "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "workflow", - "schemes", - "{{schemeId}}" - ] - } - }, - "response": [] - } - ], - "description": "Covering different update scenarios for saving workflows in a content type.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - } - ] - } - ], - "description": "The content type allows to pass also a more estructured array of workflows where you can specify the id and variable for each workflow, these tests cases will cover diferent escenarios for this workflows list." - } - ], - "description": "Testing the diferent scenarios for saving workflows in a Content Type", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Layout fields", - "item": [ - { - "name": "Create", - "item": [ - { - "name": "Create ContentType without layout fields", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity[0].fields;", - " pm.expect(3).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity[0].fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Test to validate the layout fields are created even if not layout fields are sent." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(3).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Validates the content type and fields were created as expected." - }, - "response": [] - }, - { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type using a workflow variable name." + }, + "response": [] }, - "description": "Cleanup" - }, - "response": [] - }, - { - "name": "Create ContentType with layout fields", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity[0].fields;", - " pm.expect(3).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity[0].fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"testContentType{{$timestamp}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fixed\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name\"\n }\n ],\n \"workflow\": [\n \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" + "name": "Update Content Type with workflow variable name and id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", + " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", + "", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity.workflows;", + " workflows = workflows.sort(compareBy);", + " pm.expect(2).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + " pm.expect(workflows[1].id).to.eql(testSchemeId);", + " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", + "});", + "", + "function compareBy(a, b) {", + " if (a.variableName < b.variableName) { return -1; }", + " if (a.variableName > b.variableName) { return 1; }", + " return 0;", + "}" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\", \"{{schemeId}}\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type using a workflow variable name and a workflow id." + }, + "response": [] }, - "description": "Test to validate the layout fields are respected when sent in the request." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(3).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" + "name": "Update Content Type with wrong workflow #1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\", \"doestNotExist\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Validates the proper error handling when a wrong workflow is used." + }, + "response": [] }, - "description": "Validates the content type and fields were created as expected." - }, - "response": [] - }, - { - "name": "Delete ContentType", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" + "name": "Update Content Type with wrong workflow #2", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"doestNotExist\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Validates the proper error handling when a wrong workflow is used." + }, + "response": [] }, - "description": "Cleanup" - }, - "response": [] - }, - { - "name": "Create ContentType with wrong layout", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity[0].fields;", - " pm.expect(4).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity[0].fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"testContentType{{$timestamp}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 10,\n \"unique\": false\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name\"\n }\n ],\n \"workflow\": [\n \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype" - ] + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + } + }, + "response": [] }, - "description": "Test to validate the layout is fixed even if the layout in the body is wrong." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(4).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" + "name": "Archive Scheme", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\"schemeName\": \"{{schemeName}}\", \"schemeArchived\": \"true\"}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "schemes", + "{{schemeId}}" + ] + } + }, + "response": [] }, - "description": "Validates the content type and fields were created as expected." - }, - "response": [] - }, - { - "name": "Delete ContentType", + { + "name": "Delete Scheme", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "schemes", + "{{schemeId}}" + ] + } + }, + "response": [] + } + ], + "description": "Covering different update scenarios for saving workflows in a content type.", "event": [ { - "listen": "test", + "listen": "prerequest", "script": { + "type": "text/javascript", + "packages": {}, "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], + "" + ] + } + }, + { + "listen": "test", + "script": { "type": "text/javascript", - "packages": {} + "packages": {}, + "exec": [ + "" + ] } } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Cleanup" - }, - "response": [] + ] } ], - "description": "Folder to encapsulate multiple tests to validate the proper creation and handling of layout fields." + "description": "The content type allows to pass a simple array of workflows ids or variables, these tests cases will cover diferent escenarios for this workflows list." }, { - "name": "Update", + "name": "Structured workflows array", "item": [ { - "name": "Create ContentType", - "event": [ + "name": "Creation", + "item": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", - " pm.collectionVariables.set(\"contentTypeField1Variable\", jsonData.entity[0].fields[0].variable);", - "});" + "name": "Create Scheme", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing workflow data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"schemeId\", jsonData.entity.id);", + " pm.collectionVariables.set(\"schemeName\", jsonData.entity.name);", + " pm.collectionVariables.set(\"schemeVariableName\", jsonData.entity.variableName);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + "body": { + "mode": "raw", + "raw": "{\"schemeName\": \"Test Schema {{$timestamp}}\", \"schemeDescription\": \"Test sechema\", \"schemeArchived\": \"false\"}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/schemes", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "schemes" + ] + }, + "description": "Creates a new test scheme" + }, + "response": [] }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" + { + "name": "Create ContentType with workflow id and variable name", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype" - ] + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"indexed\": true,\n \"dataType\": \"TEXT\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"listed\": true,\n \"unique\": false,\n \"name\": \"Name\",\n \"variable\": \"name\",\n \"fixed\": true\n }\n ],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Creates a content type specifying a workflow id and variable name." + }, + "response": [] }, - "description": "Simple creation to sep up the data for the update tests." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(3).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + } + }, + "response": [] }, - "description": "Validates the content type and fields were created as expected." - }, - "response": [] - }, - { - "name": "Update fields exceeding maximum columns", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(11).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[7].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[10].clazz);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field4\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 7,\n \"unique\": false,\n \"variable\": \"columnField4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field5\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"columnField5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field6\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 11,\n \"unique\": false,\n \"variable\": \"columnField6\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 12,\n \"unique\": false,\n \"variable\": \"name6\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + } + }, + "response": [] }, - "description": "Updates the fields exceeding maximum ammounts of columns per row." - }, - "response": [] - }, - { - "name": "Update fields exceeding maximum columns with multiple rows", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(22).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[7].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[10].clazz);", - "", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[11].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[12].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[13].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[14].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[15].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[16].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[17].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[18].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[19].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[20].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[21].clazz); ", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field4\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 7,\n \"unique\": false,\n \"variable\": \"columnField4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field5\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"columnField5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field6\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 11,\n \"unique\": false,\n \"variable\": \"columnField6\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 12,\n \"unique\": false,\n \"variable\": \"name6\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 13,\n \"unique\": false,\n \"variable\": \"rowField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field11\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 14,\n \"unique\": false,\n \"variable\": \"columnField11\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name11\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 15,\n \"unique\": false,\n \"variable\": \"name11\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field22\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 16,\n \"unique\": false,\n \"variable\": \"columnField22\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name22\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 17,\n \"unique\": false,\n \"variable\": \"name22\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field33\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 18,\n \"unique\": false,\n \"variable\": \"columnField33\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name33\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 19,\n \"unique\": false,\n \"variable\": \"name33\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field44\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 20,\n \"unique\": false,\n \"variable\": \"columnField44\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name44\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 21,\n \"unique\": false,\n \"variable\": \"name44\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field55\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 22,\n \"unique\": false,\n \"variable\": \"columnField55\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name55\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 23,\n \"unique\": false,\n \"variable\": \"name55\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field66\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 24,\n \"unique\": false,\n \"variable\": \"columnField66\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name66\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 25,\n \"unique\": false,\n \"variable\": \"name66\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" + "name": "Create ContentType with workflow variable name", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Creates a content type using just the workflow variable name." + }, + "response": [] }, - "description": "Updates the fields exceeding maximum ammounts of columns per row." - }, - "response": [] - }, - { - "name": "Update fields validating order is respected", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(11).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields type order\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[7].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[10].clazz);", - "});", - "", - "pm.test(\"Validate fields order\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"rowField1\").to.eql(fields[0].variable);", - " pm.expect(\"columnField1\").to.eql(fields[1].variable);", - " pm.expect(\"name1\").to.eql(fields[2].variable);", - " pm.expect(\"columnField2\").to.eql(fields[3].variable);", - " pm.expect(\"name2\").to.eql(fields[4].variable);", - " pm.expect(\"columnField3\").to.eql(fields[5].variable);", - " pm.expect(\"name3\").to.eql(fields[6].variable);", - " pm.expect(\"columnField4\").to.eql(fields[7].variable);", - " pm.expect(\"name4\").to.eql(fields[8].variable);", - " pm.expect(\"name5\").to.eql(fields[9].variable);", - " pm.expect(\"name6\").to.eql(fields[10].variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field4\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 7,\n \"unique\": false,\n \"variable\": \"columnField4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name6\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] } - } + }, + "response": [] }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" + { + "name": "Create ContentType with workflow id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n }\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Creates a content type using just the workflow id." + }, + "response": [] }, - "description": "Updates the fields validating the given order is respected." - }, - "response": [] - }, - { - "name": "Update fields changing order", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(11).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields type order\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[7].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[10].clazz);", - "});", - "", - "pm.test(\"Validate fields order\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"rowField1\").to.eql(fields[0].variable);", - " pm.expect(\"columnField1\").to.eql(fields[1].variable);", - " pm.expect(\"name1\").to.eql(fields[2].variable);", - " pm.expect(\"columnField2\").to.eql(fields[3].variable);", - " pm.expect(\"name2\").to.eql(fields[4].variable);", - " pm.expect(\"columnField3\").to.eql(fields[5].variable);", - " pm.expect(\"name3\").to.eql(fields[6].variable);", - " pm.expect(\"columnField4\").to.eql(fields[7].variable);", - " pm.expect(\"name6\").to.eql(fields[8].variable);", - " pm.expect(\"name4\").to.eql(fields[9].variable);", - " pm.expect(\"name5\").to.eql(fields[10].variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field4\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 7,\n \"unique\": false,\n \"variable\": \"columnField4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name6\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + } + }, + "response": [] }, - "description": "Updates the fields changing the order of the fields" - }, - "response": [] - }, - { - "name": "Update fields changing order again", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(11).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields type order\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[7].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[10].clazz);", - "});", - "", - "pm.test(\"Validate fields order\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"rowField1\").to.eql(fields[0].variable);", - " pm.expect(\"columnField1\").to.eql(fields[1].variable);", - " pm.expect(\"name1\").to.eql(fields[2].variable);", - " pm.expect(\"columnField2\").to.eql(fields[3].variable);", - " pm.expect(\"name3\").to.eql(fields[4].variable);", - " pm.expect(\"columnField3\").to.eql(fields[5].variable);", - " pm.expect(\"name2\").to.eql(fields[6].variable);", - " pm.expect(\"columnField4\").to.eql(fields[7].variable);", - " pm.expect(\"name6\").to.eql(fields[8].variable);", - " pm.expect(\"name4\").to.eql(fields[9].variable);", - " pm.expect(\"name5\").to.eql(fields[10].variable);", - "});" + "name": "Create ContentType with multiple workflows", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", + " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", + "", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", + " workflows = workflows.sort(compareBy);", + " pm.expect(2).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + " pm.expect(workflows[1].id).to.eql(testSchemeId);", + " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", + "});", + "", + "function compareBy(a, b) {", + " if (a.variableName < b.variableName) { return -1; }", + " if (a.variableName > b.variableName) { return 1; }", + " return 0;", + "}", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field4\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 7,\n \"unique\": false,\n \"variable\": \"columnField4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name6\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n },\n {\n \"id\": \"{{schemeId}}\",\n \"variableName\": \"{{schemeVariableName}}\"\n }\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Creates a content type with multiple workflows" + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + } + }, + "response": [] }, - "description": "Updates the fields changing the order of the fields" - }, - "response": [] - }, - { - "name": "Update fields removing column", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate fields size\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(10).to.eql(fields.length);", - "});", - "", - "pm.test(\"Validate fields type order\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[7].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", - " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", - "});", - "", - "pm.test(\"Validate fields order\", function () {", - " var jsonData = pm.response.json();", - " var fields = jsonData.entity.fields;", - " pm.expect(\"rowField1\").to.eql(fields[0].variable);", - " pm.expect(\"columnField1\").to.eql(fields[1].variable);", - " pm.expect(\"name1\").to.eql(fields[2].variable);", - " pm.expect(\"columnField2\").to.eql(fields[3].variable);", - " pm.expect(\"name3\").to.eql(fields[4].variable);", - " pm.expect(\"columnField3\").to.eql(fields[5].variable);", - " pm.expect(\"name2\").to.eql(fields[6].variable);", - " pm.expect(\"name6\").to.eql(fields[7].variable);", - " pm.expect(\"name4\").to.eql(fields[8].variable);", - " pm.expect(\"name5\").to.eql(fields[9].variable);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name6\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" + "name": "Create ContentType with non existing id but valid variable", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bf12345\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Creates a content type with with a workflow using a non existing id but with a valid variable name." + }, + "response": [] }, - "description": "Updates the fields removing a column an validating the layout is correct." - }, - "response": [] - }, - { - "name": "Delete ContentType", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" + "name": "Create ContentType with non existing variable but valid id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Cleanup" - }, - "response": [] - } - ], - "description": "Folder to encapsulate multiple tests to validate the proper update and handling of layout fields." - } - ], - "description": "Multiple tests validating the proper handling of layout fields when saving content types", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "System Action Mappings", - "item": [ - { - "name": "Create", - "item": [ - { - "name": "Create ContentType without systemActionMappings", - "event": [ + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"doesNotExit\"\n }\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Creates a content type with with a workflow using a non existing variable but with a valid id." + }, + "response": [] + }, { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate systemActionMappings is empty\", function () {", - " var systemActionMappings = pm.response.json().entity[0].systemActionMappings;", - " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", - "});" + "name": "Create ContentType with wrong workflow #1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType1{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"doesNotExist\"\n }\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Validates the proper error handling when a wrong workflow is used." + }, + "response": [] }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" + { + "name": "Create ContentType with wrong workflow #2", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype" - ] + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"doesNotExist\"\n }\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Validates the proper error handling when a wrong workflow is used." + }, + "response": [] }, - "description": "Test to validate the content type is created without `systemActionMappings`." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings is empty\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", - "});" + "name": "Archive Scheme", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } ], - "type": "text/javascript", - "packages": {} - } + "body": { + "mode": "raw", + "raw": "{\"schemeName\": \"{{schemeName}}\", \"schemeArchived\": \"true\"}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "schemes", + "{{schemeId}}" + ] + }, + "description": "\n### Update Workflow Scheme\n\nUpdates an existing workflow scheme.\n\n#### Request Body\n- `schemeName` (string, optional): The name of the scheme.\n- `schemeArchived` (boolean, optional): Indicates if the scheme is archived.\n\n#### Response\nThe response for this request is documented as a JSON schema.\n" + }, + "response": [] + }, + { + "name": "Delete Scheme", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "schemes", + "{{schemeId}}" + ] + } + }, + "response": [] } ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Validates the content type and `systemActionMappings` were created as expected." - }, - "response": [] - }, - { - "name": "Delete ContentType", + "description": "Covering different save scenarios for saving workflows in a content type.", "event": [ { - "listen": "test", + "listen": "prerequest", "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], "type": "text/javascript", - "packages": {} + "packages": {}, + "exec": [ + "" + ] } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] }, - "description": "Cleanup" - }, - "response": [] - }, - { - "name": "Create ContentType with empty systemActionMappings", - "event": [ { "listen": "test", "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate systemActionMappings is empty\", function () {", - " var systemActionMappings = pm.response.json().entity[0].systemActionMappings;", - " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", - "});" - ], "type": "text/javascript", - "packages": {} + "packages": {}, + "exec": [ + "" + ] } } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType2{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"systemActionMappings\": {},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Test to validate the content type is created with empty `systemActionMappings`." - }, - "response": [] + ] }, { - "name": "Get Content Type", - "event": [ + "name": "Update", + "item": [ { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings is empty\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" + "name": "Create Scheme", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing workflow data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"schemeId\", jsonData.entity.id);", + " pm.collectionVariables.set(\"schemeName\", jsonData.entity.name);", + " pm.collectionVariables.set(\"schemeVariableName\", jsonData.entity.variableName);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\"schemeName\": \"Test Schema {{$timestamp}}\", \"schemeDescription\": \"Test sechema\", \"schemeArchived\": \"false\"}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/schemes", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "schemes" + ] + }, + "description": "Creates a test scheme" + }, + "response": [] + }, + { + "name": "Create ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Creates a content type with a workflow using an id and variable name." + }, + "response": [] }, - "description": "Validates the content type and `systemActionMappings` were created as expected." - }, - "response": [] - }, - { - "name": "Delete ContentType", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + } + }, + "response": [] }, - "description": "Cleanup" - }, - "response": [] - }, - { - "name": "Create ContentType with systemActionMappings", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate systemActionMappings exist\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity[0]).to.have.property('systemActionMappings');", - "});", - "", - "pm.test(\"Validate systemActionMappings contain 'NEW' and 'ARCHIVE'\", function () {", - " var systemActionMappings = pm.response.json().entity[0].systemActionMappings;", - " pm.expect(systemActionMappings).to.have.property('NEW');", - " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", - "});", - "", - "pm.test(\"Validate workflowAction.id inside 'NEW' and 'ARCHIVE'\", function () {", - " var systemActionMappings = pm.response.json().entity[0].systemActionMappings;", - " ", - " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", - " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType3{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"systemActionMappings\" : {\n \"NEW\" : \"b9d89c80-3d88-4311-8365-187323c96436\",\n \"ARCHIVE\": \"4da13a42-5d59-480c-ad8f-94a3adf809fe\"\n },\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" + "name": "Update Content Type with workflow id and variable name", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var jsonData = pm.response.json();", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type using a workflow with id and variable name." + }, + "response": [] }, - "description": "Test to validate the content type is created with `systemActionMappings`." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings exist\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", - "});", - "", - "pm.test(\"Validate systemActionMappings contain 'NEW' and 'ARCHIVE'\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.have.property('NEW');", - " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", - "});", - "", - "pm.test(\"Validate workflowAction.id inside 'NEW' and 'ARCHIVE'\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " ", - " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", - " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" + "name": "Update Content Type with workflow variable name", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var jsonData = pm.response.json();", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type using a workflow with just a variable name." + }, + "response": [] }, - "description": "Validates the content type and `systemActionMappings` were created as expected." - }, - "response": [] - }, - { - "name": "Delete ContentType", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" + "name": "Update Content Type with workflow id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var jsonData = pm.response.json();", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type using a workflow with just an id." + }, + "response": [] }, - "description": "Cleanup" - }, - "response": [] - } - ], - "description": "Folder to encapsulate multiple tests to validate the proper creation and handling of `systemActionMappings`." - }, - { - "name": "Update", - "item": [ - { - "name": "Create ContentType", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate systemActionMappings is empty\", function () {", - " var systemActionMappings = pm.response.json().entity[0].systemActionMappings;", - " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType1{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" + "name": "Update Content Type with with multiple workflows", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", + " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", + "", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity.workflows;", + " workflows = workflows.sort(compareBy);", + " pm.expect(2).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + " pm.expect(workflows[1].id).to.eql(testSchemeId);", + " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", + "});", + "", + "function compareBy(a, b) {", + " if (a.variableName < b.variableName) { return -1; }", + " if (a.variableName > b.variableName) { return 1; }", + " return 0;", + "}" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n },\n {\n \"id\": \"{{schemeId}}\",\n \"variableName\": \"{{schemeVariableName}}\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type with multiple workflow." + }, + "response": [] }, - "description": "Simple creation to sep up the data for the update tests." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings is empty\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" + "name": "Update Content Type with non existing id but valid variable", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var jsonData = pm.response.json();", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bf12345\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type with a workflow where the id is invalid but with a valid variable name." + }, + "response": [] }, - "description": "Validates the content type and `systemActionMappings` were created as expected." - }, - "response": [] - }, - { - "name": "Update without systemActionMappings", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings is empty\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", - "options": { - "raw": { - "language": "json" + "name": "Update Content Type with non existing variable but valid id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var jsonData = pm.response.json();", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"doesNotExit\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type with a workflow where the id valid but with an invalid variable name." + }, + "response": [] }, - "description": "Updates a content type without `systemActionMappings`." - }, - "response": [] - }, - { - "name": "Update with empty systemActionMappings", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings is empty\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\": {},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", - "options": { - "raw": { - "language": "json" + "name": "Update Content Type with wrong workflow #1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"doesNotExist\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Validates the proper error handling when a wrong workflow id is used." + }, + "response": [] }, - "description": "Updates a content type with emtpy `systemActionMappings`." - }, - "response": [] - }, - { - "name": "Update with systemActionMappings", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings exist\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", - "});", - "", - "pm.test(\"Validate systemActionMappings\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.have.property('NEW');", - " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", - "});", - "", - "pm.test(\"Validate workflowAction.id\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " ", - " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", - " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\" : {\n \"NEW\" : \"b9d89c80-3d88-4311-8365-187323c96436\",\n \"ARCHIVE\": \"4da13a42-5d59-480c-ad8f-94a3adf809fe\"\n },\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" + "name": "Update Content Type with wrong workflow #2", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"doesNotExist\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Validates the proper error handling when a wrong workflow variable name is used." + }, + "response": [] }, - "description": "Updates a content type with `systemActionMappings`." - }, - "response": [] - }, - { - "name": "Update without systemActionMappings again", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings exist\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", - "});", - "", - "pm.test(\"Validate systemActionMappings\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.have.property('NEW');", - " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", - "});", - "", - "pm.test(\"Validate workflowAction.id\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " ", - " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", - " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", - "options": { - "raw": { - "language": "json" + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + } + }, + "response": [] }, - "description": "Updates a content type without `systemActionMappings` existing mappings should be unaffected." - }, - "response": [] - }, - { - "name": "Update with empty systemActionMappings again", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings is empty\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", - "});" + "name": "Archive Scheme", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\": {},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", - "options": { - "raw": { - "language": "json" + "body": { + "mode": "raw", + "raw": "{\"schemeName\": \"{{schemeName}}\", \"schemeArchived\": \"true\"}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "schemes", + "{{schemeId}}" + ] } - } + }, + "response": [] }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" + { + "name": "Delete Scheme", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type with empty `systemActionMappings` removing all existing mappings." - }, - "response": [] - }, - { - "name": "Update with systemActionMappings adding mappings again", + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "schemes", + "{{schemeId}}" + ] + } + }, + "response": [] + } + ], + "description": "Covering different update scenarios for saving workflows in a content type.", "event": [ { - "listen": "test", + "listen": "prerequest", "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings exist\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", - "});", - "", - "pm.test(\"Validate systemActionMappings\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.have.property('NEW');", - " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", - "});", - "", - "pm.test(\"Validate workflowAction.id\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " ", - " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", - " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", - "});" - ], "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\" : {\n \"NEW\" : \"b9d89c80-3d88-4311-8365-187323c96436\",\n \"ARCHIVE\": \"4da13a42-5d59-480c-ad8f-94a3adf809fe\"\n },\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", - "options": { - "raw": { - "language": "json" - } + "packages": {}, + "exec": [ + "" + ] } }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type with `systemActionMappings` adding mappings again as previous test deleted existing mappings." - }, - "response": [] - }, - { - "name": "Update with systemActionMappings adding more mappings", - "event": [ { "listen": "test", "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings exist\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", - "});", - "", - "pm.test(\"Validate systemActionMappings\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.have.property('NEW');", - " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", - " pm.expect(systemActionMappings).to.have.property('PUBLISH');", - "});", - "", - "pm.test(\"Validate workflowAction.id\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " ", - " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", - " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", - " pm.expect(systemActionMappings.PUBLISH.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", - "});" - ], "type": "text/javascript", - "packages": {} + "packages": {}, + "exec": [ + "" + ] } } + ] + } + ], + "description": "The content type allows to pass also a more estructured array of workflows where you can specify the id and variable for each workflow, these tests cases will cover diferent escenarios for this workflows list." + } + ], + "description": "Testing the diferent scenarios for saving workflows in a Content Type", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "ContentTypeForPages", + "item": [ + { + "name": "GetCurrentSite", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing workflow data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"currentSiteJost\", jsonData.entity.hostname);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/site/currentSite", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\" : {\n \"NEW\" : \"b9d89c80-3d88-4311-8365-187323c96436\",\n \"ARCHIVE\": \"4da13a42-5d59-480c-ad8f-94a3adf809fe\",\n \"PUBLISH\": \"b9d89c80-3d88-4311-8365-187323c96436\"\n },\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type with `systemActionMappings` adding extra mappings to the existing ones." - }, - "response": [] + "path": [ + "api", + "v1", + "site", + "currentSite" + ] + } + }, + "response": [] + }, + { + "name": "CreatePageWithSystemTemplate", + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \n}", + "options": { + "raw": { + "language": "json" + } + } }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] + } + }, + "response": [] + }, + { + "name": "CheckContentTypeForPages", + "event": [ { - "name": "Update by removing systemActionMappings", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing workflow data\", function () {", + " let jsonData = pm.response.json();", + " let length = jsonData.entity.length;", + " let currentPage = jsonData.pagination.currentPage;", + " let perPage = jsonData.pagination.perPage;", + " let totalEntries = jsonData.pagination.totalEntries;", + " ", + " pm.expect(length).to.greaterThan(0)", + " pm.expect(totalEntries).to.greaterThan(0)", + " pm.expect(perPage).to.eql(10)", + " pm.expect(currentPage).to.eql(1)", + "", + "});", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/page?pagePathOrId={{currentPageId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "page" + ], + "query": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate systemActionMappings exist\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", - "});", - "", - "pm.test(\"Validate systemActionMappings\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " pm.expect(systemActionMappings).to.not.have.property('NEW');", - " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", - " pm.expect(systemActionMappings).to.have.property('PUBLISH');", - "});", - "", - "pm.test(\"Validate workflowAction.id\", function () {", - " var systemActionMappings = pm.response.json().entity.systemActionMappings;", - " ", - " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", - " pm.expect(systemActionMappings.PUBLISH.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "pagePathOrId", + "value": "{{currentPageId}}" } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\" : {\n \"ARCHIVE\": \"4da13a42-5d59-480c-ad8f-94a3adf809fe\",\n \"PUBLISH\": \"b9d89c80-3d88-4311-8365-187323c96436\"\n },\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type by removing one `systemActionMappings`." - }, - "response": [] - }, + ] + } + }, + "response": [] + }, + { + "name": "CheckContentTypeForPagesByUrl", + "event": [ { - "name": "Delete ContentType", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing workflow data\", function () {", + " let jsonData = pm.response.json();", + " let length = jsonData.entity.length;", + " let currentPage = jsonData.pagination.currentPage;", + " let perPage = jsonData.pagination.perPage;", + " let totalEntries = jsonData.pagination.totalEntries;", + " ", + " pm.expect(length).to.greaterThan(0)", + " pm.expect(totalEntries).to.greaterThan(0)", + " pm.expect(perPage).to.eql(10)", + " pm.expect(currentPage).to.eql(1)", + "", + "});", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/page?pagePathOrId={{currentPageUrl}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "page" + ], + "query": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "key": "pagePathOrId", + "value": "{{currentPageUrl}}" } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Cleanup" - }, - "response": [] + ] } - ], - "description": "Folder to encapsulate multiple tests to validate the proper update and handling of `systemActionMappings`." - } - ], - "description": "Group of tests to cover the most common operations on the content type `systemActionMappings`.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } + }, + "response": [] }, { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } + "name": "CheckContentTypeForPagesBadRequest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400 \", function () {", + " pm.response.to.have.status(400);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/page?pagePathOrId=NONEXIST", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "page" + ], + "query": [ + { + "key": "pagePathOrId", + "value": "NONEXIST" + } + ] + } + }, + "response": [] } ] } @@ -14347,5 +11394,175 @@ ] } } + ], + "variable": [ + { + "key": "testDetailPagePageId1", + "value": "" + }, + { + "key": "testDetailPagePageURL1", + "value": "" + }, + { + "key": "testDetailPagePageId2", + "value": "" + }, + { + "key": "testDetailPagePageURL2", + "value": "" + }, + { + "key": "testDetailPagePageInode1", + "value": "" + }, + { + "key": "testDetailPagePageInode2", + "value": "" + }, + { + "key": "contentTypeID", + "value": "" + }, + { + "key": "contentTypeVAR", + "value": "" + }, + { + "key": "contentTypeFieldID", + "value": "" + }, + { + "key": "pageDetailSiteId", + "value": "" + }, + { + "key": "pageDetailSiteName", + "value": "" + }, + { + "key": "contentTypeId", + "value": "" + }, + { + "key": "pageDetailPageId1", + "value": "" + }, + { + "key": "pageDetailPageInode1", + "value": "" + }, + { + "key": "pageDetailPageURL1", + "value": "" + }, + { + "key": "pageDetailPageId2", + "value": "" + }, + { + "key": "pageDetailPageInode2", + "value": "" + }, + { + "key": "pageDetailPageURL2", + "value": "" + }, + { + "key": "contentTypeVariable", + "value": "" + }, + { + "key": "contentTypeField1Id", + "value": "" + }, + { + "key": "contentTypeField1Variable", + "value": "" + }, + { + "key": "skipPreResquest", + "value": "" + }, + { + "key": "currentSiteJost", + "value": "" + }, + { + "key": "currentPageId", + "value": "" + }, + { + "key": "url", + "value": "" + }, + { + "key": "currentPageUrl", + "value": "" + }, + { + "key": "contentTypeIdWithStoryBlock", + "value": "" + }, + { + "key": "contentType.host", + "value": "" + }, + { + "key": "contentType.field1", + "value": "" + }, + { + "key": "contentType.field2", + "value": "" + }, + { + "key": "contentType.field3", + "value": "" + }, + { + "key": "contentType.field4", + "value": "" + }, + { + "key": "contentType.field4.varName", + "value": "" + }, + { + "key": "contentType.divider", + "value": "" + }, + { + "key": "contentType.columnDivider", + "value": "" + }, + { + "key": "contentType.field4.fieldVarOne.id", + "value": "" + }, + { + "key": "contentType.field4.fieldVarOne.key", + "value": "" + }, + { + "key": "fieldTypesArr", + "value": "" + }, + { + "key": "schemeId", + "value": "" + }, + { + "key": "schemeName", + "value": "" + }, + { + "key": "schemeVariableName", + "value": "" + }, + { + "key": "fields", + "value": "" + } ] } \ No newline at end of file From 8845d2d71287f53eaa3d4031526252f8167c499b Mon Sep 17 00:00:00 2001 From: jdotcms Date: Tue, 15 Jul 2025 10:29:44 -0600 Subject: [PATCH 14/24] #32238 adding the swagger yaml --- .../main/webapp/WEB-INF/openapi/openapi.yaml | 137 ++++++++++++++++-- 1 file changed, 126 insertions(+), 11 deletions(-) diff --git a/dotCMS/src/main/webapp/WEB-INF/openapi/openapi.yaml b/dotCMS/src/main/webapp/WEB-INF/openapi/openapi.yaml index 624932650f29..9658a947f13c 100644 --- a/dotCMS/src/main/webapp/WEB-INF/openapi/openapi.yaml +++ b/dotCMS/src/main/webapp/WEB-INF/openapi/openapi.yaml @@ -2848,11 +2848,11 @@ paths: summary: Fire an user custom event. tags: - Content Analytics - /v1/analytics/content/sitekey/generate/{siteId}: + /v1/analytics/content/siteconfig/{siteId}: get: - description: Generates and returns a Site Key that must be used by the client-side - JS code to send custom Content Analytics Events - operationId: generateSiteKey + description: Returns the expected JS configuration object that must be used + for client-side JS code to send custom Events + operationId: getSiteConfig parameters: - in: path name: siteId @@ -2861,18 +2861,18 @@ paths: type: string responses: "200": - description: The Site key was generated and returned successfully + description: The Site configuration was returned successfully "400": description: Bad Request - "401": - description: Unauthorized + "403": + description: Forbidden "404": - description: Site ID in path is not found or incorrect path - "405": - description: Method Not Allowed + description: Site ID in path is not present + "415": + description: Unsupported Media Type "500": description: Internal Server Error - summary: Generate Site Key + summary: Site Configuration tags: - Content Analytics /v1/announcements: @@ -6463,6 +6463,121 @@ paths: summary: Updates a content type tags: - Content Type + /v1/contenttype/page: + get: + description: Returns a list of content type objects based on the filtering criteria. + operationId: getPagesContentTypes + parameters: + - description: The URL or Identifier of the page to filter content types for + the palette + in: query + name: pagePathOrId + schema: + type: string + - description: Optional Language id + in: query + name: language + schema: + type: string + default: "-1" + - description: String to filter/search for specific content types; leave blank + to return all. + in: query + name: filter + schema: + type: string + - description: |- + Page number in response pagination. + + Default: `1` + in: query + name: page + schema: + type: integer + format: int64 + default: 1 + - description: |- + Number of results per page for pagination. + + Default: `10` + in: query + name: per_page + schema: + type: integer + format: int64 + default: 10 + - description: |- + Column(s) to sort the results. Multiple columns can be combined in a comma-separated list. Column names can also be set within a SQL string function, such as `upper()`. + + Some possible values: + + `name`, `velocity_var_name`, `mod_date`, `sort_order` + + `description`, `structuretype`, `category`, `inode` + in: query + name: orderby + schema: + type: string + default: usage + - description: "Sort direction: choose between ascending or descending." + in: query + name: direction + schema: + type: string + default: ASC + enum: + - ASC + - DESC + - description: Filter by site identifier. + in: query + name: host + schema: + type: string + responses: + "200": + content: + application/json: + example: + entity: + - baseType: string + clazz: string + defaultType: true + description: string + fixed: true + folder: string + folderPath: string + host: string + iDate: 0 + icon: string + id: string + layout: [] + metadata: {} + modDate: 0 + multilingualable: true + nEntries: 0 + name: string + siteName: string + sortOrder: 0 + system: true + variable: string + versionable: true + workflows: [] + errors: [] + i18nMessagesMap: {} + messages: [] + pagination: + currentPage: 0 + perPage: 0 + totalEntries: 0 + permissions: [] + description: Content types retrieved successfully + "403": + description: Forbidden + "500": + description: Internal Server Error + summary: Retrieves a list of content types for a page + tags: + - Content Type /v1/contenttype/{baseVariableName}/_copy: post: description: |- From 2e7a64a6277a8f6a8ccb32b8e3b710aa9c38ec74 Mon Sep 17 00:00:00 2001 From: jdotcms Date: Wed, 16 Jul 2025 12:09:33 -0600 Subject: [PATCH 15/24] #32238 adding some swagger doc --- .../v1/contenttype/ContentTypeResource.java | 8 +++--- .../main/webapp/WEB-INF/openapi/openapi.yaml | 26 +++++++++++-------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java b/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java index 5528b2b58aaa..9f3f9837aa11 100644 --- a/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java +++ b/dotCMS/src/main/java/com/dotcms/rest/api/v1/contenttype/ContentTypeResource.java @@ -1573,15 +1573,14 @@ private T getFilterValue(final FilteredContentTypesForm form, final String p } /** - * Returns a list of {@link ContentType} objects based on the filtering criteria. This is how - * you can call this endpoint: + * Returns a list of {@link ContentType} objects based on the page containers/types on the layout *
{@code
-	 * GET http://localhost:8080/api/v1/contenttype?sites=48190c8c-42c4-46af-8d1a-0cd5db894797,SYSTEM_HOST,&per_page=40&&orderby=variabledirection=DESC
+	 * GET http://localhost:8080/api/v1/contenttype/page?pagePathOrId=48190c8c-42c4-46af-8d1a-0cd5db894797
 	 * }
*

If you want results composed of 10 items per page and you want the third page, and you * don't have the Site's Identifier, you can call this URL:

*
{@code
-	 * GET http://localhost:8080/api/v1/contenttype?sites=demo.dotcms.com&page=3&per_page=10
+	 * GET http://localhost:8080/api/v1/contenttype/page?pagePathOrId=48190c8c-42c4-46af-8d1a-0cd5db894797
 	 * }
* * @param httpRequest The current instance of the {@link HttpServletRequest}. @@ -1609,6 +1608,7 @@ private T getFilterValue(final FilteredContentTypesForm form, final String p @NoCache @Consumes(MediaType.APPLICATION_JSON) @Produces({MediaType.APPLICATION_JSON, "application/javascript"}) + @Tag(name = "getPagesContentTypes", description = "Returns the content types valid for a page based on the container/types on the layout") @Operation( operationId = "getPagesContentTypes", summary = "Retrieves a list of content types for a page", diff --git a/dotCMS/src/main/webapp/WEB-INF/openapi/openapi.yaml b/dotCMS/src/main/webapp/WEB-INF/openapi/openapi.yaml index 9658a947f13c..17832a154ccd 100644 --- a/dotCMS/src/main/webapp/WEB-INF/openapi/openapi.yaml +++ b/dotCMS/src/main/webapp/WEB-INF/openapi/openapi.yaml @@ -48,6 +48,9 @@ tags: name: Containers - description: Endpoints for managing content and contentlets name: Content +- description: Returns the content types valid for a page based on the container/types + on the layout + name: getPagesContentTypes - description: Endpoints for managing folder structure and organization name: Folders - description: Form management and processing @@ -2848,11 +2851,11 @@ paths: summary: Fire an user custom event. tags: - Content Analytics - /v1/analytics/content/siteconfig/{siteId}: + /v1/analytics/content/sitekey/generate/{siteId}: get: - description: Returns the expected JS configuration object that must be used - for client-side JS code to send custom Events - operationId: getSiteConfig + description: Generates and returns a Site Key that must be used by the client-side + JS code to send custom Content Analytics Events + operationId: generateSiteKey parameters: - in: path name: siteId @@ -2861,18 +2864,18 @@ paths: type: string responses: "200": - description: The Site configuration was returned successfully + description: The Site key was generated and returned successfully "400": description: Bad Request - "403": - description: Forbidden + "401": + description: Unauthorized "404": - description: Site ID in path is not present - "415": - description: Unsupported Media Type + description: Site ID in path is not found or incorrect path + "405": + description: Method Not Allowed "500": description: Internal Server Error - summary: Site Configuration + summary: Generate Site Key tags: - Content Analytics /v1/announcements: @@ -6577,6 +6580,7 @@ paths: description: Internal Server Error summary: Retrieves a list of content types for a page tags: + - getPagesContentTypes - Content Type /v1/contenttype/{baseVariableName}/_copy: post: From ee0b8fa0d47c29017ffffcb06d2d685c20fe8453 Mon Sep 17 00:00:00 2001 From: jdotcms Date: Thu, 17 Jul 2025 12:54:31 -0600 Subject: [PATCH 16/24] #32238 adding fixes for ct postman --- .../postman/ContentTypeResourceTests.json | 192 +++++++++++++++++- 1 file changed, 182 insertions(+), 10 deletions(-) diff --git a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json index 7f27dce0d2da..73217eaf891b 100644 --- a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json +++ b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json @@ -6741,7 +6741,7 @@ " var jsonData = pm.response.json();", " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", + " pm.collectionVariables.set(\"fields\", JSON.stringify(jsonData.entity[0].fields));", "});" ], "type": "text/javascript", @@ -6841,11 +6841,21 @@ } ], "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, "method": "PUT", "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": {{fields}}\n}", "options": { "raw": { "language": "json" @@ -6896,11 +6906,21 @@ } ], "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, "method": "PUT", "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": {{fields}}\n}", "options": { "raw": { "language": "json" @@ -6941,11 +6961,21 @@ } ], "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, "method": "PUT", "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": {{fields}}\n}", "options": { "raw": { "language": "json" @@ -6996,11 +7026,21 @@ } ], "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, "method": "PUT", "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": {{fields}}\n}", "options": { "raw": { "language": "json" @@ -7051,11 +7091,21 @@ } ], "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, "method": "PUT", "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": {{fields}}\n}", "options": { "raw": { "language": "json" @@ -7106,11 +7156,21 @@ } ], "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, "method": "PUT", "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"does-not-exist\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"does-not-exist\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": {{fields}}\n}", "options": { "raw": { "language": "json" @@ -7161,11 +7221,21 @@ } ], "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, "method": "PUT", "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": {{fields}}\n}", "options": { "raw": { "language": "json" @@ -7216,11 +7286,21 @@ } ], "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, "method": "PUT", "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"doesnotexist\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"doesnotexist\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": {{fields}}\n}", "options": { "raw": { "language": "json" @@ -7261,6 +7341,16 @@ } ], "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, "method": "PUT", "header": [], "body": { @@ -7306,6 +7396,16 @@ } ], "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, "method": "DELETE", "header": [], "url": { @@ -7326,7 +7426,79 @@ "response": [] } ], - "description": "On this set of tests we are going to test multiple updates permutations." + "description": "On this set of tests we are going to test multiple updates permutations.", + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "if (!pm.environment.get('jwt')) {", + " console.log(\"generating....\")", + " const serverURL = pm.environment.get('serverURL'); // Get the server URL from the environment variable", + " const apiUrl = `${serverURL}/api/v1/apitoken`; // Construct the full API URL", + "", + " if (!pm.environment.get('jwt')) {", + " const username = pm.environment.get(\"user\");", + " const password = pm.environment.get(\"password\");", + " const basicAuth = Buffer.from(`${username}:${password}`).toString('base64');", + "", + " const requestOptions = {", + " url: apiUrl,", + " method: \"POST\",", + " header: {", + " \"accept\": \"*/*\",", + " \"content-type\": \"application/json\",", + " \"Authorization\": `Basic ${basicAuth}`", + " },", + " body: {", + " mode: \"raw\",", + " raw: JSON.stringify({", + " \"expirationSeconds\": 7200,", + " \"userId\": \"dotcms.org.1\",", + " \"network\": \"0.0.0.0/0\",", + " \"claims\": {\"label\": \"postman-tests\"}", + " })", + " }", + " };", + "", + " pm.sendRequest(requestOptions, function (err, response) {", + " if (err) {", + " console.log(err);", + " } else {", + " const jwt = response.json().entity.jwt;", + " pm.environment.set('jwt', jwt);", + " console.log(jwt);", + " }", + " });", + " }", + "}", + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] } ], "description": "In this folder we test different scenarios for handling the Content Type where we validate cases in order to not always rely on the Content Type ID." From 38bb43b6cf8d4cadf39e83bd1b3a33745ca3838b Mon Sep 17 00:00:00 2001 From: jdotcms Date: Thu, 17 Jul 2025 14:08:31 -0600 Subject: [PATCH 17/24] #32238 adding fixes for ct postman --- .../postman/ContentTypeResourceTests.json | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json index 73217eaf891b..9d57f9bf3713 100644 --- a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json +++ b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json @@ -6750,6 +6750,16 @@ } ], "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, "method": "POST", "header": [ { @@ -6795,6 +6805,16 @@ } ], "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, "method": "GET", "header": [], "url": { @@ -7424,6 +7444,14 @@ "description": "Cleanup" }, "response": [] + }, + { + "name": "New Request", + "request": { + "method": "GET", + "header": [] + }, + "response": [] } ], "description": "On this set of tests we are going to test multiple updates permutations.", From 1324ece8553223d9ab754871fe03f2b9b89e183b Mon Sep 17 00:00:00 2001 From: jdotcms Date: Tue, 5 Aug 2025 12:16:29 -0600 Subject: [PATCH 18/24] #32238 fixing postman issues --- .../ContentTypePages.postman_collection.json | 332 ++++++++++++++++++ .../postman/ContentTypeResourceTests.json | 260 -------------- 2 files changed, 332 insertions(+), 260 deletions(-) create mode 100644 dotcms-postman/src/main/resources/postman/ContentTypePages.postman_collection.json diff --git a/dotcms-postman/src/main/resources/postman/ContentTypePages.postman_collection.json b/dotcms-postman/src/main/resources/postman/ContentTypePages.postman_collection.json new file mode 100644 index 000000000000..0d6e665096bb --- /dev/null +++ b/dotcms-postman/src/main/resources/postman/ContentTypePages.postman_collection.json @@ -0,0 +1,332 @@ +{ + "info": { + "_postman_id": "45b68571-8ba8-4364-8f24-bdd277843329", + "name": "ContentTypePages", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "781456" + }, + "item": [ + { + "name": "ContentTypeForPages", + "item": [ + { + "name": "GetCurrentSite", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing workflow data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"currentSiteJost\", jsonData.entity.hostname);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/site/currentSite", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "site", + "currentSite" + ] + } + }, + "response": [] + }, + { + "name": "CreatePageWithSystemTemplate", + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] + } + }, + "response": [] + }, + { + "name": "CheckContentTypeForPages", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing workflow data\", function () {", + " let jsonData = pm.response.json();", + " let length = jsonData.entity.length;", + " let currentPage = jsonData.pagination.currentPage;", + " let perPage = jsonData.pagination.perPage;", + " let totalEntries = jsonData.pagination.totalEntries;", + " ", + " pm.expect(length).to.greaterThan(0)", + " pm.expect(totalEntries).to.greaterThan(0)", + " pm.expect(perPage).to.eql(10)", + " pm.expect(currentPage).to.eql(1)", + "", + "});", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/page?pagePathOrId={{currentPageId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "page" + ], + "query": [ + { + "key": "pagePathOrId", + "value": "{{currentPageId}}" + } + ] + } + }, + "response": [] + }, + { + "name": "CheckContentTypeForPagesByUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing workflow data\", function () {", + " let jsonData = pm.response.json();", + " let length = jsonData.entity.length;", + " let currentPage = jsonData.pagination.currentPage;", + " let perPage = jsonData.pagination.perPage;", + " let totalEntries = jsonData.pagination.totalEntries;", + " ", + " pm.expect(length).to.greaterThan(0)", + " pm.expect(totalEntries).to.greaterThan(0)", + " pm.expect(perPage).to.eql(10)", + " pm.expect(currentPage).to.eql(1)", + "", + "});", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/page?pagePathOrId={{currentPageUrl}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "page" + ], + "query": [ + { + "key": "pagePathOrId", + "value": "{{currentPageUrl}}" + } + ] + } + }, + "response": [] + }, + { + "name": "CheckContentTypeForPagesBadRequest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400 \", function () {", + " pm.response.to.have.status(400);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/page?pagePathOrId=NONEXIST", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "page" + ], + "query": [ + { + "key": "pagePathOrId", + "value": "NONEXIST" + } + ] + } + }, + "response": [] + } + ] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "if (!pm.environment.get('jwt')) {", + " console.log(\"generating....\")", + " const serverURL = pm.environment.get('serverURL'); // Get the server URL from the environment variable", + " const apiUrl = `${serverURL}/api/v1/apitoken`; // Construct the full API URL", + "", + " if (!pm.environment.get('jwt')) {", + " const username = pm.environment.get(\"user\");", + " const password = pm.environment.get(\"password\");", + " const basicAuth = Buffer.from(`${username}:${password}`).toString('base64');", + "", + " const requestOptions = {", + " url: apiUrl,", + " method: \"POST\",", + " header: {", + " \"accept\": \"*/*\",", + " \"content-type\": \"application/json\",", + " \"Authorization\": `Basic ${basicAuth}`", + " },", + " body: {", + " mode: \"raw\",", + " raw: JSON.stringify({", + " \"expirationSeconds\": 7200,", + " \"userId\": \"dotcms.org.1\",", + " \"network\": \"0.0.0.0/0\",", + " \"claims\": {\"label\": \"postman-tests\"}", + " })", + " }", + " };", + "", + " pm.sendRequest(requestOptions, function (err, response) {", + " if (err) {", + " console.log(err);", + " } else {", + " const jwt = response.json().entity.jwt;", + " pm.environment.set('jwt', jwt);", + " console.log(jwt);", + " }", + " });", + " }", + "}", + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] +} \ No newline at end of file diff --git a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json index 9d57f9bf3713..a6e071a2f06b 100644 --- a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json +++ b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json @@ -11263,266 +11263,6 @@ } } ] - }, - { - "name": "ContentTypeForPages", - "item": [ - { - "name": "GetCurrentSite", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200 \", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing workflow data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"currentSiteJost\", jsonData.entity.hostname);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/site/currentSite", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "site", - "currentSite" - ] - } - }, - "response": [] - }, - { - "name": "CreatePageWithSystemTemplate", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "PUBLISH" - ] - } - }, - "response": [] - }, - { - "name": "CheckContentTypeForPages", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200 \", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing workflow data\", function () {", - " let jsonData = pm.response.json();", - " let length = jsonData.entity.length;", - " let currentPage = jsonData.pagination.currentPage;", - " let perPage = jsonData.pagination.perPage;", - " let totalEntries = jsonData.pagination.totalEntries;", - " ", - " pm.expect(length).to.greaterThan(0)", - " pm.expect(totalEntries).to.greaterThan(0)", - " pm.expect(perPage).to.eql(10)", - " pm.expect(currentPage).to.eql(1)", - "", - "});", - "", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/page?pagePathOrId={{currentPageId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "page" - ], - "query": [ - { - "key": "pagePathOrId", - "value": "{{currentPageId}}" - } - ] - } - }, - "response": [] - }, - { - "name": "CheckContentTypeForPagesByUrl", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200 \", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing workflow data\", function () {", - " let jsonData = pm.response.json();", - " let length = jsonData.entity.length;", - " let currentPage = jsonData.pagination.currentPage;", - " let perPage = jsonData.pagination.perPage;", - " let totalEntries = jsonData.pagination.totalEntries;", - " ", - " pm.expect(length).to.greaterThan(0)", - " pm.expect(totalEntries).to.greaterThan(0)", - " pm.expect(perPage).to.eql(10)", - " pm.expect(currentPage).to.eql(1)", - "", - "});", - "", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/page?pagePathOrId={{currentPageUrl}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "page" - ], - "query": [ - { - "key": "pagePathOrId", - "value": "{{currentPageUrl}}" - } - ] - } - }, - "response": [] - }, - { - "name": "CheckContentTypeForPagesBadRequest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 400 \", function () {", - " pm.response.to.have.status(400);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/page?pagePathOrId=NONEXIST", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "page" - ], - "query": [ - { - "key": "pagePathOrId", - "value": "NONEXIST" - } - ] - } - }, - "response": [] - } - ] } ], "auth": { From 075e43a2f3bc81b3a293b32ac237107d1ac748a4 Mon Sep 17 00:00:00 2001 From: jdotcms Date: Tue, 5 Aug 2025 15:17:22 -0600 Subject: [PATCH 19/24] #32238 fixing postman issues --- .../postman/ContentTypeResourceTests.json | 14677 +++++++++------- 1 file changed, 8760 insertions(+), 5917 deletions(-) diff --git a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json index a6e071a2f06b..2518e2a00ec0 100644 --- a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json +++ b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json @@ -1,9 +1,9 @@ { "info": { - "_postman_id": "4eaa447a-cad4-46a5-ba2d-0cd107dfbc79", + "_postman_id": "173bf579-93b9-497b-baee-8f9c48e58b71", "name": "ContentType Resource", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "781456" + "_exporter_id": "36604690" }, "item": [ { @@ -20,7 +20,7 @@ "", "pm.collectionVariables.set(\"contentTypeID\", jsonData.entity[0].id);", "pm.collectionVariables.set(\"contentTypeVAR\", jsonData.entity[0].variable);", - "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[0].id);", + "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[2].id);", "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", @@ -41,12 +41,26 @@ ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { - "key": "token", - "value": "{{jwt}}", + "key": "username", + "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, @@ -95,23 +109,34 @@ "", "pm.test(\"sortOrder check\", function () {", " pm.expect(jsonData.entity.sortOrder).to.eql(3);", - "});", - "", - "pm.collectionVariables.set(\"fields\", JSON.stringify(jsonData.entity.fields));" + "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { - "key": "token", - "value": "{{jwt}}", + "key": "username", + "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, @@ -155,19 +180,32 @@ " pm.expect(jsonData.entity.sortOrder).to.eql(2);", "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { - "key": "token", - "value": "{{jwt}}", + "key": "username", + "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, @@ -175,7 +213,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"My Custom Structure {{$randomBankAccount}}\",\n\t\"variable\": \"{{contentTypeVAR}}\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n\t\"fields\": {{fields}},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"My Custom Structure {{$randomBankAccount}}\",\n\t\"variable\": \"{{contentTypeVAR}}\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeID}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": true,\n \"iDate\": 1631719532000,\n \"id\": \"{{contentTypeFieldID}}\",\n \"indexed\": true,\n \"listed\": true,\n \"modDate\": 1631719532000,\n \"name\": \"Name\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name\"\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", "options": { "raw": { "language": "json" @@ -220,19 +258,32 @@ " pm.expect(jsonData.entity.sortOrder).to.eql(2);", "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { - "key": "token", - "value": "{{jwt}}", + "key": "username", + "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, @@ -240,7 +291,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure test\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"My Custom Structure {{$randomBankAccount}}\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n\t\"fields\": {{fields}},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure test\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"My Custom Structure {{$randomBankAccount}}\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeID}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": true,\n \"iDate\": 1631719532000,\n \"id\": \"{{contentTypeFieldID}}\",\n \"indexed\": true,\n \"listed\": true,\n \"modDate\": 1631719532000,\n \"name\": \"Name\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name\"\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", "options": { "raw": { "language": "json" @@ -275,19 +326,32 @@ " pm.response.to.have.status(200);", "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { - "key": "token", - "value": "{{jwt}}", + "key": "username", + "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, @@ -316,61 +380,614 @@ "name": "Test CRUD Fields", "item": [ { - "name": "Create ContentType", - "event": [ + "name": "Filtering Fields", + "item": [ { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.collectionVariables.set(\"contentTypeID\", jsonData.entity[0].id);", - "pm.collectionVariables.set(\"contentTypeVAR\", jsonData.entity[0].variable);", - "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[0].id);", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"fields check\", function () {", - " ", - " pm.expect(jsonData.entity[0].fields.length).to.be.above(2);", - "});", - "", - "pm.test(\"description check\", function () {", - " pm.expect(jsonData.entity[0].description).to.eql('THE DESCRIPTION');", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ + "name": "Generate Test Data", + "item": [ { - "key": "token", - "value": "{{jwt}}", - "type": "string" + "name": "Create Test Content Type", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.collectionVariables.set(\"typeNameWithMetadata\", \"test-type-\" + \"{{$randomInt}}\");" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Test Content Type was created successfully\", function () {", + " const jsonData = pm.response.json();", + " const entity = jsonData.entity[0];", + " pm.expect(jsonData.errors.length).to.eql(0);", + " pm.collectionVariables.set(\"contentTypeId\", entity.id);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"defaultType\": false,\n \"icon\": null,\n \"fixed\": false,\n \"system\": false,\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\": \"\",\n \"host\": \"48190c8c-42c4-46af-8d1a-0cd5db894797\",\n \"name\": \"My Test CT\",\n \"metadata\": {\n \"edit_mode\": true\n },\n \"systemActionMappings\": {\n \"NEW\": \"\"\n },\n \"workflow\": [\n \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + } + }, + "response": [] + }, + { + "name": "Add Fields to Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Test Content Type Fields were created successfully\", function () {", + " const jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"layout\": [\n {\n \"divider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"iDate\": 1705078587000,\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1705078587000,\n \"name\": \"Row Field\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": -1,\n \"unique\": false\n },\n \"columns\": [\n {\n \"columnDivider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"iDate\": 1705078587000,\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1705078587000,\n \"name\": \"Column Field\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": -1,\n \"unique\": false\n },\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"name\": \"Title\",\n \"dataType\": \"TEXT\",\n \"regexCheck\": \"\",\n \"defaultValue\": \"\",\n \"hint\": \"\",\n \"required\": true,\n \"searchable\": true,\n \"listed\": true,\n \"unique\": false,\n \"id\": null\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"name\": \"Description\",\n \"dataType\": \"TEXT\",\n \"regexCheck\": \"\",\n \"defaultValue\": \"\",\n \"hint\": \"\",\n \"required\": false,\n \"searchable\": true,\n \"listed\": false,\n \"unique\": false,\n \"id\": null\n }\n ]\n }\n ]\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/move", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v3", + "contenttype", + "{{contentTypeId}}", + "fields", + "move" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "pm.test(\"HTTP Status code must be successful\", function () {", + " pm.response.to.have.status(200);", + "});", + "" + ] + } } ] }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\", \n \"defaultType\": false, \n \"name\": \"Test Content Type\", \n \"description\": \"THE DESCRIPTION\", \n \"host\": \"SYSTEM_HOST\", \n \"owner\": \"dotcms.org.1\", \n \"fixed\": false, \n \"system\": false, \n \"folder\": \"SYSTEM_FOLDER\",\n \"fields\": [\n {\n \"dataType\": \"SYSTEM\",\n \"dbColumn\": \"system_field1\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Host/Folder\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n },\n {\n \"dataType\": \"LONG_TEXT\",\n \"dbColumn\": \"text_area2\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1453474468000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTagField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Tags\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"tags\"\n }],\n \"workflow\": [\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}\n" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ + { + "name": "Success", + "item": [ + { + "name": "Filter By Required Fields", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Data was returned successfully\", function () {", + " const jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});", + "", + "pm.test(\"There must be only one 'Required' field\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.equal(1, \"Just one field must be marked as 'Required'\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=REQUIRED", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v3", + "contenttype", + "{{contentTypeId}}", + "fields", + "allfields" + ], + "query": [ + { + "key": "filter", + "value": "REQUIRED" + } + ] + } + }, + "response": [] + }, + { + "name": "Filter By Indexed Fields", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Data was returned successfully\", function () {", + " const jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});", + "", + "pm.test(\"There must be two 'System Indexed' fields\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.equal(2, \"Two fields must be marked as 'System Indexed'\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=SYSTEM_INDEXED", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v3", + "contenttype", + "{{contentTypeId}}", + "fields", + "allfields" + ], + "query": [ + { + "key": "filter", + "value": "SYSTEM_INDEXED" + } + ] + } + }, + "response": [] + }, + { + "name": "Filter By Several Criteria", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Data was returned successfully\", function () {", + " const jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});", + "", + "pm.test(\"There must be only one 'Required', 'User Searchable', and 'Show in List' field\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.equal(1, \"Just one field must be marked as 'Required', 'User Searchable', and 'Show in List' field\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=REQUIRED&filter=USER_SEARCHABLE&filter=SHOW_IN_LIST", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v3", + "contenttype", + "{{contentTypeId}}", + "fields", + "allfields" + ], + "query": [ + { + "key": "filter", + "value": "REQUIRED" + }, + { + "key": "filter", + "value": "USER_SEARCHABLE" + }, + { + "key": "filter", + "value": "SHOW_IN_LIST" + } + ] + } + }, + "response": [] + }, + { + "name": "Filter By Non-met Criteria", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Data was returned successfully\", function () {", + " const jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});", + "", + "pm.test(\"No field must match 'Required', 'User Searchable', 'Show in List' and 'Unique'\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.equal(0, \"No field must match the four specified filters\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=REQUIRED&filter=USER_SEARCHABLE&filter=SHOW_IN_LIST&filter=UNIQUE", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v3", + "contenttype", + "{{contentTypeId}}", + "fields", + "allfields" + ], + "query": [ + { + "key": "filter", + "value": "REQUIRED" + }, + { + "key": "filter", + "value": "USER_SEARCHABLE" + }, + { + "key": "filter", + "value": "SHOW_IN_LIST" + }, + { + "key": "filter", + "value": "UNIQUE" + } + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "pm.test(\"HTTP Status code must be successful\", function () {", + " pm.response.to.have.status(200);", + "});", + "" + ] + } + } + ] + }, + { + "name": "Failure", + "item": [ + { + "name": "Log User out", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/dotAdmin/logout", + "host": [ + "{{serverURL}}" + ], + "path": [ + "dotAdmin", + "logout" + ] + }, + "description": "This request just makes sure that the next request does NOT have an authenticated User." + }, + "response": [] + }, + { + "name": "No Authentication", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 'Unauthorized'\", function () {", + " pm.response.to.have.status(401);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=REQUIRED", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v3", + "contenttype", + "{{contentTypeId}}", + "fields", + "allfields" + ], + "query": [ + { + "key": "filter", + "value": "REQUIRED" + } + ] + } + }, + "response": [] + }, + { + "name": "Using Invalid Filter", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 'Bad Request'\", function () {", + " pm.response.to.have.status(400);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeId}}/fields/allfields?filter=INVALID_FILTER", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v3", + "contenttype", + "{{contentTypeId}}", + "fields", + "allfields" + ], + "query": [ + { + "key": "filter", + "value": "INVALID_FILTER" + } + ] + } + }, + "response": [] + }, + { + "name": "Using Invalid Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 'Not Found'\", function () {", + " pm.response.to.have.status(404);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v3/contenttype/INVALID_CONTENT_TYPE/fields/allfields?filter=REQUIRED", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v3", + "contenttype", + "INVALID_CONTENT_TYPE", + "fields", + "allfields" + ], + "query": [ + { + "key": "filter", + "value": "REQUIRED" + } + ] + } + }, + "response": [] + } + ] + } + ] + }, + { + "name": "Create ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.collectionVariables.set(\"contentTypeID\", jsonData.entity[0].id);", + "pm.collectionVariables.set(\"contentTypeVAR\", jsonData.entity[0].variable);", + "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[2].id);", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"fields check\", function () {", + " pm.expect(jsonData.entity[0].fields.length).to.eql(4);", + "});", + "", + "pm.test(\"description check\", function () {", + " pm.expect(jsonData.entity[0].description).to.eql('THE DESCRIPTION');", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\", \n \"defaultType\": false, \n \"name\": \"Test Content Type\", \n \"description\": \"THE DESCRIPTION\", \n \"host\": \"SYSTEM_HOST\", \n \"owner\": \"dotcms.org.1\", \n \"fixed\": false, \n \"system\": false, \n \"folder\": \"SYSTEM_FOLDER\",\n \"fields\": [\n {\n \"dataType\": \"SYSTEM\",\n \"dbColumn\": \"system_field1\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Host/Folder\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n },\n {\n \"dataType\": \"LONG_TEXT\",\n \"dbColumn\": \"text_area2\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1453474468000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTagField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Tags\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"tags\"\n }],\n \"workflow\": [\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}\n" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ "{{serverURL}}" ], "path": [ @@ -398,17 +1015,12 @@ "", "", "pm.test(\"fields check\", function () {", - " pm.expect(jsonData.entity.fields.length).to.gte(2);", + " pm.expect(jsonData.entity.fields.length).to.eql(4);", "});", "", "pm.test(\"description check\", function () {", " pm.expect(jsonData.entity.description).to.eql('THE DESCRIPTION');", - "});", - "", - "let fields = jsonData.entity.fields.filter(field => field.variable !== 'tags');", - "", - "", - "pm.collectionVariables.set(\"fields\", JSON.stringify(fields));" + "});" ], "type": "text/javascript", "packages": {} @@ -417,12 +1029,26 @@ ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { - "key": "token", - "value": "{{jwt}}", + "key": "username", + "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, @@ -466,19 +1092,32 @@ " pm.expect(jsonData.entity.description).to.eql('THE DESCRIPTION');", "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { - "key": "token", - "value": "{{jwt}}", + "key": "username", + "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, @@ -486,7 +1125,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"THE DESCRIPTION\",\n \"fields\":{{fields}},\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"Test Content Type\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"THE DESCRIPTION\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"contentTypeId\": \"{{contentTypeID}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Host-Folder\",\n \"fieldTypeLabel\": \"Site or Folder\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"id\": \"{{contentTypeFieldID}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1632506750000,\n \"name\": \"Host/Folder CHANGED\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n }\n ],\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"Test Content Type\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", "options": { "raw": { "language": "json" @@ -521,24 +1160,279 @@ " pm.response.to.have.status(200);", "});" ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeID}}" + ] + }, + "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." + }, + "response": [] + }, + { + "name": "Create ContentType Unsupported Media Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate the response status is 415", + "pm.test(\"Response status is 415\", function () {", + " pm.response.to.have.status(415);", + "});", + "", + "// Validate that the response body contains the 'message' property and it is not empty", + "pm.test(\"Response should have an error message\", function () {", + " const responseBody = pm.response.json();", + " pm.expect(responseBody).to.have.property('message').that.is.not.empty;", + " pm.expect(responseBody.message).to.equal('HTTP 415 Unsupported Media Type');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/javascript" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\", \n \"defaultType\": false, \n \"name\": \"Test Content Type\", \n \"description\": \"THE DESCRIPTION\", \n \"host\": \"SYSTEM_HOST\", \n \"owner\": \"dotcms.org.1\", \n \"fixed\": false, \n \"system\": false, \n \"folder\": \"SYSTEM_FOLDER\",\n \"fields\": [\n {\n \"dataType\": \"SYSTEM\",\n \"dbColumn\": \"system_field1\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Host/Folder\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n },\n {\n \"dataType\": \"LONG_TEXT\",\n \"dbColumn\": \"text_area2\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1453474468000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTagField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Tags\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"tags\"\n }],\n \"workflow\": [\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}\n" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." + }, + "response": [] + }, + { + "name": "Filter ContentType Unsupported Media Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate the response status is 415", + "pm.test(\"Response status is 415\", function () {", + " pm.response.to.have.status(415);", + "});", + "", + "// Validate that the response body contains the 'message' property and it is not empty", + "pm.test(\"Response should have an error message\", function () {", + " const responseBody = pm.response.json();", + " pm.expect(responseBody).to.have.property('message').that.is.not.empty;", + " pm.expect(responseBody.message).to.equal('HTTP 415 Unsupported Media Type');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/javascript" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\", \n \"defaultType\": false, \n \"name\": \"Test Content Type\", \n \"description\": \"THE DESCRIPTION\", \n \"host\": \"SYSTEM_HOST\", \n \"owner\": \"dotcms.org.1\", \n \"fixed\": false, \n \"system\": false, \n \"folder\": \"SYSTEM_FOLDER\",\n \"fields\": [\n {\n \"dataType\": \"SYSTEM\",\n \"dbColumn\": \"system_field1\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Host/Folder\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n },\n {\n \"dataType\": \"LONG_TEXT\",\n \"dbColumn\": \"text_area2\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1453474468000,\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTagField\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1478557845000,\n \"name\": \"Tags\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"tags\"\n }],\n \"workflow\": [\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}\n" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "_filter" + ] + }, + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." + }, + "response": [] + }, + { + "name": "Update Content Type Unsupported Media Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate the response status is 415", + "pm.test(\"Response status is 415\", function () {", + " pm.response.to.have.status(415);", + "});", + "", + "// Validate that the response body contains the 'message' property and it is not empty", + "pm.test(\"Response should have an error message\", function () {", + " const responseBody = pm.response.json();", + " pm.expect(responseBody).to.have.property('message').that.is.not.empty;", + " pm.expect(responseBody.message).to.equal('HTTP 415 Unsupported Media Type');", + "});", + "" + ], "type": "text/javascript", "packages": {} } } ], + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "content-type": true + } + }, "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { - "key": "token", - "value": "{{jwt}}", + "key": "username", + "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, - "method": "DELETE", - "header": [], + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/javascript", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"THE DESCRIPTION\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",\n \"contentTypeId\": \"{{contentTypeID}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Host-Folder\",\n \"fieldTypeLabel\": \"Site or Folder\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1308941714000,\n \"id\": \"{{contentTypeFieldID}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1632506750000,\n \"name\": \"Host/Folder CHANGED\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"hostfolder\"\n }\n ],\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"host\": \"SYSTEM_HOST\",\n \"name\": \"Test Content Type\",\n\t\"fixed\": false,\n \"id\": \"{{contentTypeID}}\",\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"icon\": \"icon2\",\n \"sortOrder\": 2\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeID}}", "host": [ @@ -552,10 +1446,32 @@ "{{contentTypeID}}" ] }, - "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." }, "response": [] } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } ] }, { @@ -574,13 +1490,11 @@ "pm.test(\"Status code should be 200\", function() {", " pm.response.to.have.status(200);", "});", - "pm.test(\"Content Type should have 2 fields\", function() {", - " pm.expect(contentType.fields.length).to.gte(2);", + "pm.test(\"Content Type should have 4 fields\", function() {", + " pm.expect(contentType.fields.length).to.eql(4);", "});", "pm.test(\"Content Type has a Story_block_field\", function() {", - "", - " const hasStoryBlock = contentType.fields.some(field => field.fieldType === \"Story-Block\");", - " pm.expect(hasStoryBlock).to.be.true;", + " pm.expect(contentType.fields[3].fieldType).to.eql(\"Story-Block\");", "});" ], "type": "text/javascript", @@ -590,12 +1504,26 @@ ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { - "key": "token", - "value": "{{jwt}}", + "key": "username", + "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, @@ -640,19 +1568,32 @@ " pm.expect(jsonData.entity.block.content[0].content[0].text).contains(\"Wow, this editor instance exports its content as JSON\");", "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { - "key": "token", - "value": "{{jwt}}", + "key": "username", + "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, @@ -701,19 +1642,32 @@ " pm.response.to.have.status(200);", "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { - "key": "token", - "value": "{{jwt}}", + "key": "username", + "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, @@ -756,22 +1710,11 @@ " pm.response.to.have.status(200);", "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, "method": "GET", "header": [], "url": { @@ -811,22 +1754,11 @@ " pm.response.to.have.status(200);", "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, "method": "GET", "header": [], "url": { @@ -854,18 +1786,130 @@ " pm.response.to.have.status(200);", "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?host=aaaaa-aaaa-aaaa-aaaaaa", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "host", + "value": "aaaaa-aaaa-aaaa-aaaaaa" + } + ] + } + }, + "response": [] + }, + { + "name": "Get existing Base Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that there are at least 1 Content Type of Base Type 'dotAsset'\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.gte(1, \"There MUST be at least one Content Type of Base Type 'dotAsset'\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "password", + "value": "admin", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype?type=DOTASSET&orderby=name", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ], + "query": [ + { + "key": "type", + "value": "DOTASSET" + }, + { + "key": "orderby", + "value": "name" + } + ] + }, + "description": "Returns all Content Types whose Base Type is 'dotAsset'. **There must be AT LEAST one Content Type of such a Base Type.**" + }, + "response": [] + }, + { + "name": "Get non-existing Base Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Checking that the error message is present\", function () {", + " const message = pm.response.json().message;", + " pm.expect(message).to.contain(\"FORM2\", \"The returned error message may not be\")", + "});", + "" + ], + "type": "text/javascript" } } ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, { - "key": "token", - "value": "{{jwt}}", + "key": "password", + "value": "admin", "type": "string" } ] @@ -873,7 +1917,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype?host=aaaaa-aaaa-aaaa-aaaaaa", + "raw": "{{serverURL}}/api/v1/contenttype?filter=filter&page=3&per_page=4&type=FORM2&orderby=name", "host": [ "{{serverURL}}" ], @@ -884,201 +1928,533 @@ ], "query": [ { - "key": "host", - "value": "aaaaa-aaaa-aaaa-aaaaaa" + "key": "filter", + "value": "filter" + }, + { + "key": "page", + "value": "3" + }, + { + "key": "per_page", + "value": "4" + }, + { + "key": "type", + "value": "FORM2" + }, + { + "key": "orderby", + "value": "name" } ] + }, + "description": "Requesting an invalid Base Content Type will return an error message and an HTTP Status 400." + }, + "response": [] + } + ] + }, + { + "name": "Test ContentType With Field Variables", + "item": [ + { + "name": "Create Test Data", + "item": [ + { + "name": "Create ContentType with field variables", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "var contentType = jsonData.entity[0];", + "pm.collectionVariables.set(\"contentTypeId\", contentType.id);", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200);", + "});", + "pm.test(\"Content Type has the provided name\", function() {", + " pm.expect(contentType.name).to.eql(\"WYSIWYG-Content\");", + "});", + "pm.test(\"Content Type should have 4 fields\", function() {", + " pm.expect(contentType.fields.length).to.eql(4);", + "});", + "pm.collectionVariables.set(\"contentType.host\", contentType.host);", + "pm.collectionVariables.set(\"contentType.field1\", contentType.fields[0].id);", + "pm.collectionVariables.set(\"contentType.field2\", contentType.fields[1].id);", + "pm.collectionVariables.set(\"contentType.field3\", contentType.fields[2].id);", + "pm.collectionVariables.set(\"contentType.field4\", contentType.fields[3].id);", + "pm.collectionVariables.set(\"contentType.field4.varName\", contentType.fields[3].variable);", + "pm.collectionVariables.set(\"contentType.divider\", contentType.layout[0].divider.id);", + "pm.collectionVariables.set(\"contentType.columnDivider\", contentType.layout[0].columns[0].columnDivider.id);", + "var wysigygField = contentType.fields[3];", + "var secondVar = wysigygField.fieldVariables[1];", + "pm.test(\"Variable should have its key and value with hello:world\", function() {", + " pm.expect(secondVar.key).to.eql(\"hello\");", + " pm.expect(secondVar.value).to.eql(\"world\");", + "});", + "pm.test(\"WYSIWYG must exist and have 3 variables\", function() {", + " pm.expect(wysigygField.fieldType).to.eql(\"WYSIWYG\");", + " pm.expect(wysigygField.fieldVariables.length).to.eql(3);", + "});", + "var tinyMcePropsVar = wysigygField.fieldVariables[2];", + "pm.test(\"WYSIWYG tinymceoprops variable is present with value\", function() {", + " pm.expect(tinyMcePropsVar.key).to.eql(\"tinymceprops\");", + " pm.expect(tinyMcePropsVar.value).to.eql(\"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "password", + "value": "admin", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\t\"baseType\": \"CONTENT\",\n\t\t\"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n\t\t\"defaultType\": false,\n\t\t\"fields\": [{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\"fieldType\": \"Row\",\n\t\t\t\"fieldTypeLabel\": \"Row\",\n\t\t\t\"fieldVariables\": [],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168604000,\n\t\t\t\"indexed\": false,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168642000,\n\t\t\t\"name\": \"fields-0\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": false,\n\t\t\t\"sortOrder\": 0,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"fields0\"\n\t\t}, {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\"fieldType\": \"Column\",\n\t\t\t\"fieldTypeLabel\": \"Column\",\n\t\t\t\"fieldVariables\": [],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168604000,\n\t\t\t\"indexed\": false,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168642000,\n\t\t\t\"name\": \"fields-1\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": false,\n\t\t\t\"sortOrder\": 1,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"fields1\"\n\t\t}, {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"fieldType\": \"Text\",\n\t\t\t\"fieldTypeLabel\": \"Text\",\n\t\t\t\"fieldVariables\": [],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168746000,\n\t\t\t\"indexed\": true,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168746000,\n\t\t\t\"name\": \"Title\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"title\"\n\t\t}, {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n\t\t\t\"dataType\": \"LONG_TEXT\",\n\t\t\t\"fieldType\": \"WYSIWYG\",\n\t\t\t\"fieldTypeLabel\": \"WYSIWYG\",\n\t\t\t\"fieldVariables\": [{\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\"key\": \"foo\",\n\t\t\t\t\"value\": \"bar\"\n\t\t\t}, {\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\"key\": \"hello\",\n\t\t\t\t\"value\": \"world\"\n\t\t\t}, {\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\"key\": \"tinymceprops\",\n\t\t\t\t\"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n\t\t\t}],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168642000,\n\t\t\t\"indexed\": true,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168746000,\n\t\t\t\"name\": \"component\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": true,\n\t\t\t\"sortOrder\": 3,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"component\"\n\t\t}],\n\t\t\"fixed\": false,\n\t\t\"folder\": \"SYSTEM_FOLDER\",\n\t\t\"host\": \"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n\t\t\"iDate\": 1606168519000,\n\t\t\"layout\": [{\n\t\t\t\"divider\": {\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n\t\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\t\"fieldType\": \"Row\",\n\t\t\t\t\"fieldTypeLabel\": \"Row\",\n\t\t\t\t\"fieldVariables\": [],\n\t\t\t\t\"fixed\": false,\n\t\t\t\t\"iDate\": 1606168604000,\n\t\t\t\t\"indexed\": false,\n\t\t\t\t\"listed\": false,\n\t\t\t\t\"modDate\": 1606168642000,\n\t\t\t\t\"name\": \"fields-0\",\n\t\t\t\t\"readOnly\": false,\n\t\t\t\t\"required\": false,\n\t\t\t\t\"searchable\": false,\n\t\t\t\t\"sortOrder\": 0,\n\t\t\t\t\"unique\": false,\n\t\t\t\t\"variable\": \"fields0\"\n\t\t\t},\n\t\t\t\"columns\": [{\n\t\t\t\t\"columnDivider\": {\n\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n\t\t\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\t\t\"fieldType\": \"Column\",\n\t\t\t\t\t\"fieldTypeLabel\": \"Column\",\n\t\t\t\t\t\"fieldVariables\": [],\n\t\t\t\t\t\"fixed\": false,\n\t\t\t\t\t\"iDate\": 1606168604000,\n\t\t\t\t\t\"indexed\": false,\n\t\t\t\t\t\"listed\": false,\n\t\t\t\t\t\"modDate\": 1606168642000,\n\t\t\t\t\t\"name\": \"fields-1\",\n\t\t\t\t\t\"readOnly\": false,\n\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\"searchable\": false,\n\t\t\t\t\t\"sortOrder\": 1,\n\t\t\t\t\t\"unique\": false,\n\t\t\t\t\t\"variable\": \"fields1\"\n\t\t\t\t},\n\t\t\t\t\"fields\": [{\n\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n\t\t\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\t\t\"fieldType\": \"Text\",\n\t\t\t\t\t\"fieldTypeLabel\": \"Text\",\n\t\t\t\t\t\"fieldVariables\": [],\n\t\t\t\t\t\"fixed\": false,\n\t\t\t\t\t\"iDate\": 1606168746000,\n\t\t\t\t\t\"indexed\": true,\n\t\t\t\t\t\"listed\": false,\n\t\t\t\t\t\"modDate\": 1606168746000,\n\t\t\t\t\t\"name\": \"Title\",\n\t\t\t\t\t\"readOnly\": false,\n\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\"searchable\": true,\n\t\t\t\t\t\"sortOrder\": 2,\n\t\t\t\t\t\"unique\": false,\n\t\t\t\t\t\"variable\": \"title\"\n\t\t\t\t}, {\n\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n\t\t\t\t\t\"dataType\": \"LONG_TEXT\",\n\t\t\t\t\t\"fieldType\": \"WYSIWYG\",\n\t\t\t\t\t\"fieldTypeLabel\": \"WYSIWYG\",\n\t\t\t\t\t\"fieldVariables\": [{\n\t\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\t\t\"key\": \"foo\",\n\t\t\t\t\t\t\"value\": \"bar\"\n\t\t\t\t\t}, {\n\t\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\t\t\"key\": \"hello\",\n\t\t\t\t\t\t\"value\": \"world\"\n\t\t\t\t\t}, {\n\t\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\t\t\"key\": \"tinymceprops\",\n\t\t\t\t\t\t\"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n\t\t\t\t\t}],\n\t\t\t\t\t\"fixed\": false,\n\t\t\t\t\t\"iDate\": 1606168642000,\n\t\t\t\t\t\"indexed\": true,\n\t\t\t\t\t\"listed\": false,\n\t\t\t\t\t\"modDate\": 1606168746000,\n\t\t\t\t\t\"name\": \"component\",\n\t\t\t\t\t\"readOnly\": false,\n\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\"searchable\": true,\n\t\t\t\t\t\"sortOrder\": 3,\n\t\t\t\t\t\"unique\": false,\n\t\t\t\t\t\"variable\": \"component\"\n\t\t\t\t}]\n\t\t\t}]\n\t\t}],\n\t\t\"modDate\": 1606177211000,\n\t\t\"multilingualable\": false,\n\t\t\"name\": \"WYSIWYG-Content\",\n\t\t\"system\": false,\n\t\t\"systemActionMappings\": {},\n\t\t\"variable\": \"WysiwygContent\",\n\t\t\"versionable\": true,\n\t\t\"workflows\": []\n\t}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that WYSIWYG field is created with provided field variables." + }, + "response": [] + }, + { + "name": "Update ContentType with field variables", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "var contentType = jsonData.entity", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200);", + "});", + "pm.test(\"Content Type has the provided name\", function() {", + " pm.expect(contentType.name).to.eql(\"WYSIWYG-Content-Renamed\");", + "});", + "pm.test(\"Content Type should have 4 fields\", function() {", + " pm.expect(contentType.fields.length).to.eql(4);", + "});", + "var wysigygField = contentType.fields[3];", + "pm.test(\"WYSIWYG must exist and have 2 variables\", function() {", + " pm.expect(wysigygField.fieldType).to.eql(\"WYSIWYG\");", + " pm.expect(wysigygField.fieldVariables.length).to.eql(2);", + "});", + "var firstVar = wysigygField.fieldVariables[0];", + "pm.test(\"Variable should have its key and value modified to hola:mundo\", function() {", + " pm.expect(firstVar.key).to.eql(\"hola\");", + " pm.expect(firstVar.value).to.eql(\"mundo\");", + "});", + "var tinyMcePropsVar = wysigygField.fieldVariables[1];", + "pm.test(\"WYSIWYG tinymceoprops variable is present with value\", function() {", + " pm.expect(tinyMcePropsVar.key).to.eql(\"tinymceprops\");", + " pm.expect(tinyMcePropsVar.value).to.eql(\"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"baseType\": \"CONTENT\",\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"defaultType\": false,\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field2}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field3}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"title\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"id\": \"6bf0f909-7f33-43a3-9b9c-fd7551fa73d7\",\n \"key\": \"hola\",\n \"value\": \"mundo\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ],\n \"fixed\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"host\": \"{{contentType.host}}\",\n \"iDate\": 1606168519000,\n \"id\": \"{{contentTypeId}}\",\n \"layout\": [\n {\n \"divider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.divider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n \"columns\": [\n {\n \"columnDivider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.columnDivider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"title\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6bf0f909-7f33-43a3-9b9c-fd7551fa73d7\",\n \"key\": \"hola\",\n \"value\": \"mundo\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ]\n }\n ]\n }\n ],\n \"modDate\": 1607013655000,\n \"multilingualable\": false,\n \"name\": \"WYSIWYG-Content-Renamed\",\n \"system\": false,\n \"systemActionMappings\": {},\n \"variable\": \"WysiwygContent\",\n \"versionable\": true,\n \"workflows\": [\n {\n \"archived\": false,\n \"creationDate\": 1607013267018,\n \"defaultScheme\": false,\n \"description\": \"\",\n \"entryActionId\": null,\n \"id\": \"{{contentType.workflow}}\",\n \"mandatory\": false,\n \"modDate\": 1607013261505,\n \"name\": \"System Workflow\",\n \"system\": true\n }\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Given a content type payload containing field variables.\nWhen sending a PUT.\nExpect that code is 200.\nExpect content type is updated with the provided fields.\nExpect that WYSIWYG field is updated with provided field variables." + }, + "response": [] + }, + { + "name": "Update ContentType with field variables - delete - update - add", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "var contentType = jsonData.entity", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200);", + "});", + "pm.test(\"Content Type has the provided name\", function() {", + " pm.expect(contentType.name).to.eql(\"WYSIWYG-Content-Renamed2\");", + "});", + "pm.test(\"Content Type should have 4 fields\", function() {", + " pm.expect(contentType.fields.length).to.eql(4);", + "});", + "var wysigygField = contentType.fields[3];", + "pm.test(\"WYSIWYG must exist and have 2 variables\", function() {", + " pm.expect(wysigygField.fieldType).to.eql(\"WYSIWYG\");", + " pm.expect(wysigygField.fieldVariables.length).to.eql(2);", + "});", + "var firstVar = wysigygField.fieldVariables[0];", + "pm.test(\"Variable should have its key and value modified to hola:mundo\", function() {", + " pm.expect(firstVar.key).to.eql(\"hi\");", + " pm.expect(firstVar.value).to.eql(\"all\");", + " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", firstVar.id);", + " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.key\", firstVar.key);", + "});", + "var tinyMcePropsVar = wysigygField.fieldVariables[1];", + "pm.test(\"WYSIWYG tinymceoprops variable is present with value\", function() {", + " pm.expect(tinyMcePropsVar.key).to.eql(\"tinymceprops\");", + " pm.expect(tinyMcePropsVar.value).to.eql(\"{toolbar:\\\"true\\\",menu:\\\"true\\\", theme:\\\"advanced\\\"}\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"baseType\": \"CONTENT\",\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"defaultType\": false,\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field2}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field3}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"titleNew\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"key\": \"hi\",\n \"value\": \"all\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"true\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ],\n \"fixed\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"host\": \"{{contentType.host}}\",\n \"iDate\": 1606168519000,\n \"id\": \"{{contentTypeId}}\",\n \"layout\": [\n {\n \"divider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.divider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n \"columns\": [\n {\n \"columnDivider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.columnDivider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"title\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6bf0f909-7f33-43a3-9b9c-fd7551fa73d7\",\n \"key\": \"hola\",\n \"value\": \"mundo\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ]\n }\n ]\n }\n ],\n \"modDate\": 1607013655000,\n \"multilingualable\": false,\n \"name\": \"WYSIWYG-Content-Renamed2\",\n \"system\": false,\n \"systemActionMappings\": {},\n \"variable\": \"WysiwygContent\",\n \"versionable\": true,\n \"workflows\": [\n {\n \"archived\": false,\n \"creationDate\": 1607013267018,\n \"defaultScheme\": false,\n \"description\": \"\",\n \"entryActionId\": null,\n \"id\": \"{{contentType.workflow}}\",\n \"mandatory\": false,\n \"modDate\": 1607013261505,\n \"name\": \"System Workflow\",\n \"system\": true\n }\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Given a content type payload containing field variables.\nWhen sending a PUT.\nExpect that code is 200.\nExpect content type is updated with the provided fields.\nExpect that WYSIWYG field is updated with provided field variables." + }, + "response": [] } - }, - "response": [] + ] }, { - "name": "Get existing Base Content Type", - "event": [ + "name": "Field Variables - With User", + "item": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there are at least 1 Content Type of Base Type 'dotAsset'\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.gte(1, \"There MUST be at least one Content Type of Base Type 'dotAsset'\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?type=DOTASSET&orderby=name", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ], - "query": [ + "name": "Create Field Variable using Field ID", + "event": [ { - "key": "type", - "value": "DOTASSET" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "orderby", - "value": "name" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", jsonData.entity.id);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - ] + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable created with ID\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "id", + "{{contentType.field4}}", + "variables" + ] + }, + "description": "Attempts to create a new Field Variable without User authentication." + }, + "response": [] }, - "description": "Returns all Content Types whose Base Type is 'dotAsset'. **There must be AT LEAST one Content Type of such a Base Type.**" - }, - "response": [] - }, - { - "name": "Get non-existing Base Content Type", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 400\", function () {", - " pm.response.to.have.status(400);", - "});", - "", - "pm.test(\"Checking that the error message is present\", function () {", - " const message = pm.response.json().message;", - " pm.expect(message).to.contain(\"FORM2\", \"The returned error message may not be\")", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?filter=filter&page=3&per_page=4&type=FORM2&orderby=name", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ], - "query": [ + "name": "Create Field Variable using Var Name", + "event": [ { - "key": "filter", - "value": "filter" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "page", - "value": "3" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", jsonData.entity.id);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] }, - { - "key": "per_page", - "value": "4" + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable created with Var Name\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } }, - { - "key": "type", - "value": "FORM2" + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "var", + "{{contentType.field4.varName}}", + "variables" + ] }, - { - "key": "orderby", - "value": "name" - } - ] + "description": "Attempts to create a new Field Variable without User authentication." + }, + "response": [] }, - "description": "Requesting an invalid Base Content Type will return an error message and an HTTP Status 400." - }, - "response": [] - } - ] - }, - { - "name": "Test ContentType With Field Variables", - "item": [ - { - "name": "Create Test Data", - "item": [ { - "name": "Create ContentType with field variables", + "name": "Get All Field Variables using Field ID", "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + }, { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", - "var contentType = jsonData.entity[0];", - "pm.collectionVariables.set(\"contentTypeId\", contentType.id);", - "pm.test(\"Status code should be 200\", function() {", + "pm.test(\"HTTP Status code must be 200\", function () {", " pm.response.to.have.status(200);", "});", - "pm.test(\"Content Type has the provided name\", function() {", - " pm.expect(contentType.name).to.eql(\"WYSIWYG-Content\");", - "});", - "pm.test(\"Content Type should have 4 fields\", function() {", - " pm.expect(contentType.fields.length).to.eql(4);", - "});", - "pm.collectionVariables.set(\"contentType.host\", contentType.host);", - "pm.collectionVariables.set(\"contentType.field1\", contentType.fields[0].id);", - "pm.collectionVariables.set(\"contentType.field2\", contentType.fields[1].id);", - "pm.collectionVariables.set(\"contentType.field3\", contentType.fields[2].id);", - "pm.collectionVariables.set(\"contentType.field4\", contentType.fields[3].id);", - "pm.collectionVariables.set(\"contentType.field4.varName\", contentType.fields[3].variable);", - "pm.collectionVariables.set(\"contentType.divider\", contentType.layout[0].divider.id);", - "pm.collectionVariables.set(\"contentType.columnDivider\", contentType.layout[0].columns[0].columnDivider.id);", - "var wysigygField = contentType.fields[3];", - "var secondVar = wysigygField.fieldVariables[1];", - "pm.test(\"Variable should have its key and value with hello:world\", function() {", - " pm.expect(secondVar.key).to.eql(\"hello\");", - " pm.expect(secondVar.value).to.eql(\"world\");", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", "});", - "pm.test(\"WYSIWYG must exist and have 3 variables\", function() {", - " pm.expect(wysigygField.fieldType).to.eql(\"WYSIWYG\");", - " pm.expect(wysigygField.fieldVariables.length).to.eql(3);", + "", + "pm.test(\"There must be only two Field Variables\", function () {", + " pm.expect(pm.response.json().entity.length).to.equal(2, 'There must be only 2 Field Variables at this point');", "});", - "var tinyMcePropsVar = wysigygField.fieldVariables[2];", - "pm.test(\"WYSIWYG tinymceoprops variable is present with value\", function() {", - " pm.expect(tinyMcePropsVar.key).to.eql(\"tinymceprops\");", - " pm.expect(tinyMcePropsVar.value).to.eql(\"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\");", - "});" + "" ], "type": "text/javascript", "packages": {} } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "{{contentTypeId}}", + "fields", + "id", + "{{contentType.field4}}", + "variables" + ] }, + "description": "Attempts to create a new Field Variable without User authentication." + }, + "response": [] + }, + { + "name": "Get All Field Variables using Field Var Name", + "event": [ { "listen": "prerequest", "script": { @@ -1088,6 +2464,28 @@ "type": "text/javascript", "packages": {} } + }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "});", + "", + "pm.test(\"There must be only two Field Variables\", function () {", + " pm.expect(pm.response.json().entity.length).to.equal(2, 'There must be only 2 Field Variables at this point');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } ], "request": { @@ -1101,65 +2499,54 @@ } ] }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\t\"baseType\": \"CONTENT\",\n\t\t\"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n\t\t\"defaultType\": false,\n\t\t\"fields\": [{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\"fieldType\": \"Row\",\n\t\t\t\"fieldTypeLabel\": \"Row\",\n\t\t\t\"fieldVariables\": [],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168604000,\n\t\t\t\"indexed\": false,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168642000,\n\t\t\t\"name\": \"fields-0\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": false,\n\t\t\t\"sortOrder\": 0,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"fields0\"\n\t\t}, {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\"fieldType\": \"Column\",\n\t\t\t\"fieldTypeLabel\": \"Column\",\n\t\t\t\"fieldVariables\": [],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168604000,\n\t\t\t\"indexed\": false,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168642000,\n\t\t\t\"name\": \"fields-1\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": false,\n\t\t\t\"sortOrder\": 1,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"fields1\"\n\t\t}, {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"fieldType\": \"Text\",\n\t\t\t\"fieldTypeLabel\": \"Text\",\n\t\t\t\"fieldVariables\": [],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168746000,\n\t\t\t\"indexed\": true,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168746000,\n\t\t\t\"name\": \"Title\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"title\"\n\t\t}, {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n\t\t\t\"dataType\": \"LONG_TEXT\",\n\t\t\t\"fieldType\": \"WYSIWYG\",\n\t\t\t\"fieldTypeLabel\": \"WYSIWYG\",\n\t\t\t\"fieldVariables\": [{\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\"key\": \"foo\",\n\t\t\t\t\"value\": \"bar\"\n\t\t\t}, {\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\"key\": \"hello\",\n\t\t\t\t\"value\": \"world\"\n\t\t\t}, {\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\"key\": \"tinymceprops\",\n\t\t\t\t\"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n\t\t\t}],\n\t\t\t\"fixed\": false,\n\t\t\t\"iDate\": 1606168642000,\n\t\t\t\"indexed\": true,\n\t\t\t\"listed\": false,\n\t\t\t\"modDate\": 1606168746000,\n\t\t\t\"name\": \"component\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": false,\n\t\t\t\"searchable\": true,\n\t\t\t\"sortOrder\": 3,\n\t\t\t\"unique\": false,\n\t\t\t\"variable\": \"component\"\n\t\t}],\n\t\t\"fixed\": false,\n\t\t\"folder\": \"SYSTEM_FOLDER\",\n\t\t\"host\": \"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n\t\t\"iDate\": 1606168519000,\n\t\t\"layout\": [{\n\t\t\t\"divider\": {\n\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n\t\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\t\"fieldType\": \"Row\",\n\t\t\t\t\"fieldTypeLabel\": \"Row\",\n\t\t\t\t\"fieldVariables\": [],\n\t\t\t\t\"fixed\": false,\n\t\t\t\t\"iDate\": 1606168604000,\n\t\t\t\t\"indexed\": false,\n\t\t\t\t\"listed\": false,\n\t\t\t\t\"modDate\": 1606168642000,\n\t\t\t\t\"name\": \"fields-0\",\n\t\t\t\t\"readOnly\": false,\n\t\t\t\t\"required\": false,\n\t\t\t\t\"searchable\": false,\n\t\t\t\t\"sortOrder\": 0,\n\t\t\t\t\"unique\": false,\n\t\t\t\t\"variable\": \"fields0\"\n\t\t\t},\n\t\t\t\"columns\": [{\n\t\t\t\t\"columnDivider\": {\n\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n\t\t\t\t\t\"dataType\": \"SYSTEM\",\n\t\t\t\t\t\"fieldContentTypeProperties\": [],\n\t\t\t\t\t\"fieldType\": \"Column\",\n\t\t\t\t\t\"fieldTypeLabel\": \"Column\",\n\t\t\t\t\t\"fieldVariables\": [],\n\t\t\t\t\t\"fixed\": false,\n\t\t\t\t\t\"iDate\": 1606168604000,\n\t\t\t\t\t\"indexed\": false,\n\t\t\t\t\t\"listed\": false,\n\t\t\t\t\t\"modDate\": 1606168642000,\n\t\t\t\t\t\"name\": \"fields-1\",\n\t\t\t\t\t\"readOnly\": false,\n\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\"searchable\": false,\n\t\t\t\t\t\"sortOrder\": 1,\n\t\t\t\t\t\"unique\": false,\n\t\t\t\t\t\"variable\": \"fields1\"\n\t\t\t\t},\n\t\t\t\t\"fields\": [{\n\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n\t\t\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\t\t\"fieldType\": \"Text\",\n\t\t\t\t\t\"fieldTypeLabel\": \"Text\",\n\t\t\t\t\t\"fieldVariables\": [],\n\t\t\t\t\t\"fixed\": false,\n\t\t\t\t\t\"iDate\": 1606168746000,\n\t\t\t\t\t\"indexed\": true,\n\t\t\t\t\t\"listed\": false,\n\t\t\t\t\t\"modDate\": 1606168746000,\n\t\t\t\t\t\"name\": \"Title\",\n\t\t\t\t\t\"readOnly\": false,\n\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\"searchable\": true,\n\t\t\t\t\t\"sortOrder\": 2,\n\t\t\t\t\t\"unique\": false,\n\t\t\t\t\t\"variable\": \"title\"\n\t\t\t\t}, {\n\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n\t\t\t\t\t\"dataType\": \"LONG_TEXT\",\n\t\t\t\t\t\"fieldType\": \"WYSIWYG\",\n\t\t\t\t\t\"fieldTypeLabel\": \"WYSIWYG\",\n\t\t\t\t\t\"fieldVariables\": [{\n\t\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\t\t\"key\": \"foo\",\n\t\t\t\t\t\t\"value\": \"bar\"\n\t\t\t\t\t}, {\n\t\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\t\t\"key\": \"hello\",\n\t\t\t\t\t\t\"value\": \"world\"\n\t\t\t\t\t}, {\n\t\t\t\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n\t\t\t\t\t\t\"key\": \"tinymceprops\",\n\t\t\t\t\t\t\"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n\t\t\t\t\t}],\n\t\t\t\t\t\"fixed\": false,\n\t\t\t\t\t\"iDate\": 1606168642000,\n\t\t\t\t\t\"indexed\": true,\n\t\t\t\t\t\"listed\": false,\n\t\t\t\t\t\"modDate\": 1606168746000,\n\t\t\t\t\t\"name\": \"component\",\n\t\t\t\t\t\"readOnly\": false,\n\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\"searchable\": true,\n\t\t\t\t\t\"sortOrder\": 3,\n\t\t\t\t\t\"unique\": false,\n\t\t\t\t\t\"variable\": \"component\"\n\t\t\t\t}]\n\t\t\t}]\n\t\t}],\n\t\t\"modDate\": 1606177211000,\n\t\t\"multilingualable\": false,\n\t\t\"name\": \"WYSIWYG-Content\",\n\t\t\"system\": false,\n\t\t\"systemActionMappings\": {},\n\t\t\"variable\": \"WysiwygContent\",\n\t\t\"versionable\": true,\n\t\t\"workflows\": []\n\t}" - }, + "method": "GET", + "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "{{contentTypeId}}", + "fields", + "var", + "{{contentType.field4.varName}}", + "variables" ] }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that WYSIWYG field is created with provided field variables." + "description": "Attempts to create a new Field Variable without User authentication." }, "response": [] }, { - "name": "Update ContentType with field variables", + "name": "Get Field Variable using Field ID", "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + }, { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", - "var contentType = jsonData.entity", - "pm.test(\"Status code should be 200\", function() {", + "pm.test(\"HTTP Status code must be 200\", function () {", " pm.response.to.have.status(200);", "});", - "pm.test(\"Content Type has the provided name\", function() {", - " pm.expect(contentType.name).to.eql(\"WYSIWYG-Content-Renamed\");", - "});", - "pm.test(\"Content Type should have 4 fields\", function() {", - " pm.expect(contentType.fields.length).to.eql(4);", - "});", - "var wysigygField = contentType.fields[3];", - "pm.test(\"WYSIWYG must exist and have 2 variables\", function() {", - " pm.expect(wysigygField.fieldType).to.eql(\"WYSIWYG\");", - " pm.expect(wysigygField.fieldVariables.length).to.eql(2);", - "});", - "var firstVar = wysigygField.fieldVariables[0];", - "pm.test(\"Variable should have its key and value modified to hola:mundo\", function() {", - " pm.expect(firstVar.key).to.eql(\"hola\");", - " pm.expect(firstVar.value).to.eql(\"mundo\");", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", "});", - "var tinyMcePropsVar = wysigygField.fieldVariables[1];", - "pm.test(\"WYSIWYG tinymceoprops variable is present with value\", function() {", - " pm.expect(tinyMcePropsVar.key).to.eql(\"tinymceprops\");", - " pm.expect(tinyMcePropsVar.value).to.eql(\"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\");", - "});" + "" ], "type": "text/javascript", "packages": {} @@ -1177,19 +2564,10 @@ } ] }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"baseType\": \"CONTENT\",\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"defaultType\": false,\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field2}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field3}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"title\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"id\": \"6bf0f909-7f33-43a3-9b9c-fd7551fa73d7\",\n \"key\": \"hola\",\n \"value\": \"mundo\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ],\n \"fixed\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"host\": \"{{contentType.host}}\",\n \"iDate\": 1606168519000,\n \"id\": \"{{contentTypeId}}\",\n \"layout\": [\n {\n \"divider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.divider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n \"columns\": [\n {\n \"columnDivider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.columnDivider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"title\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6bf0f909-7f33-43a3-9b9c-fd7551fa73d7\",\n \"key\": \"hola\",\n \"value\": \"mundo\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ]\n }\n ]\n }\n ],\n \"modDate\": 1607013655000,\n \"multilingualable\": false,\n \"name\": \"WYSIWYG-Content-Renamed\",\n \"system\": false,\n \"systemActionMappings\": {},\n \"variable\": \"WysiwygContent\",\n \"versionable\": true,\n \"workflows\": [\n {\n \"archived\": false,\n \"creationDate\": 1607013267018,\n \"defaultScheme\": false,\n \"description\": \"\",\n \"entryActionId\": null,\n \"id\": \"{{contentType.workflow}}\",\n \"mandatory\": false,\n \"modDate\": 1607013261505,\n \"name\": \"System Workflow\",\n \"system\": true\n }\n ]\n}" - }, + "method": "GET", + "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", "host": [ "{{serverURL}}" ], @@ -1197,49 +2575,45 @@ "api", "v1", "contenttype", + "{{contentTypeId}}", + "fields", "id", - "{{contentTypeId}}" + "{{contentType.field4}}", + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" ] }, - "description": "Given a content type payload containing field variables.\nWhen sending a PUT.\nExpect that code is 200.\nExpect content type is updated with the provided fields.\nExpect that WYSIWYG field is updated with provided field variables." + "description": "Attempts to create a new Field Variable without User authentication." }, "response": [] }, { - "name": "Update ContentType with field variables - delete - update - add", + "name": "Get Field Variable using Var Name", "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + }, { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", - "var contentType = jsonData.entity", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200);", - "});", - "pm.test(\"Content Type has the provided name\", function() {", - " pm.expect(contentType.name).to.eql(\"WYSIWYG-Content-Renamed2\");", - "});", - "pm.test(\"Content Type should have 4 fields\", function() {", - " pm.expect(contentType.fields.length).to.eql(4);", - "});", - "var wysigygField = contentType.fields[3];", - "pm.test(\"WYSIWYG must exist and have 2 variables\", function() {", - " pm.expect(wysigygField.fieldType).to.eql(\"WYSIWYG\");", - " pm.expect(wysigygField.fieldVariables.length).to.eql(2);", + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", "});", - "var firstVar = wysigygField.fieldVariables[0];", - "pm.test(\"Variable should have its key and value modified to hola:mundo\", function() {", - " pm.expect(firstVar.key).to.eql(\"hi\");", - " pm.expect(firstVar.value).to.eql(\"all\");", - " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", firstVar.id);", - " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.key\", firstVar.key);", + "", + "pm.test(\"No error messages must be returned\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", "});", - "var tinyMcePropsVar = wysigygField.fieldVariables[1];", - "pm.test(\"WYSIWYG tinymceoprops variable is present with value\", function() {", - " pm.expect(tinyMcePropsVar.key).to.eql(\"tinymceprops\");", - " pm.expect(tinyMcePropsVar.value).to.eql(\"{toolbar:\\\"true\\\",menu:\\\"true\\\", theme:\\\"advanced\\\"}\");", - "});" + "" ], "type": "text/javascript", "packages": {} @@ -1257,19 +2631,10 @@ } ] }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"baseType\": \"CONTENT\",\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"defaultType\": false,\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.field2}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field3}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"titleNew\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"key\": \"hi\",\n \"value\": \"all\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"true\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ],\n \"fixed\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"host\": \"{{contentType.host}}\",\n \"iDate\": 1606168519000,\n \"id\": \"{{contentTypeId}}\",\n \"layout\": [\n {\n \"divider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.divider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-0\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"fields0\"\n },\n \"columns\": [\n {\n \"columnDivider\": {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168604000,\n \"id\": \"{{contentType.columnDivider}}\",\n \"indexed\": false,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"fields-1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"fields1\"\n },\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"iDate\": 1606168746000,\n \"id\": \"{{contentType.field1}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"Title\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"title\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"LONG_TEXT\",\n \"fieldType\": \"WYSIWYG\",\n \"fieldTypeLabel\": \"WYSIWYG\",\n \"fieldVariables\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6bf0f909-7f33-43a3-9b9c-fd7551fa73d7\",\n \"key\": \"hola\",\n \"value\": \"mundo\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableFieldVariable\",\n \"fieldId\": \"a2a11339-d40f-472a-a921-7748d7009642\",\n \"id\": \"6b034559-d411-49a7-be14-d3039b89bd3b\",\n \"key\": \"tinymceprops\",\n \"value\": \"{toolbar:\\\"true\\\",menu:\\\"false\\\", theme:\\\"advanced\\\"}\"\n }\n ],\n \"fixed\": false,\n \"iDate\": 1606168642000,\n \"id\": \"{{contentType.field4}}\",\n \"indexed\": true,\n \"listed\": false,\n \"modDate\": 1607013655000,\n \"name\": \"component\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": true,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"component\"\n }\n ]\n }\n ]\n }\n ],\n \"modDate\": 1607013655000,\n \"multilingualable\": false,\n \"name\": \"WYSIWYG-Content-Renamed2\",\n \"system\": false,\n \"systemActionMappings\": {},\n \"variable\": \"WysiwygContent\",\n \"versionable\": true,\n \"workflows\": [\n {\n \"archived\": false,\n \"creationDate\": 1607013267018,\n \"defaultScheme\": false,\n \"description\": \"\",\n \"entryActionId\": null,\n \"id\": \"{{contentType.workflow}}\",\n \"mandatory\": false,\n \"modDate\": 1607013261505,\n \"name\": \"System Workflow\",\n \"system\": true\n }\n ]\n}" - }, + "method": "GET", + "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", "host": [ "{{serverURL}}" ], @@ -1277,21 +2642,21 @@ "api", "v1", "contenttype", + "{{contentTypeId}}", + "fields", + "var", + "{{contentType.field4.varName}}", + "variables", "id", - "{{contentTypeId}}" + "{{contentType.field4.fieldVarOne.id}}" ] }, - "description": "Given a content type payload containing field variables.\nWhen sending a PUT.\nExpect that code is 200.\nExpect content type is updated with the provided fields.\nExpect that WYSIWYG field is updated with provided field variables." + "description": "Attempts to create a new Field Variable without User authentication." }, "response": [] - } - ] - }, - { - "name": "Field Variables - With User", - "item": [ + }, { - "name": "Create Field Variable using Field ID", + "name": "Update Field Variable using Field ID", "event": [ { "listen": "prerequest", @@ -1314,7 +2679,6 @@ "pm.test(\"No error messages must be returned\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", jsonData.entity.id);", "});", "" ], @@ -1334,11 +2698,11 @@ } ] }, - "method": "POST", + "method": "PUT", "header": [], "body": { "mode": "raw", - "raw": "{\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable created with ID\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable updated with ID\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", "options": { "raw": { "language": "json" @@ -1346,7 +2710,7 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", "host": [ "{{serverURL}}" ], @@ -1358,15 +2722,17 @@ "fields", "id", "{{contentType.field4}}", - "variables" + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" ] }, - "description": "Attempts to create a new Field Variable without User authentication." + "description": "Attempts to update a Field Variable without User authentication." }, "response": [] }, { - "name": "Create Field Variable using Var Name", + "name": "Update Field Variable using Var Name", "event": [ { "listen": "prerequest", @@ -1389,7 +2755,6 @@ "pm.test(\"No error messages must be returned\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", jsonData.entity.id);", "});", "" ], @@ -1409,11 +2774,11 @@ } ] }, - "method": "POST", + "method": "PUT", "header": [], "body": { "mode": "raw", - "raw": "{\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable created with Var Name\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable updated with Var Name\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", "options": { "raw": { "language": "json" @@ -1421,7 +2786,7 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables", + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", "host": [ "{{serverURL}}" ], @@ -1433,15 +2798,17 @@ "fields", "var", "{{contentType.field4.varName}}", - "variables" + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" ] }, - "description": "Attempts to create a new Field Variable without User authentication." + "description": "Attempts to update a Field Variable without User authentication." }, "response": [] }, { - "name": "Get All Field Variables using Field ID", + "name": "Delete Field Variable using Field ID", "event": [ { "listen": "prerequest", @@ -1465,10 +2832,6 @@ " var jsonData = pm.response.json();", " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", "});", - "", - "pm.test(\"There must be only two Field Variables\", function () {", - " pm.expect(pm.response.json().entity.length).to.equal(2, 'There must be only 2 Field Variables at this point');", - "});", "" ], "type": "text/javascript", @@ -1487,10 +2850,10 @@ } ] }, - "method": "GET", + "method": "DELETE", "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", "host": [ "{{serverURL}}" ], @@ -1502,15 +2865,17 @@ "fields", "id", "{{contentType.field4}}", - "variables" + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" ] }, - "description": "Attempts to create a new Field Variable without User authentication." + "description": "Attempts to delete a Field Variable without User authentication." }, "response": [] }, { - "name": "Get All Field Variables using Field Var Name", + "name": "Re-Create Test Field Variable", "event": [ { "listen": "prerequest", @@ -1533,10 +2898,7 @@ "pm.test(\"No error messages must be returned\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - "});", - "", - "pm.test(\"There must be only two Field Variables\", function () {", - " pm.expect(pm.response.json().entity.length).to.equal(2, 'There must be only 2 Field Variables at this point');", + " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", jsonData.entity.id);", "});", "" ], @@ -1556,10 +2918,19 @@ } ] }, - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable created with ID\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables", + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", "host": [ "{{serverURL}}" ], @@ -1569,8 +2940,8 @@ "contenttype", "{{contentTypeId}}", "fields", - "var", - "{{contentType.field4.varName}}", + "id", + "{{contentType.field4}}", "variables" ] }, @@ -1579,7 +2950,7 @@ "response": [] }, { - "name": "Get Field Variable using Field ID", + "name": "Delete Field Variable using Var Name", "event": [ { "listen": "prerequest", @@ -1621,10 +2992,10 @@ } ] }, - "method": "GET", + "method": "DELETE", "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", "host": [ "{{serverURL}}" ], @@ -1634,19 +3005,59 @@ "contenttype", "{{contentTypeId}}", "fields", - "id", - "{{contentType.field4}}", + "var", + "{{contentType.field4.varName}}", "variables", "id", "{{contentType.field4.fieldVarOne.id}}" ] }, - "description": "Attempts to create a new Field Variable without User authentication." + "description": "Attempts to delete a Field Variable without User authentication." + }, + "response": [] + } + ], + "description": "Verifies that CRUD operations on Field Variables are working as expected." + }, + { + "name": "Field Variables - No User", + "item": [ + { + "name": "invalidate User Session", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/logout", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "logout" + ] + } }, "response": [] }, { - "name": "Get Field Variable using Var Name", + "name": "Create Field Variable using Field ID", "event": [ { "listen": "prerequest", @@ -1662,13 +3073,12 @@ "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"HTTP Status code must be 401\", function () {", + " pm.response.to.have.status(401);", "});", "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "pm.test(\"An error message must be returned\", function () {", + " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", "});", "" ], @@ -1679,19 +3089,21 @@ ], "request": { "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] + "type": "noauth" }, - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"key\": \"test-field-variable\",\n \"value\": \"Value for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", "host": [ "{{serverURL}}" ], @@ -1701,11 +3113,9 @@ "contenttype", "{{contentTypeId}}", "fields", - "var", - "{{contentType.field4.varName}}", - "variables", "id", - "{{contentType.field4.fieldVarOne.id}}" + "{{contentType.field4}}", + "variables" ] }, "description": "Attempts to create a new Field Variable without User authentication." @@ -1713,7 +3123,7 @@ "response": [] }, { - "name": "Update Field Variable using Field ID", + "name": "Create Field Variable using Var Name", "event": [ { "listen": "prerequest", @@ -1729,13 +3139,12 @@ "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"HTTP Status code must be 401\", function () {", + " pm.response.to.have.status(401);", "});", "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "pm.test(\"An error message must be returned\", function () {", + " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", "});", "" ], @@ -1746,20 +3155,13 @@ ], "request": { "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] + "type": "noauth" }, - "method": "PUT", + "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable updated with ID\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "raw": "{\n \"key\": \"test-field-variable\",\n \"value\": \"NEW VALUE for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", "options": { "raw": { "language": "json" @@ -1767,7 +3169,7 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables", "host": [ "{{serverURL}}" ], @@ -1777,19 +3179,17 @@ "contenttype", "{{contentTypeId}}", "fields", - "id", - "{{contentType.field4}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" + "var", + "{{contentType.field4.varName}}", + "variables" ] }, - "description": "Attempts to update a Field Variable without User authentication." + "description": "Attempts to create a new Field Variable without User authentication." }, "response": [] }, { - "name": "Update Field Variable using Var Name", + "name": "Update Field Variable using Field ID", "event": [ { "listen": "prerequest", @@ -1805,13 +3205,12 @@ "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"HTTP Status code must be 401\", function () {", + " pm.response.to.have.status(401);", "});", - "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "", + "pm.test(\"An error message must be returned\", function () {", + " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", "});", "" ], @@ -1822,20 +3221,13 @@ ], "request": { "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] + "type": "noauth" }, "method": "PUT", "header": [], "body": { "mode": "raw", - "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable updated with Var Name\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"UPDATED VALUE USING ID for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", "options": { "raw": { "language": "json" @@ -1843,7 +3235,7 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", "host": [ "{{serverURL}}" ], @@ -1853,8 +3245,8 @@ "contenttype", "{{contentTypeId}}", "fields", - "var", - "{{contentType.field4.varName}}", + "id", + "{{contentType.field4}}", "variables", "id", "{{contentType.field4.fieldVarOne.id}}" @@ -1865,7 +3257,7 @@ "response": [] }, { - "name": "Delete Field Variable using Field ID", + "name": "Update Field Variable using Var Name", "event": [ { "listen": "prerequest", @@ -1881,13 +3273,12 @@ "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"HTTP Status code must be 401\", function () {", + " pm.response.to.have.status(401);", "});", "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "pm.test(\"An error message must be returned\", function () {", + " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", "});", "" ], @@ -1898,19 +3289,21 @@ ], "request": { "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] + "type": "noauth" }, - "method": "DELETE", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"UPDATED VALUE USING VAR NAME for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", "host": [ "{{serverURL}}" ], @@ -1920,19 +3313,19 @@ "contenttype", "{{contentTypeId}}", "fields", - "id", - "{{contentType.field4}}", + "var", + "{{contentType.field4.varName}}", "variables", "id", "{{contentType.field4.fieldVarOne.id}}" ] }, - "description": "Attempts to delete a Field Variable without User authentication." + "description": "Attempts to update a Field Variable without User authentication." }, "response": [] }, { - "name": "Re-Create Test Field Variable", + "name": "Delete Field Variable using Field ID", "event": [ { "listen": "prerequest", @@ -1948,14 +3341,12 @@ "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"HTTP Status code must be 401\", function () {", + " pm.response.to.have.status(401);", "});", "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", - " pm.collectionVariables.set(\"contentType.field4.fieldVarOne.id\", jsonData.entity.id);", + "pm.test(\"An error message must be returned\", function () {", + " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", "});", "" ], @@ -1966,28 +3357,12 @@ ], "request": { "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] + "type": "noauth" }, - "method": "POST", + "method": "DELETE", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"Field variable created with ID\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", + "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", "host": [ "{{serverURL}}" ], @@ -1999,15 +3374,17 @@ "fields", "id", "{{contentType.field4}}", - "variables" + "variables", + "id", + "{{contentType.field4.fieldVarOne.id}}" ] }, - "description": "Attempts to create a new Field Variable without User authentication." + "description": "Attempts to delete a Field Variable without User authentication." }, "response": [] }, { - "name": "Delete Field Variable using Var Name", + "name": "Update Field Variable using Var Name", "event": [ { "listen": "prerequest", @@ -2023,13 +3400,12 @@ "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"HTTP Status code must be 401\", function () {", + " pm.response.to.have.status(401);", "});", "", - "pm.test(\"No error messages must be returned\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.equal(0, 'Error messages were generated');", + "pm.test(\"An error message must be returned\", function () {", + " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", "});", "" ], @@ -2040,14 +3416,7 @@ ], "request": { "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] + "type": "noauth" }, "method": "DELETE", "header": [], @@ -2069,441 +3438,746 @@ "{{contentType.field4.fieldVarOne.id}}" ] }, - "description": "Attempts to delete a Field Variable without User authentication." - }, - "response": [] + "description": "Attempts to delete a Field Variable without User authentication." + }, + "response": [] + } + ], + "description": "Verifies that CRUD operations on Field Variables DO NOT WORK for the Anonymous User." + }, + { + "name": "Cleanup Content Type", + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + } + }, + "response": [] + } + ], + "description": "Verifies that creating Field Variables for Fields in a Content Type is working as expected." + }, + { + "name": "Test Copy ContentType", + "item": [ + { + "name": "Copy FileAsset Success", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "var contentType = jsonData.entity;", + "", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200);", + "});", + "pm.test(\"Content Type has the provided name\", function() {", + " pm.expect(contentType.name).to.eql(\"File Asset Copy\");", + "});", + "pm.test(\"Content Type should have 9 fields\", function() {", + " pm.expect(contentType.fields.length).to.gt(8);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"File Asset Copy\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "fileAsset", + "_copy" + ] + } + }, + "response": [] + }, + { + "name": "ContentType Source does not exist", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 400\", function() {", + " pm.response.to.have.status(400);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"File Asset Copy\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/fileAssetNotExist/_copy", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "fileAssetNotExist", + "_copy" + ] } - ], - "description": "Verifies that CRUD operations on Field Variables are working as expected." + }, + "response": [] }, { - "name": "Field Variables - No User", - "item": [ + "name": "ContentType Name Not Sent", + "event": [ { - "name": "invalidate User Session", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 400\", function() {", + " pm.response.to.have.status(400);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/logout", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "logout" - ] + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"variable\": \"FileAssetCopyTestNot\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "fileAsset", + "_copy" + ] + } + }, + "response": [] + }, + { + "name": "ContentType Copy no body", + "event": [ { - "name": "Create Field Variable using Field ID", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 400\", function() {", + " pm.response.to.have.status(400);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" }, { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"An error message must be returned\", function () {", - " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"key\": \"test-field-variable\",\n \"value\": \"Value for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "id", - "{{contentType.field4}}", - "variables" - ] - }, - "description": "Attempts to create a new Field Variable without User authentication." - }, - "response": [] + ] }, + "method": "POST", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "fileAsset", + "_copy" + ] + } + }, + "response": [] + }, + { + "name": "Copy FileAsset Unsupported Media Type", + "event": [ { - "name": "Create Field Variable using Var Name", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "// Validate the response status is 415", + "pm.test(\"Response status is 415\", function () {", + " pm.response.to.have.status(415);", + "});", + "", + "// Validate that the response body contains the 'message' property and it is not empty", + "pm.test(\"Response should have an error message\", function () {", + " const responseBody = pm.response.json();", + " pm.expect(responseBody).to.have.property('message').that.is.not.empty;", + " pm.expect(responseBody.message).to.equal('HTTP 415 Unsupported Media Type');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "content-type": true + } + }, + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" }, { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"An error message must be returned\", function () {", - " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"key\": \"test-field-variable\",\n \"value\": \"NEW VALUE for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "var", - "{{contentType.field4.varName}}", - "variables" - ] - }, - "description": "Attempts to create a new Field Variable without User authentication." - }, - "response": [] + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/javascript", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"File Asset Copy\"\n}", + "options": { + "raw": { + "language": "json" + } + } }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "fileAsset", + "_copy" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Test Filtered Content Types", + "item": [ + { + "name": "pre - Import Test Content Types", + "event": [ { - "name": "Update Field Variable using Field ID", - "event": [ + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Bundle 'bundle-with-content-types-issue-22039.tar.gz' was not uploaded!\", function () {", + " pm.response.to.have.status(200);", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData[\"bundleName\"]).to.eql(\"bundle-with-content-types-issue-22039.tar.gz\");", + " pm.expect(jsonData[\"status\"]).to.eql(\"SUCCESS\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" }, { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"An error message must be returned\", function () {", - " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/octet-stream" + }, + { + "key": "Content-Disposition", + "value": "attachment" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "file", + "type": "file", + "src": "resources/ContentTypeResource/bundle-with-content-types-issue-22039.tar.gz" } + ] + }, + "url": { + "raw": "{{serverURL}}/api/bundle/sync", + "host": [ + "{{serverURL}}" ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"UPDATED VALUE USING ID for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "id", - "{{contentType.field4}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" - ] + "path": [ + "api", + "bundle", + "sync" + ], + "query": [ + { + "key": "AUTH_TOKEN", + "value": "", + "disabled": true + } + ] + }, + "description": "Imports a Bundle containing the Content Types that are supposed to exist for the subsequent tests to work as expected." + }, + "response": [] + }, + { + "name": "Get Content Types - First page", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code must be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"The 'Content (Generic)' type must come first!'\", function () {", + " pm.expect(\"Content (Generic)\").to.equal(jsonData.entity[0].name);", + "});", + "", + "pm.test(\"There must be 3 Content Types in the response only!'\", function () {", + " pm.expect(3).to.equal(jsonData.entity.length);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" }, - "description": "Attempts to update a Field Variable without User authentication." - }, - "response": [] + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,htmlpageasset,FileAsset\"\n },\n \"page\": 1,\n \"perPage\": 3\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "_filter" + ] }, + "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the pagination parameters**." + }, + "response": [] + }, + { + "name": "Get Content Types - Second page", + "event": [ { - "name": "Update Field Variable using Var Name", - "event": [ + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code must be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"The 'dotAsset' type must come first!'\", function () {", + " pm.expect(\"dotAsset\").to.equal(jsonData.entity[0].name);", + "});", + "", + "pm.test(\"There must be 2 Content Types in the response only!'\", function () {", + " pm.expect(2).to.equal(jsonData.entity.length);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" }, { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"An error message must be returned\", function () {", - " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\"\n },\n \"page\": 2,\n \"perPage\": 3\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "host": [ + "{{serverURL}}" ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": \"{{contentType.field4.fieldVarOne.id}}\",\n \"key\": \"{{contentType.field4.fieldVarOne.key}}\",\n \"value\": \"UPDATED VALUE USING VAR NAME for my field variable\",\n \"clazz\": \"com.dotcms.contenttype.model.field.FieldVariable\",\n \"fieldId\": \"{{contentType.field4}}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "var", - "{{contentType.field4.varName}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" - ] - }, - "description": "Attempts to update a Field Variable without User authentication." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "_filter" + ] }, + "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the pagination parameters**." + }, + "response": [] + }, + { + "name": "Get Content Types - Not paginated", + "event": [ { - "name": "Delete Field Variable using Field ID", - "event": [ + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code must be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"All 5 Content Types in the response only!'\", function () {", + " pm.expect(5).to.equal(jsonData.entity.length);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" }, { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"An error message must be returned\", function () {", - " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/id/{{contentType.field4}}/variables/id/{{contentType.field4.fieldVarOne.id}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "id", - "{{contentType.field4}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" - ] - }, - "description": "Attempts to delete a Field Variable without User authentication." - }, - "response": [] + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "_filter" + ] }, + "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **without any pagination parameters.**" + }, + "response": [] + }, + { + "name": "Get Content Types - Filtered", + "event": [ { - "name": "Update Field Variable using Var Name", - "event": [ + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code must be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Only 2 Content Types with the letters 'ent' should be returned!'\", function () {", + " pm.expect(2).to.equal(jsonData.entity.length);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "password", + "value": "admin", + "type": "string" }, { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"An error message must be returned\", function () {", - " pm.expect(pm.response.text()).to.equal(\"Invalid User\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "key": "username", + "value": "admin@dotcms.com", + "type": "string" } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\",\n \"query\": \"ent\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "host": [ + "{{serverURL}}" ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/{{contentTypeId}}/fields/var/{{contentType.field4.varName}}/variables/id/{{contentType.field4.fieldVarOne.id}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "{{contentTypeId}}", - "fields", - "var", - "{{contentType.field4.varName}}", - "variables", - "id", - "{{contentType.field4.fieldVarOne.id}}" - ] - }, - "description": "Attempts to delete a Field Variable without User authentication." - }, - "response": [] - } - ], - "description": "Verifies that CRUD operations on Field Variables DO NOT WORK for the Anonymous User." + "path": [ + "api", + "v1", + "contenttype", + "_filter" + ] + }, + "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the specified filter including the letters that might be present in either the Content Type's name or Velocity Var Name.**" + }, + "response": [] }, { - "name": "Cleanup Content Type", + "name": "Get Content Types - Filtered Paginated", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code must be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Only 1 Content Type with the letters 'set' should be returned!'\", function () {", + " pm.expect(1).to.equal(jsonData.entity.length);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], "request": { "auth": { "type": "basic", @@ -2520,10 +4194,19 @@ } ] }, - "method": "DELETE", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\",\n \"query\": \"set\"\n },\n \"page\": 1,\n \"perPage\": 3\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/_filter", "host": [ "{{serverURL}}" ], @@ -2531,51 +4214,48 @@ "api", "v1", "contenttype", - "id", - "{{contentTypeId}}" + "_filter" ] - } + }, + "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the specified filter including the letters that might be present in either the Content Type's name or Velocity Var Name.**\n\nIn this case, the second page is being requested." }, "response": [] - } - ], - "description": "Verifies that creating Field Variables for Fields in a Content Type is working as expected." - }, - { - "name": "Test Copy ContentType", - "item": [ + }, { - "name": "Copy FileAsset Success", + "name": "Get Content Types - All types", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", - "var contentType = jsonData.entity;", "", - "pm.test(\"Status code should be 200\", function() {", + "pm.test(\"Status code must be ok 200\", function () {", " pm.response.to.have.status(200);", "});", - "pm.test(\"Content Type has the provided name\", function() {", - " pm.expect(contentType.name).to.eql(\"File Asset Copy\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"At least 12 Content Types must be returned, as not filter is set!'\", function () {", + " pm.expect(jsonData.entity.length).to.greaterThan(11)", "});", - "pm.test(\"Content Type should have 9 fields\", function() {", - " pm.expect(contentType.fields.length).to.gt(8);", - "});" + "" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { - "key": "token", - "value": "{{jwt}}", + "key": "username", + "value": "admin@dotcms.com", "type": "string" } ] @@ -2584,7 +4264,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"name\": \"File Asset Copy\"\n}", + "raw": "{\n \"orderBy\": \"name\",\n \"direction\": \"ASC\",\n \"perPage\": 40\n}", "options": { "raw": { "language": "json" @@ -2592,7 +4272,7 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", + "raw": "{{serverURL}}/api/v1/contenttype/_filter", "host": [ "{{serverURL}}" ], @@ -2600,36 +4280,55 @@ "api", "v1", "contenttype", - "fileAsset", - "_copy" + "_filter" ] - } + }, + "description": "Returns the appropriate JSON data with **ALL** the Content Types in the content repo as no filtering parameters were provided." }, "response": [] - }, + } + ], + "description": "This Test Collection will verify that the Content Type Filtering Endpoint works as expected. This endpoint can take a list of specific Content Types and perform filtering and pagination operations on them." + }, + { + "name": "Test Accept Site Names and Folder Path", + "item": [ { - "name": "ContentType Source does not exist", + "name": "createFolders Success", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 400\", function() {", - " pm.response.to.have.status(400);", + "pm.test(\"Status code should be 200\", function () {", + " pm.response.to.have.status(200);", + " let jsonData = pm.response.json();", + " pm.expect(jsonData.entity.length).to.be.above(0); ", + " let folder = jsonData.entity[0];", + " pm.expect(folder.title).eql(\"foo2\");", + " pm.expect(folder.type).eql(\"folder\");", + " pm.expect(folder.path).eql(\"/foo1/foo2/\");", + " pm.collectionVariables.set(\"folder\", folder);", + " pm.collectionVariables.set(\"folder.identifier\", folder.identifier);", + " pm.collectionVariables.set(\"folder.hostId\", folder.hostId);", "});" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { - "key": "token", - "value": "{{jwt}}", + "key": "username", + "value": "admin@dotcms.com", "type": "string" } ] @@ -2638,7 +4337,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"name\": \"File Asset Copy\"\n}", + "raw": "[\"/foo1/foo2\"]\n", "options": { "raw": { "language": "json" @@ -2646,46 +4345,65 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/fileAssetNotExist/_copy", + "raw": "{{serverURL}}/api/v1/folder/createfolders/default", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "fileAssetNotExist", - "_copy" + "folder", + "createfolders", + "default" ] } }, "response": [] }, { - "name": "ContentType Name Not Sent", + "name": "Create ContentType From Given Host Idenifier and Folder Identifier", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 400\", function() {", - " pm.response.to.have.status(400);", - "});", + "let jsonData = pm.response.json();", + "let contentType = jsonData.entity[0];", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200);", + " let folder = pm.collectionVariables.get(\"folder\");", + " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", + " pm.expect(contentType.folder).to.eql(folder.identifier);", + " pm.expect(contentType.host).to.eql(folder.hostId);", + "})", "" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { - "key": "token", - "value": "{{jwt}}", + "key": "username", + "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, @@ -2693,7 +4411,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"variable\": \"FileAssetCopyTestNot\"\n}", + "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"system\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"CT created using the folderPath property\", \n \"host\":\"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n \"folder\":\"{{folder.identifier}}\",\n \"name\":\"SimpleContentTypeFromFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", "options": { "raw": { "language": "json" @@ -2701,86 +4419,110 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "fileAsset", - "_copy" + "contenttype" ] - } + }, + "description": "Creates a contentType using the folderPath property\n\nExpect success." }, "response": [] }, { - "name": "ContentType Copy no body", + "name": "Create ContentType From Given Folder Path", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 400\", function() {", - " pm.response.to.have.status(400);", - "});", + "let jsonData = pm.response.json();", + "let contentType = jsonData.entity[0];", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200);", + " let folder = pm.collectionVariables.get(\"folder\");", + " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", + " pm.expect(contentType.folder).to.eql(folder.identifier);", + " pm.expect(contentType.host).to.eql(folder.hostId);", + "})", "" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ { - "key": "token", - "value": "{{jwt}}", + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"defaultType\":false,\n \"fixed\":false, \n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"CT created using the folderPath property\", \n \"folderPath\":\"default:/foo1/foo2\",\n \"name\":\"SimpleContentTypeFromFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/fileAsset/_copy", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "fileAsset", - "_copy" + "contenttype" ] - } + }, + "description": "Creates a contentType using the folderPath property\n\nExpect success." }, "response": [] - } - ] - }, - { - "name": "Test Filtered Content Types", - "item": [ + }, { - "name": "pre - Import Test Content Types", + "name": "Create ContentType From Given Host Name and Folder Path", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Bundle 'bundle-with-content-types-issue-22039.tar.gz' was not uploaded!\", function () {", + "let jsonData = pm.response.json();", + "let contentType = jsonData.entity[0];", + "pm.test(\"Status code should be 200\", function() {", " pm.response.to.have.status(200);", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData[\"bundleName\"]).to.eql(\"bundle-with-content-types-issue-22039.tar.gz\");", - " pm.expect(jsonData[\"status\"]).to.eql(\"SUCCESS\");", - "});" + " let folder = pm.collectionVariables.get(\"folder\");", + " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", + " pm.expect(contentType.folder).to.eql(folder.identifier);", + " pm.expect(contentType.host).to.eql(folder.hostId);", + "})", + "" ], "type": "text/javascript" } @@ -2790,86 +4532,72 @@ "auth": { "type": "basic", "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { "key": "username", "value": "admin@dotcms.com", "type": "string" }, { - "key": "password", - "value": "admin", - "type": "string" + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/octet-stream" - }, - { - "key": "Content-Disposition", - "value": "attachment" - } - ], + "header": [], "body": { - "mode": "formdata", - "formdata": [ - { - "key": "file", - "type": "file", - "src": "resources/ContentTypeResource/bundle-with-content-types-issue-22039.tar.gz" + "mode": "raw", + "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"system\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"Here we're sending host name an the folder path separately\", \n \"host\":\"default\",\n \"folderPath\":\"/foo1/foo2\",\n \"name\":\"SimpleContentTypeUsingHostNameAndFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", + "options": { + "raw": { + "language": "json" } - ] + } }, "url": { - "raw": "{{serverURL}}/api/bundle/sync", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", - "bundle", - "sync" - ], - "query": [ - { - "key": "AUTH_TOKEN", - "value": "", - "disabled": true - } + "v1", + "contenttype" ] }, - "description": "Imports a Bundle containing the Content Types that are supposed to exist for the subsequent tests to work as expected." + "description": "Creates a contentType using a host name and folderPath\n\nHere we're sending host name and the folder path only contains the folders bit without the site name portion" }, "response": [] }, { - "name": "Get Content Types - First page", + "name": "Create ContentType From Given Host Identifier and Folder Path (no host)", "event": [ { "listen": "test", "script": { "exec": [ - "", - "pm.test(\"Status code must be ok 200\", function () {", + "let jsonData = pm.response.json();", + "let contentType = jsonData.entity[0];", + "pm.test(\"Status code should be 200\", function() {", " pm.response.to.have.status(200);", - "});", - "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"The 'Content (Generic)' type must come first!'\", function () {", - " pm.expect(\"Content (Generic)\").to.equal(jsonData.entity[0].name);", - "});", - "", - "pm.test(\"There must be 3 Content Types in the response only!'\", function () {", - " pm.expect(3).to.equal(jsonData.entity.length);", - "});", + " let folder = pm.collectionVariables.get(\"folder\");", + " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", + " pm.expect(contentType.folder).to.eql(folder.identifier);", + " pm.expect(contentType.host).to.eql(folder.hostId);", + "})", "" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], @@ -2886,6 +4614,15 @@ "key": "username", "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, @@ -2893,7 +4630,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,htmlpageasset,FileAsset\"\n },\n \"page\": 1,\n \"perPage\": 3\n}", + "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"Here we're sending host name an the folder path separately\", \n \"host\":\"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n \"folderPath\":\"/foo1/foo2\",\n \"name\":\"SimpleContentTypeUsingHostIdAndFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", "options": { "raw": { "language": "json" @@ -2901,43 +4638,35 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "_filter" + "contenttype" ] }, - "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the pagination parameters**." + "description": "Creates a contentType using a host name and folderPath\n\nHere we're sending host name and the folder path only contains the folders bit without the site name portion" }, "response": [] }, { - "name": "Get Content Types - Second page", + "name": "Create FIXED ContentType Expect System-Host and System-Folder", "event": [ { - "listen": "test", - "script": { - "exec": [ - "", - "pm.test(\"Status code must be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"The 'dotAsset' type must come first!'\", function () {", - " pm.expect(\"dotAsset\").to.equal(jsonData.entity[0].name);", - "});", - "", - "pm.test(\"There must be 2 Content Types in the response only!'\", function () {", - " pm.expect(2).to.equal(jsonData.entity.length);", - "});", - "" + "listen": "test", + "script": { + "exec": [ + "let jsonData = pm.response.json();", + "let contentType = jsonData.entity[0];", + "pm.test(\"Status code should be 200\", function() {", + " pm.response.to.have.status(200); ", + " pm.expect(contentType.folderPath).to.eql(\"/\");", + " pm.expect(contentType.folder).to.eql(\"SYSTEM_FOLDER\");", + " pm.expect(contentType.host).to.eql(\"SYSTEM_HOST\");", + "})" ], "type": "text/javascript" } @@ -2956,6 +4685,15 @@ "key": "username", "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, @@ -2963,7 +4701,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\"\n },\n \"page\": 2,\n \"perPage\": 3\n}", + "raw": "{\n \"defaultType\":false,\n \"fixed\":true, \n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"CT created using the folderPath property\", \n \"folderPath\":\"any:/non-existing-folder\",\n \"name\":\"SimpleContentTypeFromFolderPathNonExistingFolder\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", "options": { "raw": { "language": "json" @@ -2971,42 +4709,93 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "_filter" + "contenttype" ] }, - "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the pagination parameters**." + "description": "Creates a simple contentType, that uses the folderPath property to set the location" }, "response": [] - }, + } + ] + }, + { + "name": "Field Data", + "item": [ { - "name": "Get Content Types - Not paginated", + "name": "Get All Field Types", "event": [ { "listen": "test", "script": { "exec": [ - "", - "pm.test(\"Status code must be ok 200\", function () {", + "pm.test(\"HTTP Status must be successful\", function() {", " pm.response.to.have.status(200);", "});", "", - "var jsonData = pm.response.json();", + "const expectedFieldTypes = pm.collectionVariables.get(\"fieldTypesArr\");", "", - "pm.test(\"All 5 Content Types in the response only!'\", function () {", - " pm.expect(5).to.equal(jsonData.entity.length);", + "pm.test(\"Checking the total number of Field Types\", function () {", + " const fieldTypes = pm.response.json().entity;", + " pm.expect(expectedFieldTypes.length).to.eql(fieldTypes.length, \"There must be exactly \" + expectedFieldTypes.length + \" Field Types in dotCMS\");", + "});", + "", + "pm.test(\"Checking the classes in all Field Types\", function () {", + " const fieldTypes = pm.response.json().entity;", + " fieldTypes.forEach(type => {", + "", + " pm.expect(expectedFieldTypes.includes(type.clazz)).to.equal(true, \"Type '\" + type.clazz + \"' doesn't exist in the official Field Type list\");", + "", + " })", "});", "" ], "type": "text/javascript" } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "const fieldTypesArr = [ ", + " \"com.dotcms.contenttype.model.field.ImmutableBinaryField\",", + " \"com.dotcms.contenttype.model.field.ImmutableStoryBlockField\",", + " \"com.dotcms.contenttype.model.field.ImmutableCategoryField\",", + " \"com.dotcms.contenttype.model.field.ImmutableCheckboxField\",", + " \"com.dotcms.contenttype.model.field.ImmutableConstantField\",", + " \"com.dotcms.contenttype.model.field.ImmutableCustomField\",", + " \"com.dotcms.contenttype.model.field.ImmutableDateField\",", + " \"com.dotcms.contenttype.model.field.ImmutableDateTimeField\",", + " \"com.dotcms.contenttype.model.field.ImmutableFileField\",", + " \"com.dotcms.contenttype.model.field.ImmutableHiddenField\",", + " \"com.dotcms.contenttype.model.field.ImmutableImageField\",", + " \"com.dotcms.contenttype.model.field.ImmutableJSONField\",", + " \"com.dotcms.contenttype.model.field.ImmutableKeyValueField\",", + " \"com.dotcms.contenttype.model.field.ImmutableLineDividerField\",", + " \"com.dotcms.contenttype.model.field.ImmutableMultiSelectField\",", + " \"com.dotcms.contenttype.model.field.ImmutablePermissionTabField\",", + " \"com.dotcms.contenttype.model.field.ImmutableRadioField\",", + " \"com.dotcms.contenttype.model.field.ImmutableRelationshipField\",", + " \"com.dotcms.contenttype.model.field.ImmutableRelationshipsTabField\",", + " \"com.dotcms.contenttype.model.field.ImmutableSelectField\",", + " \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",", + " \"com.dotcms.contenttype.model.field.ImmutableTabDividerField\",", + " \"com.dotcms.contenttype.model.field.ImmutableTagField\",", + " \"com.dotcms.contenttype.model.field.ImmutableTextField\",", + " \"com.dotcms.contenttype.model.field.ImmutableTextAreaField\",", + " \"com.dotcms.contenttype.model.field.ImmutableTimeField\",", + " \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\"", + "];", + "pm.collectionVariables.set(\"fieldTypesArr\", fieldTypesArr);" + ], + "type": "text/javascript" + } } ], "request": { @@ -3014,65 +4803,72 @@ "type": "basic", "basic": [ { - "key": "password", - "value": "admin", + "key": "username", + "value": "admin@dotcms.com", "type": "string" }, { - "key": "username", - "value": "admin@dotcms.com", + "key": "password", + "value": "admin", "type": "string" } ] }, - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\"\n }\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "raw": "{{serverURL}}/api/v1/fieldTypes", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "_filter" + "fieldTypes" ] }, - "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **without any pagination parameters.**" + "description": "Verifies that there's a specific number of Field Types in dotCMS, and that they all match one of the expected Field Types." }, "response": [] }, { - "name": "Get Content Types - Filtered", + "name": "Site or Folder Field with No Searchable Option", "event": [ { "listen": "test", "script": { "exec": [ - "", - "pm.test(\"Status code must be ok 200\", function () {", + "pm.test(\"HTTP Status must be successful\", function() {", " pm.response.to.have.status(200);", "});", "", - "var jsonData = pm.response.json();", + "pm.test(\"Checking that 'Searchable' option in 'Site or Folder' field is NOT present anymore\", function () {", + " const fieldTypes = pm.response.json().entity;", + " var isPropertyPresent = false;", + " fieldTypes.forEach(type => {", "", - "pm.test(\"Only 2 Content Types with the letters 'ent' should be returned!'\", function () {", - " pm.expect(2).to.equal(jsonData.entity.length);", + " if (\"com.dotcms.contenttype.model.field.ImmutableHostFolderField\" === type.clazz && type.properties.includes(\"searchable\")) {", + " isPropertyPresent = true;", + " }", + "", + " });", + " if (isPropertyPresent) {", + " pm.expect(false).to.equal(isPropertyPresent, \"The 'searchable' property must not be present for 'Site or Folder' fields\");", + " }", "});", "" ], "type": "text/javascript" } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } } ], "request": { @@ -3080,64 +4876,66 @@ "type": "basic", "basic": [ { - "key": "password", - "value": "admin", + "key": "username", + "value": "admin@dotcms.com", "type": "string" }, { - "key": "username", - "value": "admin@dotcms.com", + "key": "password", + "value": "admin", "type": "string" } ] }, - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\",\n \"query\": \"ent\"\n }\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "raw": "{{serverURL}}/api/v1/fieldTypes", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "_filter" + "fieldTypes" ] - }, - "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the specified filter including the letters that might be present in either the Content Type's name or Velocity Var Name.**" + } }, "response": [] - }, + } + ], + "description": "Verifies that operations related to retrieving data from fields in Content Types are aworking as expected." + }, + { + "name": "Test delete publish/expire field", + "item": [ { - "name": "Get Content Types - Filtered Paginated", + "name": "Create ContentType with publish/expire fields", "event": [ { "listen": "test", "script": { "exec": [ + "var jsonData = pm.response.json();", "", - "pm.test(\"Status code must be ok 200\", function () {", + "pm.collectionVariables.set(\"contentTypeID\", jsonData.entity[0].id);", + "pm.collectionVariables.set(\"contentTypeVAR\", jsonData.entity[0].variable);", + "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[2].id);", + "", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", "});", "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Only 1 Content Type with the letters 'set' should be returned!'\", function () {", - " pm.expect(1).to.equal(jsonData.entity.length);", + "pm.test(\"icon check\", function () {", + " pm.expect(jsonData.entity[0].icon).to.eql('testIcon');", "});", - "" + "", + "pm.test(\"Fields check\", function () {", + " pm.expect(jsonData.entity[0].fields.length).to.eql(4);", + "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -3154,54 +4952,54 @@ "key": "username", "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, "method": "POST", - "header": [], + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n \"filter\" : {\n \"types\" : \"calendarEvent,Vanityurl,webPageContent,DotAsset,persona\",\n \"query\": \"set\"\n },\n \"page\": 1,\n \"perPage\": 3\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test dates content {{$randomBankAccount}}\",\n\t\"variable\": \"testDatesContent{{$randomBankAccount}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"testIcon\",\n \"sortOrder\": 3,\n \"publishDateVar\": \"publishDate\",\n \"expireDateVar\": \"expireDate\",\n\t\"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableDateTimeField\",\n \"dataType\": \"DATE\",\n \"fieldType\": \"Date-and-Time\",\n \"fieldTypeLabel\": \"Date and Time\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Publish Date\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"publishDate\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableDateTimeField\",\n \"dataType\": \"DATE\",\n \"fieldType\": \"Date-and-Time\",\n \"fieldTypeLabel\": \"Date and Time\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"iDate\": 1685054935000,\n \"indexed\": true,\n \"listed\": true,\n \"modDate\": 1685054935000,\n \"name\": \"Expire Date\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"expireDate\"\n }\n\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "_filter" + "contenttype" ] }, - "description": "Returns the appropriate JSON data with Content Type information based on the specified list of Velocity Variable Names **and the specified filter including the letters that might be present in either the Content Type's name or Velocity Var Name.**\n\nIn this case, the second page is being requested." + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." }, - "response": [] - }, - { - "name": "Get Content Types - All types", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "", - "pm.test(\"Status code must be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"At least 12 Content Types must be returned, as not filter is set!'\", function () {", - " pm.expect(jsonData.entity.length).to.greaterThan(11)", - "});", - "" + "response": [] + }, + { + "name": "Delete dateTime field", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", + "});" ], "type": "text/javascript" } @@ -3220,14 +5018,23 @@ "key": "username", "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, - "method": "POST", + "method": "DELETE", "header": [], "body": { "mode": "raw", - "raw": "{\n \"orderBy\": \"name\",\n \"direction\": \"ASC\",\n \"perPage\": 40\n}", + "raw": "{\"fieldsID\": [\"{{contentTypeFieldID}}\"]}", "options": { "raw": { "language": "json" @@ -3235,46 +5042,49 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/_filter", + "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeID}}/fields", "host": [ "{{serverURL}}" ], "path": [ "api", - "v1", + "v3", "contenttype", - "_filter" + "{{contentTypeID}}", + "fields" ] }, - "description": "Returns the appropriate JSON data with **ALL** the Content Types in the content repo as no filtering parameters were provided." + "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." }, "response": [] } - ], - "description": "This Test Collection will verify that the Content Type Filtering Endpoint works as expected. This endpoint can take a list of specific Content Types and perform filtering and pagination operations on them." + ] }, { - "name": "Test Accept Site Names and Folder Path", + "name": "Get Types from one or more Sites", "item": [ { - "name": "createFolders Success", + "name": "(Legacy) Types from System Host", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 200\", function () {", + "pm.test(\"HTTP Status code must be 200\", function () {", " pm.response.to.have.status(200);", - " let jsonData = pm.response.json();", - " pm.expect(jsonData.entity.length).to.be.above(0); ", - " let folder = jsonData.entity[0];", - " pm.expect(folder.title).eql(\"foo2\");", - " pm.expect(folder.type).eql(\"folder\");", - " pm.expect(folder.path).eql(\"/foo1/foo2/\");", - " pm.collectionVariables.set(\"folder\", folder);", - " pm.collectionVariables.set(\"folder.identifier\", folder.identifier);", - " pm.collectionVariables.set(\"folder.hostId\", folder.hostId);", - "});" + "});", + "", + "pm.test(\"Checking that there at least 10 Content Types living under System Host\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(10, \"There MUST be at least 10 Content Types living in System Host -- unless some were added/removed\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(10, \"The 'totalEntries' parameter must be at least 10\");", + "});", + "" ], "type": "text/javascript" } @@ -3285,60 +5095,65 @@ "type": "basic", "basic": [ { - "key": "password", - "value": "admin", + "key": "username", + "value": "admin@dotcms.com", "type": "string" }, { - "key": "username", - "value": "admin@dotcms.com", + "key": "password", + "value": "admin", "type": "string" } ] }, - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "[\"/foo1/foo2\"]\n", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/folder/createfolders/default", + "raw": "{{serverURL}}/api/v1/contenttype?host=SYSTEM_HOST&per_page=40", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "folder", - "createfolders", - "default" + "contenttype" + ], + "query": [ + { + "key": "host", + "value": "SYSTEM_HOST" + }, + { + "key": "per_page", + "value": "40" + } ] - } + }, + "description": "Returns the Content Types living in System Host." }, "response": [] }, { - "name": "Create ContentType From Given Host Idenifier and Folder Identifier", + "name": "(Legacy) Types from Default site", "event": [ { "listen": "test", "script": { "exec": [ - "let jsonData = pm.response.json();", - "let contentType = jsonData.entity[0];", - "pm.test(\"Status code should be 200\", function() {", + "pm.test(\"HTTP Status code must be 200\", function () {", " pm.response.to.have.status(200);", - " let folder = pm.collectionVariables.get(\"folder\");", - " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", - " pm.expect(contentType.folder).to.eql(folder.identifier);", - " pm.expect(contentType.host).to.eql(folder.hostId);", - "})", + "});", + "", + "pm.test(\"Checking that there at least 2 Content Types living under the Default Site\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(2, \"There MUST be at least 2 Content Types living in the Default Site\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(10, \"The 'perPage' parameter must be 10\");", + " pm.expect(pagination.totalEntries).to.be.gte(2, \"The 'totalEntries' parameter must be at least 2\");", + "});", "" ], "type": "text/javascript" @@ -3349,40 +5164,22 @@ "auth": { "type": "basic", "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, { "key": "username", "value": "admin@dotcms.com", "type": "string" }, { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" + "key": "password", + "value": "admin", + "type": "string" } ] }, - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"system\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"CT created using the folderPath property\", \n \"host\":\"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n \"folder\":\"{{folder.identifier}}\",\n \"name\":\"SimpleContentTypeFromFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype?host=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d", "host": [ "{{serverURL}}" ], @@ -3390,28 +5187,45 @@ "api", "v1", "contenttype" + ], + "query": [ + { + "key": "host", + "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d" + } ] }, - "description": "Creates a contentType using the folderPath property\n\nExpect success." + "description": "Returns all the Content Types living in the Default site." }, "response": [] }, { - "name": "Create ContentType From Given Folder Path", + "name": "Get Types from System Host", "event": [ { "listen": "test", "script": { "exec": [ - "let jsonData = pm.response.json();", - "let contentType = jsonData.entity[0];", - "pm.test(\"Status code should be 200\", function() {", + "pm.test(\"HTTP Status code must be 200\", function () {", " pm.response.to.have.status(200);", - " let folder = pm.collectionVariables.get(\"folder\");", - " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", - " pm.expect(contentType.folder).to.eql(folder.identifier);", - " pm.expect(contentType.host).to.eql(folder.hostId);", - "})", + "});", + "", + "pm.test(\"Checking that there are at least 10 Content Types living under the System Host\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(10, \"There MUST be at least 10 Content Types living in System Host -- unless some were added/removed\");", + "});", + "", + "pm.test(\"Checking that there is no Content Type from another Site\", function () {", + " const entity = pm.response.json().entity;", + " const typeFromDefaultSite = entity.find(type => type.host !== 'SYSTEM_HOST');", + " pm.expect(typeFromDefaultSite).equals(undefined, \"There must be no Content Types from sites other than System Host\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(10, \"The 'totalEntries' parameter must be at least 10\");", + "});", "" ], "type": "text/javascript" @@ -3422,40 +5236,22 @@ "auth": { "type": "basic", "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, { "key": "username", "value": "admin@dotcms.com", "type": "string" }, { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" + "key": "password", + "value": "admin", + "type": "string" } ] }, - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"defaultType\":false,\n \"fixed\":false, \n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"CT created using the folderPath property\", \n \"folderPath\":\"default:/foo1/foo2\",\n \"name\":\"SimpleContentTypeFromFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype?sites=SYSTEM_HOST&per_page=40", "host": [ "{{serverURL}}" ], @@ -3463,28 +5259,49 @@ "api", "v1", "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "SYSTEM_HOST" + }, + { + "key": "per_page", + "value": "40" + } ] }, - "description": "Creates a contentType using the folderPath property\n\nExpect success." + "description": "Returns all the Content Types living in the Default site, using the new query string parameter." }, "response": [] }, { - "name": "Create ContentType From Given Host Name and Folder Path", + "name": "Get Types from Default site", "event": [ { "listen": "test", "script": { "exec": [ - "let jsonData = pm.response.json();", - "let contentType = jsonData.entity[0];", - "pm.test(\"Status code should be 200\", function() {", + "pm.test(\"HTTP Status code must be 200\", function () {", " pm.response.to.have.status(200);", - " let folder = pm.collectionVariables.get(\"folder\");", - " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", - " pm.expect(contentType.folder).to.eql(folder.identifier);", - " pm.expect(contentType.host).to.eql(folder.hostId);", - "})", + "});", + "", + "pm.test(\"Checking that there are at least 2 Content Types living under the Default site\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(2, \"There MUST be at least 2 Content Types living in the Default site\");", + "});", + "", + "pm.test(\"Checking that there is no Content Type from another Site\", function () {", + " const entity = pm.response.json().entity;", + " const typeFromDefaultSite = entity.find(type => type.host !== '8a7d5e23-da1e-420a-b4f0-471e7da8ea2d');", + " pm.expect(typeFromDefaultSite).equals(undefined, \"There must be no Content Types from sites other than Default\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(2, \"The 'totalEntries' parameter must be at least 2\");", + "});", "" ], "type": "text/javascript" @@ -3495,40 +5312,22 @@ "auth": { "type": "basic", "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, { "key": "username", "value": "admin@dotcms.com", "type": "string" }, { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" + "key": "password", + "value": "admin", + "type": "string" } ] }, - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"system\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"Here we're sending host name an the folder path separately\", \n \"host\":\"default\",\n \"folderPath\":\"/foo1/foo2\",\n \"name\":\"SimpleContentTypeUsingHostNameAndFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype?sites=default&per_page=40", "host": [ "{{serverURL}}" ], @@ -3536,28 +5335,49 @@ "api", "v1", "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "default" + }, + { + "key": "per_page", + "value": "40" + } ] }, - "description": "Creates a contentType using a host name and folderPath\n\nHere we're sending host name and the folder path only contains the folders bit without the site name portion" + "description": "Returns all the Content Types living in the Default site, using the new query string parameter, and passing down the Site Key." }, "response": [] }, { - "name": "Create ContentType From Given Host Identifier and Folder Path (no host)", + "name": "Get Types from Default Site (ID) and System Host", "event": [ { "listen": "test", "script": { "exec": [ - "let jsonData = pm.response.json();", - "let contentType = jsonData.entity[0];", - "pm.test(\"Status code should be 200\", function() {", + "pm.test(\"HTTP Status code must be 200\", function () {", " pm.response.to.have.status(200);", - " let folder = pm.collectionVariables.get(\"folder\");", - " pm.expect(contentType.folderPath).to.eql(\"default:/foo1/foo2/\");", - " pm.expect(contentType.folder).to.eql(folder.identifier);", - " pm.expect(contentType.host).to.eql(folder.hostId);", - "})", + "});", + "", + "pm.test(\"Checking that there are at least 12 Content Types living under the Default and System Host sites\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(12, \"There MUST be at least 12 Content Types living in the Default and System Host sites -- unless some were added/removed\");", + "});", + "", + "pm.test(\"Checking that there is at least 1 Content Type from the Default Site\", function () {", + " const entity = pm.response.json().entity;", + " const typeFromDefaultSite = entity.find(type => type.host === '8a7d5e23-da1e-420a-b4f0-471e7da8ea2d');", + " pm.expect(typeFromDefaultSite).to.not.equal(undefined, \"There MUST be at least one Content Type from the Default Site\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(12, \"The 'totalEntries' parameter must be at least 12\");", + "});", "" ], "type": "text/javascript" @@ -3568,40 +5388,22 @@ "auth": { "type": "basic", "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, { "key": "username", "value": "admin@dotcms.com", "type": "string" }, { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" + "key": "password", + "value": "admin", + "type": "string" } ] }, - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"defaultType\":false,\n \"fixed\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"Here we're sending host name an the folder path separately\", \n \"host\":\"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n \"folderPath\":\"/foo1/foo2\",\n \"name\":\"SimpleContentTypeUsingHostIdAndFolderPath\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype?sites=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d,SYSTEM_HOST&per_page=40", "host": [ "{{serverURL}}" ], @@ -3609,27 +5411,50 @@ "api", "v1", "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d,SYSTEM_HOST" + }, + { + "key": "per_page", + "value": "40" + } ] }, - "description": "Creates a contentType using a host name and folderPath\n\nHere we're sending host name and the folder path only contains the folders bit without the site name portion" + "description": "Returns all the Content Types living in both the Default and System Host sites, using the IDs." }, "response": [] }, { - "name": "Create FIXED ContentType Expect System-Host and System-Folder", + "name": "Get Types from Default Site (Site Key) and System Host Copy", "event": [ { "listen": "test", "script": { "exec": [ - "let jsonData = pm.response.json();", - "let contentType = jsonData.entity[0];", - "pm.test(\"Status code should be 200\", function() {", - " pm.response.to.have.status(200); ", - " pm.expect(contentType.folderPath).to.eql(\"/\");", - " pm.expect(contentType.folder).to.eql(\"SYSTEM_FOLDER\");", - " pm.expect(contentType.host).to.eql(\"SYSTEM_HOST\");", - "})" + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that there are at least 12 Content Types living under the Default and System Host sites\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(12, \"There MUST be at least 12 Content Types living in the Default and System Host sites -- unless some were added/removed\");", + "});", + "", + "pm.test(\"Checking that there is at least 1 Content Type from the Default Site\", function () {", + " const entity = pm.response.json().entity;", + " const typeFromDefaultSite = entity.find(type => type.host === '8a7d5e23-da1e-420a-b4f0-471e7da8ea2d');", + " pm.expect(typeFromDefaultSite).to.not.equal(undefined, \"There MUST be at least one Content Type from the Default Site\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(12, \"The 'totalEntries' parameter must be at least 12\");", + "});", + "" ], "type": "text/javascript" } @@ -3639,40 +5464,22 @@ "auth": { "type": "basic", "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, { "key": "username", "value": "admin@dotcms.com", "type": "string" }, { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" + "key": "password", + "value": "admin", + "type": "string" } ] }, - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"defaultType\":false,\n \"fixed\":true, \n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"CT created using the folderPath property\", \n \"folderPath\":\"any:/non-existing-folder\",\n \"name\":\"SimpleContentTypeFromFolderPathNonExistingFolder\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"],\n \"fields\" : [\n {\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"title\",\n\t\t\t\"variable\": \"title\",\n\t\t\t\"fixed\": true\n\t\t}\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype?sites=default,SYSTEM_HOST&per_page=40", "host": [ "{{serverURL}}" ], @@ -3680,82 +5487,44 @@ "api", "v1", "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "default,SYSTEM_HOST" + }, + { + "key": "per_page", + "value": "40" + } ] }, - "description": "Creates a simple contentType, that uses the folderPath property to set the location" + "description": "Returns all the Content Types living in both the Default and System Host sites, using the Site Key." }, "response": [] - } - ] - }, - { - "name": "Field Data", - "item": [ + }, { - "name": "Get All Field Types", + "name": "Get Types from non-existing Site", "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status must be successful\", function() {", - " pm.response.to.have.status(200);", - "});", - "", - "const expectedFieldTypes = pm.collectionVariables.get(\"fieldTypesArr\");", - "", - "pm.test(\"Checking the total number of Field Types\", function () {", - " const fieldTypes = pm.response.json().entity;", - " pm.expect(expectedFieldTypes.length).to.eql(fieldTypes.length, \"There must be exactly \" + expectedFieldTypes.length + \" Field Types in dotCMS\");", - "});", - "", - "pm.test(\"Checking the classes in all Field Types\", function () {", - " const fieldTypes = pm.response.json().entity;", - " fieldTypes.forEach(type => {", - "", - " pm.expect(expectedFieldTypes.includes(type.clazz)).to.equal(true, \"Type '\" + type.clazz + \"' doesn't exist in the official Field Type list\");", - "", - " })", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "const fieldTypesArr = [ ", - " \"com.dotcms.contenttype.model.field.ImmutableBinaryField\",", - " \"com.dotcms.contenttype.model.field.ImmutableStoryBlockField\",", - " \"com.dotcms.contenttype.model.field.ImmutableCategoryField\",", - " \"com.dotcms.contenttype.model.field.ImmutableCheckboxField\",", - " \"com.dotcms.contenttype.model.field.ImmutableConstantField\",", - " \"com.dotcms.contenttype.model.field.ImmutableCustomField\",", - " \"com.dotcms.contenttype.model.field.ImmutableDateField\",", - " \"com.dotcms.contenttype.model.field.ImmutableDateTimeField\",", - " \"com.dotcms.contenttype.model.field.ImmutableFileField\",", - " \"com.dotcms.contenttype.model.field.ImmutableHiddenField\",", - " \"com.dotcms.contenttype.model.field.ImmutableImageField\",", - " \"com.dotcms.contenttype.model.field.ImmutableJSONField\",", - " \"com.dotcms.contenttype.model.field.ImmutableKeyValueField\",", - " \"com.dotcms.contenttype.model.field.ImmutableLineDividerField\",", - " \"com.dotcms.contenttype.model.field.ImmutableMultiSelectField\",", - " \"com.dotcms.contenttype.model.field.ImmutablePermissionTabField\",", - " \"com.dotcms.contenttype.model.field.ImmutableRadioField\",", - " \"com.dotcms.contenttype.model.field.ImmutableRelationshipField\",", - " \"com.dotcms.contenttype.model.field.ImmutableRelationshipsTabField\",", - " \"com.dotcms.contenttype.model.field.ImmutableSelectField\",", - " \"com.dotcms.contenttype.model.field.ImmutableHostFolderField\",", - " \"com.dotcms.contenttype.model.field.ImmutableTabDividerField\",", - " \"com.dotcms.contenttype.model.field.ImmutableTagField\",", - " \"com.dotcms.contenttype.model.field.ImmutableTextField\",", - " \"com.dotcms.contenttype.model.field.ImmutableTextAreaField\",", - " \"com.dotcms.contenttype.model.field.ImmutableTimeField\",", - " \"com.dotcms.contenttype.model.field.ImmutableWysiwygField\"", - "];", - "pm.collectionVariables.set(\"fieldTypesArr\", fieldTypesArr);" + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Checking that no Content Types are returned\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).equals(0, \"There must be no Content Types in the results\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).equals(0, \"The 'totalEntries' parameter must be zero\");", + "});", + "" ], "type": "text/javascript" } @@ -3780,58 +5549,61 @@ "method": "GET", "header": [], "url": { - "raw": "{{serverURL}}/api/v1/fieldTypes", + "raw": "{{serverURL}}/api/v1/contenttype?sites=non-existing-site&per_page=40", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "fieldTypes" + "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "non-existing-site" + }, + { + "key": "per_page", + "value": "40" + } ] }, - "description": "Verifies that there's a specific number of Field Types in dotCMS, and that they all match one of the expected Field Types." + "description": "Returns all the Content Types living in the non-existing site, which must return an empty list." }, "response": [] }, { - "name": "Site or Folder Field with No Searchable Option", + "name": "Get Types from non-existing Site (ID) and System Host", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"HTTP Status must be successful\", function() {", + "pm.test(\"HTTP Status code must be 200\", function () {", " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Checking that 'Searchable' option in 'Site or Folder' field is NOT present anymore\", function () {", - " const fieldTypes = pm.response.json().entity;", - " var isPropertyPresent = false;", - " fieldTypes.forEach(type => {", + "pm.test(\"Checking that there are at least 10 Content Types living under the Default and System Host sites\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(10, \"There MUST be at least 10 Content Types living in System Host -- unless some were added/removed\");", + "});", "", - " if (\"com.dotcms.contenttype.model.field.ImmutableHostFolderField\" === type.clazz && type.properties.includes(\"searchable\")) {", - " isPropertyPresent = true;", - " }", + "pm.test(\"Checking that all Content Types come from System Host only\", function () {", + " const entity = pm.response.json().entity;", + " const typeFromDefaultSite = entity.find(type => type.host === '12312312-abcd-1234-dcba-456456456456');", + " pm.expect(typeFromDefaultSite).equals(undefined, \"All Content Types must come from System Host only\");", + "});", "", - " });", - " if (isPropertyPresent) {", - " pm.expect(false).to.equal(isPropertyPresent, \"The 'searchable' property must not be present for 'Site or Folder' fields\");", - " }", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(10, \"The 'totalEntries' parameter must be at least 10\");", "});", "" ], "type": "text/javascript" } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } } ], "request": { @@ -3853,52 +5625,60 @@ "method": "GET", "header": [], "url": { - "raw": "{{serverURL}}/api/v1/fieldTypes", + "raw": "{{serverURL}}/api/v1/contenttype?sites=12312312-abcd-1234-dcba-456456456456,SYSTEM_HOST&per_page=40", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "fieldTypes" + "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "12312312-abcd-1234-dcba-456456456456,SYSTEM_HOST" + }, + { + "key": "per_page", + "value": "40" + } ] - } + }, + "description": "Returns all the Content Types living in a non-existing site and System Host, which must return only the types living in System Host." }, "response": [] - } - ], - "description": "Verifies that operations related to retrieving data from fields in Content Types are aworking as expected." - }, - { - "name": "Test delete publish/expire field", - "item": [ + }, { - "name": "Create ContentType with publish/expire fields", + "name": "Get Types from non-existing Site (ID) and Default site", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.collectionVariables.set(\"contentTypeID\", jsonData.entity[0].id);", - "pm.collectionVariables.set(\"contentTypeVAR\", jsonData.entity[0].variable);", - "pm.collectionVariables.set(\"contentTypeFieldID\", jsonData.entity[0].fields[0].id);", - "", - "pm.test(\"Status code should be ok 200\", function () {", + "pm.test(\"HTTP Status code must be 200\", function () {", " pm.response.to.have.status(200);", "});", "", - "pm.test(\"icon check\", function () {", - " pm.expect(jsonData.entity[0].icon).to.eql('testIcon');", + "pm.test(\"Checking that there are at least 2 Content Types living under the Default site\", function () {", + " const entity = pm.response.json().entity;", + " pm.expect(entity.length).to.be.gte(2, \"There MUST be at least 2 Content Types living in the Default site\");", "});", "", - "pm.test(\"Fields check\", function () {", - " pm.expect(jsonData.entity[0].fields.length).to.gte(2);", - "});" + "pm.test(\"Checking that all Content Types come from the Default site only\", function () {", + " const entity = pm.response.json().entity;", + " const typeFromDefaultSite = entity.find(type => type.host === '12312312-abcd-1234-dcba-456456456456');", + " pm.expect(typeFromDefaultSite).equals(undefined, \"All Content Types must come from the Default site only\");", + "});", + "", + "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", + " const pagination = pm.response.json().pagination;", + " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", + " pm.expect(pagination.totalEntries).to.be.gte(2, \"The 'totalEntries' parameter must be at least 2\");", + "});", + "" ], - "type": "text/javascript", - "packages": {} + "type": "text/javascript" } } ], @@ -3906,40 +5686,22 @@ "auth": { "type": "basic", "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, { "key": "username", "value": "admin@dotcms.com", "type": "string" }, { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" + "key": "password", + "value": "admin", + "type": "string" } ] }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"My Structure\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test dates content {{$randomBankAccount}}\",\n\t\"variable\": \"testDatesContent{{$randomBankAccount}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"testIcon\",\n \"sortOrder\": 3,\n \"publishDateVar\": \"publishDate\",\n \"expireDateVar\": \"expireDate\",\n\t\"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableDateTimeField\",\n \"dataType\": \"DATE\",\n \"fieldType\": \"Date-and-Time\",\n \"fieldTypeLabel\": \"Date and Time\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Publish Date\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"publishDate\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableDateTimeField\",\n \"dataType\": \"DATE\",\n \"fieldType\": \"Date-and-Time\",\n \"fieldTypeLabel\": \"Date and Time\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"iDate\": 1685054935000,\n \"indexed\": true,\n \"listed\": true,\n \"modDate\": 1685054935000,\n \"name\": \"Expire Date\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"expireDate\"\n }\n\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, + "method": "GET", + "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype?sites=invalid-site,default&per_page=40", "host": [ "{{serverURL}}" ], @@ -3947,767 +5709,977 @@ "api", "v1", "contenttype" + ], + "query": [ + { + "key": "sites", + "value": "invalid-site,default" + }, + { + "key": "per_page", + "value": "40" + } ] }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." - }, - "response": [] - }, - { - "name": "Delete dateTime field", - "event": [ + "description": "Returns all the Content Types living in a non-existing site and the Defaut site, which must return only the types living in the Default site." + }, + "response": [] + } + ], + "description": "These requests allow you to verify that dotCMS can retrieve a filtered paginated list of Content Types from a specific list of Sites only, and not from the whole repository. You can use both the Site's Identifier, or its Key -- aka, Site Name.\n\nThis suite is testing both the existing per-Site Endpoint -- flagged with **`(Legacy)`** -- and the new multi-site parameter." + }, + { + "name": "Test detail page", + "item": [ + { + "name": "Test update detail page with id and URI", + "item": [ + { + "name": "Create Test Site", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Storing page data for subsequent tests\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"pageDetailSiteId\", jsonData.entity.identifier);", + " pm.collectionVariables.set(\"pageDetailSiteName\", jsonData.entity.siteName);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"siteName\":\"page.detail.host.com.{{$timestamp}}\",\n \"variables\":[]\n}\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/site", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "site" + ] + } + }, + "response": [] + }, + { + "name": "Create test Page1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Storing page id and path for subsequent tests\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"pageDetailPageId1\", jsonData.entity.identifier);", + " pm.collectionVariables.set(\"pageDetailPageInode1\", jsonData.entity.inode);", + " pm.collectionVariables.set(\"pageDetailPageURL1\", jsonData.entity.url);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"contentlet\":{\n\t\t\"stName\": \"htmlpageasset\",\n\t\t\"title\": \"Page1 {{$timestamp}}\",\n \"url\": \"page1-{{$timestamp}}\",\n \"friendlyName\":\"page1-{{$timestamp}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"100\",\n \"hostFolder\":\"{{pageDetailSiteId}}\"\n\t}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] + } + }, + "response": [] + }, { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "name": "Create test Page2", + "event": [ { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Storing page id and path for subsequent tests\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"pageDetailPageId2\", jsonData.entity.identifier);", + " pm.collectionVariables.set(\"pageDetailPageInode2\", jsonData.entity.inode);", + " pm.collectionVariables.set(\"pageDetailPageURL2\", jsonData.entity.url);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"contentlet\":{\n\t\t\"stName\": \"htmlpageasset\",\n\t\t\"title\": \"Pag2 {{$timestamp}}\",\n \"url\": \"page2-{{$timestamp}}\",\n \"friendlyName\":\"page2-{{$timestamp}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"100\",\n \"hostFolder\":\"{{pageDetailSiteId}}\"\n\t}\n}", + "options": { + "raw": { + "language": "json" + } + } }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] + } + }, + "response": [] + }, + { + "name": "Create ContentType with page detail id", + "event": [ { - "key": "saveHelperData", - "type": "any" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity[0].detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity[0].detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});" + ], + "type": "text/javascript", + "packages": {} + } }, { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "DELETE", - "header": [], - "body": { - "mode": "raw", - "raw": "{\"fieldsID\": [\"{{contentTypeFieldID}}\"]}", - "options": { - "raw": { - "language": "json" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeID}}/fields", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v3", - "contenttype", - "{{contentTypeID}}", - "fields" - ] + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"{{pageDetailPageId1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." + }, + "response": [] }, - "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." - }, - "response": [] - } - ] - }, - { - "name": "Get Types from one or more Sites", - "item": [ - { - "name": "(Legacy) Types from System Host", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there at least 10 Content Types living under System Host\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(10, \"There MUST be at least 10 Content Types living in System Host -- unless some were added/removed\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(10, \"The 'totalEntries' parameter must be at least 10\");", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Get Content Type", + "event": [ { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." + }, + "response": [] + }, + { + "name": "Update Content Type with page detail with URI", + "event": [ { - "key": "password", - "value": "admin", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?host=SYSTEM_HOST&per_page=40", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" ], - "query": [ - { - "key": "host", - "value": "SYSTEM_HOST" + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL2}}\",\n \"urlMapPattern\" : \"/{name}\"\n}", + "options": { + "raw": { + "language": "json" + } + } }, - { - "key": "per_page", - "value": "40" - } - ] + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." + }, + "response": [] }, - "description": "Returns the Content Types living in System Host." - }, - "response": [] - }, - { - "name": "(Legacy) Types from Default site", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there at least 2 Content Types living under the Default Site\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(2, \"There MUST be at least 2 Content Types living in the Default Site\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(10, \"The 'perPage' parameter must be 10\");", - " pm.expect(pagination.totalEntries).to.be.gte(2, \"The 'totalEntries' parameter must be at least 2\");", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, + "name": "Get Content Type", + "event": [ { - "key": "password", - "value": "admin", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?host=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" ], - "query": [ - { - "key": "host", - "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d" - } - ] + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." + }, + "response": [] }, - "description": "Returns all the Content Types living in the Default site." - }, - "response": [] - }, - { - "name": "Get Types from System Host", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there are at least 10 Content Types living under the System Host\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(10, \"There MUST be at least 10 Content Types living in System Host -- unless some were added/removed\");", - "});", - "", - "pm.test(\"Checking that there is no Content Type from another Site\", function () {", - " const entity = pm.response.json().entity;", - " const typeFromDefaultSite = entity.find(type => type.host !== 'SYSTEM_HOST');", - " pm.expect(typeFromDefaultSite).equals(undefined, \"There must be no Content Types from sites other than System Host\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(10, \"The 'totalEntries' parameter must be at least 10\");", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Update Content Type with page detail id", + "event": [ { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"{{pageDetailPageId1}}\",\n \"urlMapPattern\" : \"/{name}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ { - "key": "password", - "value": "admin", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=SYSTEM_HOST&per_page=40", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" ], - "query": [ - { - "key": "sites", - "value": "SYSTEM_HOST" + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, - { - "key": "per_page", - "value": "40" - } - ] + "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." + }, + "response": [] }, - "description": "Returns all the Content Types living in the Default site, using the new query string parameter." - }, - "response": [] - }, - { - "name": "Get Types from Default site", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there are at least 2 Content Types living under the Default site\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(2, \"There MUST be at least 2 Content Types living in the Default site\");", - "});", - "", - "pm.test(\"Checking that there is no Content Type from another Site\", function () {", - " const entity = pm.response.json().entity;", - " const typeFromDefaultSite = entity.find(type => type.host !== '8a7d5e23-da1e-420a-b4f0-471e7da8ea2d');", - " pm.expect(typeFromDefaultSite).equals(undefined, \"There must be no Content Types from sites other than Default\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(2, \"The 'totalEntries' parameter must be at least 2\");", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, + "name": "Update Content Type with page detail with URI Again", + "event": [ { - "key": "password", - "value": "admin", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=default&per_page=40", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" ], - "query": [ - { - "key": "sites", - "value": "default" + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL2}}\",\n \"urlMapPattern\" : \"/{name}\"\n}", + "options": { + "raw": { + "language": "json" + } + } }, - { - "key": "per_page", - "value": "40" - } - ] + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." + }, + "response": [] }, - "description": "Returns all the Content Types living in the Default site, using the new query string parameter, and passing down the Site Key." - }, - "response": [] - }, - { - "name": "Get Types from Default Site (ID) and System Host", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there are at least 12 Content Types living under the Default and System Host sites\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(12, \"There MUST be at least 12 Content Types living in the Default and System Host sites -- unless some were added/removed\");", - "});", - "", - "pm.test(\"Checking that there is at least 1 Content Type from the Default Site\", function () {", - " const entity = pm.response.json().entity;", - " const typeFromDefaultSite = entity.find(type => type.host === '8a7d5e23-da1e-420a-b4f0-471e7da8ea2d');", - " pm.expect(typeFromDefaultSite).to.not.equal(undefined, \"There MUST be at least one Content Type from the Default Site\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(12, \"The 'totalEntries' parameter must be at least 12\");", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, + "name": "Get Content Type", + "event": [ { - "key": "password", - "value": "admin", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + "", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", + " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", + " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d,SYSTEM_HOST&per_page=40", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" ], - "query": [ - { - "key": "sites", - "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d,SYSTEM_HOST" + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." + }, + "response": [] + }, + { + "name": "Update Content Type removing page detail", + "event": [ { - "key": "per_page", - "value": "40" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData).not.have.property('detailPage');", + " pm.expect(jsonData).not.have.property('detailPagePath');", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - ] + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"urlMapPattern\" : \"/{name}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." + }, + "response": [] }, - "description": "Returns all the Content Types living in both the Default and System Host sites, using the IDs." - }, - "response": [] - }, - { - "name": "Get Types from Default Site (Site Key) and System Host Copy", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there are at least 12 Content Types living under the Default and System Host sites\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(12, \"There MUST be at least 12 Content Types living in the Default and System Host sites -- unless some were added/removed\");", - "});", - "", - "pm.test(\"Checking that there is at least 1 Content Type from the Default Site\", function () {", - " const entity = pm.response.json().entity;", - " const typeFromDefaultSite = entity.find(type => type.host === '8a7d5e23-da1e-420a-b4f0-471e7da8ea2d');", - " pm.expect(typeFromDefaultSite).to.not.equal(undefined, \"There MUST be at least one Content Type from the Default Site\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(12, \"The 'totalEntries' parameter must be at least 12\");", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Get Content Type", + "event": [ { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check detail page\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData).not.have.property('detailPage');", + " pm.expect(jsonData).not.have.property('detailPagePath');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." + }, + "response": [] + }, + { + "name": "Archive Test Page1", + "event": [ { - "key": "password", - "value": "admin", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"No errors must be present\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=default,SYSTEM_HOST&per_page=40", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" ], - "query": [ - { - "key": "sites", - "value": "default,SYSTEM_HOST" + "request": { + "method": "PUT", + "header": [ + { + "key": "Origin", + "value": "{{serverURL}}" + } + ], + "body": { + "mode": "raw", + "raw": "{}", + "options": { + "raw": { + "language": "json" + } + } }, - { - "key": "per_page", - "value": "40" + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/ARCHIVE?inode={{pageDetailPageInode1}}&identifier={{pageDetailPageId1}}&indexPolicy=WAIT_FOR", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "ARCHIVE" + ], + "query": [ + { + "key": "inode", + "value": "{{pageDetailPageInode1}}" + }, + { + "key": "identifier", + "value": "{{pageDetailPageId1}}" + }, + { + "key": "indexPolicy", + "value": "WAIT_FOR" + } + ] } - ] + }, + "response": [] }, - "description": "Returns all the Content Types living in both the Default and System Host sites, using the Site Key." - }, - "response": [] - }, - { - "name": "Get Types from non-existing Site", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that no Content Types are returned\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).equals(0, \"There must be no Content Types in the results\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).equals(0, \"The 'totalEntries' parameter must be zero\");", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, + "name": "Archive Test Page2", + "event": [ { - "key": "password", - "value": "admin", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"No errors must be present\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=non-existing-site&per_page=40", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype" - ], - "query": [ - { - "key": "sites", - "value": "non-existing-site" + "request": { + "method": "PUT", + "header": [ + { + "key": "Origin", + "value": "{{serverURL}}" + } + ], + "body": { + "mode": "raw", + "raw": "{}", + "options": { + "raw": { + "language": "json" + } + } }, - { - "key": "per_page", - "value": "40" + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/ARCHIVE?inode={{pageDetailPageInode2}}&identifier={{pageDetailPageId2}}&indexPolicy=WAIT_FOR", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "ARCHIVE" + ], + "query": [ + { + "key": "inode", + "value": "{{pageDetailPageInode2}}" + }, + { + "key": "identifier", + "value": "{{pageDetailPageId2}}" + }, + { + "key": "indexPolicy", + "value": "WAIT_FOR" + } + ] } - ] + }, + "response": [] }, - "description": "Returns all the Content Types living in the non-existing site, which must return an empty list." - }, - "response": [] - }, - { - "name": "Get Types from non-existing Site (ID) and System Host", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there are at least 10 Content Types living under the Default and System Host sites\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(10, \"There MUST be at least 10 Content Types living in System Host -- unless some were added/removed\");", - "});", - "", - "pm.test(\"Checking that all Content Types come from System Host only\", function () {", - " const entity = pm.response.json().entity;", - " const typeFromDefaultSite = entity.find(type => type.host === '12312312-abcd-1234-dcba-456456456456');", - " pm.expect(typeFromDefaultSite).equals(undefined, \"All Content Types must come from System Host only\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(10, \"The 'totalEntries' parameter must be at least 10\");", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Delete Test Page1", + "event": [ { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"No errors must be present\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Origin", + "value": "{{serverURL}}" + } + ], + "body": { + "mode": "raw", + "raw": "{}", + "options": { + "raw": { + "language": "json" + } + } }, - { - "key": "password", - "value": "admin", - "type": "string" + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/DELETE?inode={{pageDetailPageInode1}}&identifier={{pageDetailPageId1}}&indexPolicy=WAIT_FOR", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "DELETE" + ], + "query": [ + { + "key": "inode", + "value": "{{pageDetailPageInode1}}" + }, + { + "key": "identifier", + "value": "{{pageDetailPageId1}}" + }, + { + "key": "indexPolicy", + "value": "WAIT_FOR" + } + ] } - ] + }, + "response": [] }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=12312312-abcd-1234-dcba-456456456456,SYSTEM_HOST&per_page=40", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" + { + "name": "Delete Test Page2", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"No errors must be present\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "query": [ - { - "key": "sites", - "value": "12312312-abcd-1234-dcba-456456456456,SYSTEM_HOST" + "request": { + "method": "PUT", + "header": [ + { + "key": "Origin", + "value": "{{serverURL}}" + } + ], + "body": { + "mode": "raw", + "raw": "{}", + "options": { + "raw": { + "language": "json" + } + } }, - { - "key": "per_page", - "value": "40" + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/DELETE?inode={{pageDetailPageInode2}}&identifier={{pageDetailPageId2}}&indexPolicy=WAIT_FOR", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "DELETE" + ], + "query": [ + { + "key": "inode", + "value": "{{pageDetailPageInode2}}" + }, + { + "key": "identifier", + "value": "{{pageDetailPageId2}}" + }, + { + "key": "indexPolicy", + "value": "WAIT_FOR" + } + ] } - ] + }, + "response": [] }, - "description": "Returns all the Content Types living in a non-existing site and System Host, which must return only the types living in System Host." - }, - "response": [] - }, - { - "name": "Get Types from non-existing Site (ID) and Default site", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"HTTP Status code must be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Checking that there are at least 2 Content Types living under the Default site\", function () {", - " const entity = pm.response.json().entity;", - " pm.expect(entity.length).to.be.gte(2, \"There MUST be at least 2 Content Types living in the Default site\");", - "});", - "", - "pm.test(\"Checking that all Content Types come from the Default site only\", function () {", - " const entity = pm.response.json().entity;", - " const typeFromDefaultSite = entity.find(type => type.host === '12312312-abcd-1234-dcba-456456456456');", - " pm.expect(typeFromDefaultSite).equals(undefined, \"All Content Types must come from the Default site only\");", - "});", - "", - "pm.test(\"Checking that pagination information matches the specified parameters\", function () {", - " const pagination = pm.response.json().pagination;", - " pm.expect(pagination.perPage).equals(40, \"The 'perPage' parameter must be 40\");", - " pm.expect(pagination.totalEntries).to.be.gte(2, \"The 'totalEntries' parameter must be at least 2\");", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, + "name": "Delete ContentType", + "event": [ { - "key": "password", - "value": "admin", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Response entity contains 'deleted'\", function () {", + " pm.expect(pm.response.json().entity).to.include(\"deleted\");", + "});", + "", + "pm.test(\"Errors array is empty\", function () {", + " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype?sites=invalid-site,default&per_page=40", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" ], - "query": [ - { - "key": "sites", - "value": "invalid-site,default" + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, - { - "key": "per_page", - "value": "40" - } - ] + "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." + }, + "response": [] }, - "description": "Returns all the Content Types living in a non-existing site and the Defaut site, which must return only the types living in the Default site." - }, - "response": [] - } - ], - "description": "These requests allow you to verify that dotCMS can retrieve a filtered paginated list of Content Types from a specific list of Sites only, and not from the whole repository. You can use both the Site's Identifier, or its Key -- aka, Site Name.\n\nThis suite is testing both the existing per-Site Endpoint -- flagged with **`(Legacy)`** -- and the new multi-site parameter." - }, - { - "name": "Test detail page", - "item": [ - { - "name": "Test update detail page with id and URI", - "item": [ { - "name": "Create Test Site", + "name": "Archive Site", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Storing page data for subsequent tests\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"pageDetailSiteId\", jsonData.entity.identifier);", - " pm.collectionVariables.set(\"pageDetailSiteName\", jsonData.entity.siteName);", + "pm.test(\"Entity archived property is true\", function () {", + " var siteId= pm.collectionVariables.get(\"pageDetailSiteId\")", + " pm.expect(pm.response.json().entity.identifier).contains(siteId);", + " pm.expect(pm.response.json().entity.archived).to.be.true;", + "});", + "", + "pm.test(\"Errors array is empty\", function () {", + " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", "});", "" ], @@ -4717,44 +6689,101 @@ } ], "request": { - "method": "POST", + "method": "PUT", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"siteName\":\"page.detail.host.com.{{$timestamp}}\",\n \"variables\":[]\n}\n", - "options": { - "raw": { - "language": "json" - } + "url": { + "raw": "{{serverURL}}/api/v1/site/{{pageDetailSiteId}}/_archive", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "site", + "{{pageDetailSiteId}}", + "_archive" + ] + } + }, + "response": [] + }, + { + "name": "Delete Site", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Errors array is empty\", function () {", + " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} } - }, + } + ], + "request": { + "method": "DELETE", + "header": [], "url": { - "raw": "{{serverURL}}/api/v1/site", + "raw": "{{serverURL}}/api/v1/site/{{pageDetailSiteId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "site" + "site", + "{{pageDetailSiteId}}" ] } }, "response": [] + } + ], + "description": "The `detailPage` attribute supports id and URI for updates, these tests validate both cases are working as expected.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } }, { - "name": "Create test Page1", + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] + }, + { + "name": "Test create content type with detailPage as URI", + "item": [ + { + "name": "Create Test Site", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Storing page id and path for subsequent tests\", function () {", + "pm.test(\"Storing page data for subsequent tests\", function () {", " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"pageDetailPageId1\", jsonData.entity.identifier);", - " pm.collectionVariables.set(\"pageDetailPageInode1\", jsonData.entity.inode);", - " pm.collectionVariables.set(\"pageDetailPageURL1\", jsonData.entity.url);", - "});" + " pm.collectionVariables.set(\"pageDetailSiteId\", jsonData.entity.identifier);", + " pm.collectionVariables.set(\"pageDetailSiteName\", jsonData.entity.siteName);", + "});", + "" ], "type": "text/javascript", "packages": {} @@ -4762,11 +6791,11 @@ } ], "request": { - "method": "PUT", + "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"contentlet\":{\n\t\t\"stName\": \"htmlpageasset\",\n\t\t\"title\": \"Page1 {{$timestamp}}\",\n \"url\": \"page1-{{$timestamp}}\",\n \"friendlyName\":\"page1-{{$timestamp}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"100\",\n \"hostFolder\":\"{{pageDetailSiteId}}\"\n\t}\n}", + "raw": "{\n \"siteName\":\"page.detail.host.com.{{$timestamp}}\",\n \"variables\":[]\n}\n", "options": { "raw": { "language": "json" @@ -4774,25 +6803,21 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "raw": "{{serverURL}}/api/v1/site", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "workflow", - "actions", - "default", - "fire", - "PUBLISH" + "site" ] } }, "response": [] }, { - "name": "Create test Page2", + "name": "Create test Page", "event": [ { "listen": "test", @@ -4800,9 +6825,9 @@ "exec": [ "pm.test(\"Storing page id and path for subsequent tests\", function () {", " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"pageDetailPageId2\", jsonData.entity.identifier);", - " pm.collectionVariables.set(\"pageDetailPageInode2\", jsonData.entity.inode);", - " pm.collectionVariables.set(\"pageDetailPageURL2\", jsonData.entity.url);", + " pm.collectionVariables.set(\"pageDetailPageId1\", jsonData.entity.identifier);", + " pm.collectionVariables.set(\"pageDetailPageInode1\", jsonData.entity.inode);", + " pm.collectionVariables.set(\"pageDetailPageURL1\", jsonData.entity.url);", "});" ], "type": "text/javascript", @@ -4815,7 +6840,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"contentlet\":{\n\t\t\"stName\": \"htmlpageasset\",\n\t\t\"title\": \"Pag2 {{$timestamp}}\",\n \"url\": \"page2-{{$timestamp}}\",\n \"friendlyName\":\"page2-{{$timestamp}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"100\",\n \"hostFolder\":\"{{pageDetailSiteId}}\"\n\t}\n}", + "raw": "{\n\t\"contentlet\":{\n\t\t\"stName\": \"htmlpageasset\",\n\t\t\"title\": \"Page1 {{$timestamp}}\",\n \"url\": \"page1-{{$timestamp}}\",\n \"friendlyName\":\"page1-{{$timestamp}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"100\",\n \"hostFolder\":\"{{pageDetailSiteId}}\"\n\t}\n}", "options": { "raw": { "language": "json" @@ -4841,7 +6866,7 @@ "response": [] }, { - "name": "Create ContentType with page detail id", + "name": "Create ContentType with page detail as URI", "event": [ { "listen": "test", @@ -4889,7 +6914,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"{{pageDetailPageId1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, "url": { "raw": "{{serverURL}}/api/v1/contenttype", @@ -4907,119 +6932,31 @@ "response": [] }, { - "name": "Get Content Type", + "name": "Try to create a page detail with non existing URI", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." - }, - "response": [] - }, - { - "name": "Update Content Type with page detail with URI", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", + "pm.test(\"Correct response message\", function () {", + " pm.expect(pm.response.json().message).to.include('Missing required information when creating Content Type(s):');", + "});", "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});" + "pm.collectionVariables.set(\"skipPreResquest\", false); " ], "type": "text/javascript", "packages": {} } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL2}}\",\n \"urlMapPattern\" : \"/{name}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ { - "listen": "test", + "listen": "prerequest", "script": { "exec": [ - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});", - "" + "pm.collectionVariables.set(\"skipPreResquest\", true); " ], "type": "text/javascript", "packages": {} @@ -5027,138 +6964,74 @@ } ], "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." - }, - "response": [] - }, - { - "name": "Update Content Type with page detail id", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});" - ], - "type": "text/javascript", - "packages": {} + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" } - } - ], - "request": { - "method": "PUT", - "header": [], + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"{{pageDetailPageId1}}\",\n \"urlMapPattern\" : \"/{name}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}11{{pageDetailPageURL1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "contenttype" ] }, - "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." }, "response": [] }, { - "name": "Update Content Type with page detail with URI Again", + "name": "Try to create ContentType with page detail as URI without credentials", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Check detail page\", function () {", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", + "pm.test(\"Response content type is text/plain\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"text/plain\");", + "});", "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});" + "pm.test(\"Check if the response is invalid\", function () {", + " pm.expect(pm.response.text()).to.include(\"Invalid User\");", + "});", + "", + "", + "pm.collectionVariables.set(\"skipPreResquest\", false);" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({", + " url: pm.environment.get(\"serverURL\") + \"/api/v1/logout\",", + " method: 'GET'", + "}, function (err, res) {", + " if (err) {", + " console.log('Logout failed:', err);", + " } else {", + " console.log('Logout successful, cookies should be cleared.');", + " }", + "});", + "", + "pm.collectionVariables.set(\"skipPreResquest\", true);" ], "type": "text/javascript", "packages": {} @@ -5166,31 +7039,32 @@ } ], "request": { - "method": "PUT", - "header": [], + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL2}}\",\n \"urlMapPattern\" : \"/{name}\"\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "contenttype" ] }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." + "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." }, "response": [] }, @@ -5203,9 +7077,9 @@ "exec": [ "pm.test(\"Check detail page\", function () {", "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId2\");", + " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL2\");", + " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", "", " var jsonData = pm.response.json();", " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", @@ -5325,7 +7199,7 @@ "response": [] }, { - "name": "Archive Test Page1", + "name": "Archive Test Page", "event": [ { "listen": "test", @@ -5391,73 +7265,7 @@ "response": [] }, { - "name": "Archive Test Page2", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"No errors must be present\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Origin", - "value": "{{serverURL}}" - } - ], - "body": { - "mode": "raw", - "raw": "{}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/ARCHIVE?inode={{pageDetailPageInode2}}&identifier={{pageDetailPageId2}}&indexPolicy=WAIT_FOR", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "ARCHIVE" - ], - "query": [ - { - "key": "inode", - "value": "{{pageDetailPageInode2}}" - }, - { - "key": "identifier", - "value": "{{pageDetailPageId2}}" - }, - { - "key": "indexPolicy", - "value": "WAIT_FOR" - } - ] - } - }, - "response": [] - }, - { - "name": "Delete Test Page1", + "name": "Delete Test Page", "event": [ { "listen": "test", @@ -5522,72 +7330,6 @@ }, "response": [] }, - { - "name": "Delete Test Page2", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"No errors must be present\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Origin", - "value": "{{serverURL}}" - } - ], - "body": { - "mode": "raw", - "raw": "{}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/DELETE?inode={{pageDetailPageInode2}}&identifier={{pageDetailPageId2}}&indexPolicy=WAIT_FOR", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "DELETE" - ], - "query": [ - { - "key": "inode", - "value": "{{pageDetailPageInode2}}" - }, - { - "key": "identifier", - "value": "{{pageDetailPageId2}}" - }, - { - "key": "indexPolicy", - "value": "WAIT_FOR" - } - ] - } - }, - "response": [] - }, { "name": "Delete ContentType", "event": [ @@ -5595,13 +7337,7 @@ "listen": "test", "script": { "exec": [ - "pm.test(\"Response entity contains 'deleted'\", function () {", - " pm.expect(pm.response.json().entity).to.include(\"deleted\");", - "});", - "", - "pm.test(\"Errors array is empty\", function () {", - " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", - "});" + "" ], "type": "text/javascript", "packages": {} @@ -5723,753 +7459,1293 @@ "type": "text/javascript", "packages": {}, "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" + "skipPreResquest = pm.collectionVariables.get(\"skipPreResquest\");", + "", + "if (!skipPreResquest){", + " pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + " });", + "}" ] } } ] + } + ], + "description": "when specifying a detail page for a url mapped page, a user should be able to specify a path and not rely on an id, e.g. //demo.dotcms.com/blogs/detail-page", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } }, { - "name": "Test create content type with detailPage as URI", + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Test don't relying on id", + "item": [ + { + "name": "Content Type", "item": [ { - "name": "Create Test Site", - "event": [ + "name": "Creation without id", + "item": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Storing page data for subsequent tests\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"pageDetailSiteId\", jsonData.entity.identifier);", - " pm.collectionVariables.set(\"pageDetailSiteName\", jsonData.entity.siteName);", - "});", - "" + "name": "Create ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"siteName\":\"page.detail.host.com.{{$timestamp}}\",\n \"variables\":[]\n}\n", - "options": { - "raw": { - "language": "json" + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Creates a content type without a content type id in the body." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Searched for a content type by id validating the content type was created." + }, + "response": [] }, - "url": { - "raw": "{{serverURL}}/api/v1/site", - "host": [ - "{{serverURL}}" + { + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "site" - ] + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Cleanup" + }, + "response": [] } - }, - "response": [] + ], + "description": "This test tries to create a content type without provide a content type id in the body, this is the most common escenario creating a content type." }, { - "name": "Create test Page", - "event": [ + "name": "Creation with non existing id", + "item": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Storing page id and path for subsequent tests\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"pageDetailPageId1\", jsonData.entity.identifier);", - " pm.collectionVariables.set(\"pageDetailPageInode1\", jsonData.entity.inode);", - " pm.collectionVariables.set(\"pageDetailPageURL1\", jsonData.entity.url);", - "});" + "name": "Create ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"contentlet\":{\n\t\t\"stName\": \"htmlpageasset\",\n\t\t\"title\": \"Page1 {{$timestamp}}\",\n \"url\": \"page1-{{$timestamp}}\",\n \"friendlyName\":\"page1-{{$timestamp}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"100\",\n \"hostFolder\":\"{{pageDetailSiteId}}\"\n\t}\n}", - "options": { - "raw": { - "language": "json" + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"123ec8e74bc0fd62172507{{$timestamp}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Creates a content type using in the body a non existing content type id." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Searched for a content type by id validating the content type was created." + }, + "response": [] }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", - "host": [ - "{{serverURL}}" + { + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "PUBLISH" - ] + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Cleanup" + }, + "response": [] } - }, - "response": [] + ], + "description": "This test creates a content type with a not existing id in the body" }, { - "name": "Create ContentType with page detail as URI", - "event": [ + "name": "Multiple update permutations", + "item": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Storing content type id\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity[0].detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity[0].detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});" + "name": "Create ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[2].id);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } ], - "type": "text/javascript", - "packages": {} - } + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Simple content type creation to set up the test data." + }, + "response": [] }, { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Searched for a content type by id validating the content type was created." + }, + "response": [] + }, + { + "name": "Update Content Type without id in body and variable in body but existing id in path param", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type without an id and variable in the body but with a valid content type id as path param." + }, + "response": [] }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" + { + "name": "Update Content Type without id in body and variable in body but existing variable in path param", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeVariable}}" + ] + }, + "description": "Updates a content type without an id and variable in the body but with a valid content type id as path param." + }, + "response": [] }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." - }, - "response": [] - }, - { - "name": "Try to create a page detail with non existing URI", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});", - "", - "pm.test(\"Correct response message\", function () {", - " pm.expect(pm.response.json().message).to.include('Missing required information when creating Content Type(s):');", - "});", - "", - "pm.collectionVariables.set(\"skipPreResquest\", false); " - ], - "type": "text/javascript", - "packages": {} - } + "name": "Update Content Type without id in body and variable in body and non existing id in path param", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 404 Not found\", function () {", + " pm.response.to.have.status(404);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "does-not-exist" + ] + }, + "description": "Updates a content type without an id and variable in the body and without a valid content type id as path param." + }, + "response": [] }, { - "listen": "prerequest", - "script": { - "exec": [ - "pm.collectionVariables.set(\"skipPreResquest\", true); " - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}11{{pageDetailPageURL1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + "name": "Update Content Type with existing ids", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type with valid ids and variable name." + }, + "response": [] }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" + { + "name": "Update Content Type with existing id and variable in body but non existing id in path param", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "does-not-exist" + ] + }, + "description": "Updates a content type resolving the content type using the data in the body as the path param id does not exist." + }, + "response": [] }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." - }, - "response": [] - }, - { - "name": "Try to create ContentType with page detail as URI without credentials", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response content type is text/plain\", function () {", - " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"text/plain\");", - "});", - "", - "pm.test(\"Check if the response is invalid\", function () {", - " pm.expect(pm.response.text()).to.include(\"Invalid User\");", - "});", - "", - "", - "pm.collectionVariables.set(\"skipPreResquest\", false);" - ], - "type": "text/javascript", - "packages": {} - } + "name": "Update Content Type with no existing id in body and not existing id in path param", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"does-not-exist\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "does-not-exist" + ] + }, + "description": "Updates a content type resolving the content type using the id and variable in the body as the path param id does not exist. \nIn this test the id does not exist but the variable does." + }, + "response": [] }, { - "listen": "prerequest", - "script": { - "exec": [ - "pm.sendRequest({", - " url: pm.environment.get(\"serverURL\") + \"/api/v1/logout\",", - " method: 'GET'", - "}, function (err, res) {", - " if (err) {", - " console.log('Logout failed:', err);", - " } else {", - " console.log('Logout successful, cookies should be cleared.');", - " }", - "});", - "", - "pm.collectionVariables.set(\"skipPreResquest\", true);" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"detailPage\": \"//{{pageDetailSiteName}}{{pageDetailPageURL1}}\",\n \"urlMapPattern\" : \"/{name}\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" + "name": "Update Content Type without id in body and not existing id in path param", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "does-not-exist" + ] + }, + "description": "Updates a content type resolving the content type using variable in the body as the path param id does not exist. \nIn this test the id in the body is not set, so the variable should be used." + }, + "response": [] }, - "description": "Given a content type payload containing field variables.\nWhen sending a POST.\nExpect that code is 200.\nExpect content type is created with the provided fields.\nExpect that new properties of content types are set (icon and sortOrder)." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - "", - " var pageId = pm.collectionVariables.get(\"pageDetailPageId1\");", - " var siteName = pm.collectionVariables.get(\"pageDetailSiteName\");", - " var pageURL = pm.collectionVariables.get(\"pageDetailPageURL1\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.detailPage).to.eql(pageId);", - " pm.expect(jsonData.entity.detailPagePath).to.eql(\"//\"+siteName+pageURL);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" + "name": "Update Content Type with not existing variable", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", + " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"doesnotexist\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "does-not-exist" + ] + }, + "description": "Updates a content type resolving the content type using the id and variable in the body as the path param id does not exist. \nIn this test the variable in the body does not exist." + }, + "response": [] }, - "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." - }, - "response": [] - }, - { - "name": "Update Content Type removing page detail", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData).not.have.property('detailPage');", - " pm.expect(jsonData).not.have.property('detailPagePath');", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"sortOrder\": 3,\n \"urlMapPattern\" : \"/{name}\"\n}", - "options": { - "raw": { - "language": "json" + "name": "Update Content Type with not existing id and variable and path param", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 404\", function () {", + " pm.response.to.have.status(404);", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"does-not-exist\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"doesnotexist\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "does-not-exist" + ] + }, + "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." + }, + "response": [] }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Check detail page\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData).not.have.property('detailPage');", - " pm.expect(jsonData).not.have.property('detailPagePath');", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Cleanup" + }, + "response": [] } ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Given a content type ID. \nExpect that code is 200.\nExpect that the new content type properties (icon and sortOrder) are returned." - }, - "response": [] - }, + "description": "On this set of tests we are going to test multiple updates permutations." + } + ], + "description": "In this folder we test different scenarios for handling the Content Type where we validate cases in order to not always rely on the Content Type ID." + }, + { + "name": "Fields", + "item": [ { - "name": "Archive Test Page", - "event": [ + "name": "Creation without id", + "item": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"No errors must be present\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Origin", - "value": "{{serverURL}}" - } - ], - "body": { - "mode": "raw", - "raw": "{}", - "options": { - "raw": { - "language": "json" + "name": "Create ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/ARCHIVE?inode={{pageDetailPageInode1}}&identifier={{pageDetailPageId1}}&indexPolicy=WAIT_FOR", - "host": [ - "{{serverURL}}" ], - "path": [ - "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "ARCHIVE" - ], - "query": [ - { - "key": "inode", - "value": "{{pageDetailPageInode1}}" + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] }, + "description": "Creates a content type and field without a field id or content type id in the field." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ { - "key": "identifier", - "value": "{{pageDetailPageId1}}" + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Validates the content type and field were created as expected." + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ { - "key": "indexPolicy", - "value": "WAIT_FOR" + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - ] + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Cleanup." + }, + "response": [] } - }, - "response": [] + ], + "description": "This test tries to create a content type and field without provide a field ID in the body, this is the most common escenario creating a content type." }, { - "name": "Delete Test Page", - "event": [ + "name": "Creation with non existing id", + "item": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"No errors must be present\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.errors.length).to.eql(0);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Origin", - "value": "{{serverURL}}" - } - ], - "body": { - "mode": "raw", - "raw": "{}", - "options": { - "raw": { - "language": "json" + "name": "Create ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[2].id);", + " pm.collectionVariables.set(\"contentTypeField1Variable\", jsonData.entity[0].fields[2].variable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/DELETE?inode={{pageDetailPageInode1}}&identifier={{pageDetailPageId1}}&indexPolicy=WAIT_FOR", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "DELETE" ], - "query": [ - { - "key": "inode", - "value": "{{pageDetailPageInode1}}" + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"123ec8e74bc0fd62172507{{$timestamp}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, - { - "key": "identifier", - "value": "{{pageDetailPageId1}}" + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] }, - { - "key": "indexPolicy", - "value": "WAIT_FOR" - } - ] - } - }, - "response": [] - }, - { - "name": "Delete ContentType", - "event": [ + "description": "Creates a field using a non existing field id." + }, + "response": [] + }, { - "listen": "test", - "script": { - "exec": [ - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Validates the content type and field were created as expected." + }, + "response": [] }, - "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." - }, - "response": [] - }, - { - "name": "Archive Site", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Entity archived property is true\", function () {", - " var siteId= pm.collectionVariables.get(\"pageDetailSiteId\")", - " pm.expect(pm.response.json().entity.identifier).contains(siteId);", - " pm.expect(pm.response.json().entity.archived).to.be.true;", - "});", - "", - "pm.test(\"Errors array is empty\", function () {", - " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "PUT", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/site/{{pageDetailSiteId}}/_archive", - "host": [ - "{{serverURL}}" + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } ], - "path": [ - "api", - "v1", - "site", - "{{pageDetailSiteId}}", - "_archive" - ] - } - }, - "response": [] - }, - { - "name": "Delete Site", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Errors array is empty\", function () {", - " pm.expect(pm.response.json().errors).to.be.an('array').that.is.empty;", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Cleanup" + }, + "response": [] } ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/site/{{pageDetailSiteId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "site", - "{{pageDetailSiteId}}" - ] - } - }, - "response": [] - } - ], - "description": "The `detailPage` attribute supports id and URI for updates, these tests validate both cases are working as expected.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } + "description": "This test creates the Content Type with a field with a not existing field id in the body." }, { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "skipPreResquest = pm.collectionVariables.get(\"skipPreResquest\");", - "", - "if (!skipPreResquest){", - " pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - " });", - "}" - ] - } - } - ] - } - ], - "description": "when specifying a detail page for a url mapped page, a user should be able to specify a path and not rely on an id, e.g. //demo.dotcms.com/blogs/detail-page", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Test don't relying on id", - "item": [ - { - "name": "Content Type", - "item": [ - { - "name": "Creation without id", + "name": "Multiple update permutations", "item": [ { - "name": "Create ContentType", + "name": "Create ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[2].id);", + " pm.collectionVariables.set(\"contentTypeField1Variable\", jsonData.entity[0].fields[2].variable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Simple creation to sep up the data for the update tests." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Validates the content type and field were created as expected." + }, + "response": [] + }, + { + "name": "Update field with no variable name", "event": [ { "listen": "test", @@ -6479,10 +8755,14 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing content type id\", function () {", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + "", " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -6491,43 +8771,110 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeId}}" ] }, - "description": "Creates a content type without a content type id in the body." + "description": "Updates the field with no variable name." }, "response": [] }, { - "name": "Get Content Type", + "name": "Update field with no content type id", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", + " pm.expect(jsonData.entity.fields[2].contentTypeId).to.eql(contentTypeId);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates the fields with no content type id in the fields." + }, + "response": [] + }, + { + "name": "Update field with content type id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -6536,8 +8883,17 @@ } ], "request": { - "method": "GET", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -6551,12 +8907,12 @@ "{{contentTypeId}}" ] }, - "description": "Searched for a content type by id validating the content type was created." + "description": "Updates the fields with the content type id in the fields." }, "response": [] }, { - "name": "Delete ContentType", + "name": "Update field with existing id", "event": [ { "listen": "test", @@ -6564,6 +8920,16 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -6572,8 +8938,17 @@ } ], "request": { - "method": "DELETE", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -6587,18 +8962,12 @@ "{{contentTypeId}}" ] }, - "description": "Cleanup" + "description": "Updates a field using an existing field id." }, "response": [] - } - ], - "description": "This test tries to create a content type without provide a content type id in the body, this is the most common escenario creating a content type." - }, - { - "name": "Creation with non existing id", - "item": [ + }, { - "name": "Create ContentType", + "name": "Update field with no existing id", "event": [ { "listen": "test", @@ -6608,10 +8977,14 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing content type id\", function () {", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + "", " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -6620,41 +8993,96 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"does-not-exist\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } } - ], + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeVariable}}" + ] + }, + "description": "Updates the field with a non existing field id but existing field variable name." + }, + "response": [] + }, + { + "name": "Update field without id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Check response\", function () {", + "", + " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", + " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + "", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.fields[2].id).to.eql(contentTypeField1Id);", + " pm.expect(jsonData.entity.fields[2].variable).to.eql(contentTypeField1Variable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"123ec8e74bc0fd62172507{{$timestamp}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeVariable}}" ] }, - "description": "Creates a content type using in the body a non existing content type id." + "description": "Updates a field without a field id in the body but with a valid variable name." }, "response": [] }, { - "name": "Get Content Type", + "name": "Update field without id and variable", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", - "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", "});" @@ -6665,10 +9093,19 @@ } ], "request": { - "method": "GET", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", "host": [ "{{serverURL}}" ], @@ -6677,10 +9114,10 @@ "v1", "contenttype", "id", - "{{contentTypeId}}" + "{{contentTypeVariable}}" ] }, - "description": "Searched for a content type by id validating the content type was created." + "description": "Updates a content type with a field without a field id and field variable in the body, as there is not data to use to identify the field, a new field will be created." }, "response": [] }, @@ -6720,29 +9157,63 @@ }, "response": [] } - ], - "description": "This test creates a content type with a not existing id in the body" - }, + ] + } + ], + "description": "In this folder we test different scenarios for handling the Content Type fields where we validate cases in order to not always rely on the Content Type field ID." + } + ], + "description": "When saving content type and fields, we don't need to rely entirely on ids, if the id does not exist or is not provided, we should use variables as the key.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Test Workflows", + "item": [ + { + "name": "Simple workflows array", + "item": [ { - "name": "Multiple update permutations", + "name": "Creation", "item": [ { - "name": "Create ContentType", + "name": "Create Scheme", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", + "pm.test(\"Status code is 200 \", function () {", " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing content type id\", function () {", + "pm.test(\"Storing workflow data\", function () {", " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - " pm.collectionVariables.set(\"fields\", JSON.stringify(jsonData.entity[0].fields));", - "});" + " pm.collectionVariables.set(\"schemeId\", jsonData.entity.id);", + " pm.collectionVariables.set(\"schemeName\", jsonData.entity.name);", + " pm.collectionVariables.set(\"schemeVariableName\", jsonData.entity.variableName);", + "});", + "" ], "type": "text/javascript", "packages": {} @@ -6750,16 +9221,6 @@ } ], "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, "method": "POST", "header": [ { @@ -6769,34 +9230,48 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + "raw": "{\"schemeName\": \"Test Schema {{$timestamp}}\", \"schemeDescription\": \"Test sechema\", \"schemeArchived\": \"false\"}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/workflow/schemes", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "workflow", + "schemes" ] }, - "description": "Simple content type creation to set up the test data." + "description": "Creates a new test scheme" }, "response": [] }, { - "name": "Get Content Type", + "name": "Create ContentType with workflow id", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", - "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -6805,54 +9280,52 @@ } ], "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, - "method": "GET", - "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "contenttype" ] }, - "description": "Searched for a content type by id validating the content type was created." + "description": "Creates a content type using a workflow id." }, "response": [] }, { - "name": "Update Content Type without id in body and variable in body but existing id in path param", + "name": "Get Content Type", "event": [ { "listen": "test", "script": { "exec": [ + "var jsonData = pm.response.json();", + "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", - "", + "pm.test(\"Validate response\", function () {", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", + " ", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -6861,27 +9334,8 @@ } ], "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "PUT", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": {{fields}}\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -6894,13 +9348,12 @@ "id", "{{contentTypeId}}" ] - }, - "description": "Updates a content type without an id and variable in the body but with a valid content type id as path param." + } }, "response": [] }, { - "name": "Update Content Type without id in body and variable in body but existing variable in path param", + "name": "Delete ContentType", "event": [ { "listen": "test", @@ -6908,16 +9361,6 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", "});" ], "type": "text/javascript", @@ -6926,29 +9369,10 @@ } ], "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "PUT", + "method": "DELETE", "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": {{fields}}\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], @@ -6957,22 +9381,36 @@ "v1", "contenttype", "id", - "{{contentTypeVariable}}" + "{{contentTypeId}}" ] - }, - "description": "Updates a content type without an id and variable in the body but with a valid content type id as path param." + } }, "response": [] }, { - "name": "Update Content Type without id in body and variable in body and non existing id in path param", + "name": "Create ContentType with workflow variable name", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 404 Not found\", function () {", - " pm.response.to.have.status(404);", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -6981,46 +9419,34 @@ } ], "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": {{fields}}\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\"]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "does-not-exist" + "contenttype" ] }, - "description": "Updates a content type without an id and variable in the body and without a valid content type id as path param." + "description": "Creates a content type using a workflow variable name." }, "response": [] }, { - "name": "Update Content Type with existing ids", + "name": "Delete ContentType", "event": [ { "listen": "test", @@ -7028,16 +9454,6 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", "});" ], "type": "text/javascript", @@ -7046,27 +9462,8 @@ } ], "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "PUT", + "method": "DELETE", "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": {{fields}}\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -7079,13 +9476,12 @@ "id", "{{contentTypeId}}" ] - }, - "description": "Updates a content type with valid ids and variable name." + } }, "response": [] }, { - "name": "Update Content Type with existing id and variable in body but non existing id in path param", + "name": "Create ContentType with workflow variable name and id", "event": [ { "listen": "test", @@ -7095,15 +9491,34 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Check response\", function () {", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", + "pm.test(\"Validate response\", function () {", + "", + " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", + " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", "", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", - "});" + " ", + " var workflows = jsonData.entity[0].workflows;", + " workflows = workflows.sort(compareBy);", + " pm.expect(2).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + " pm.expect(workflows[1].id).to.eql(testSchemeId);", + " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", + "});", + "", + "function compareBy(a, b) {", + " if (a.variableName < b.variableName) { return -1; }", + " if (a.variableName > b.variableName) { return 1; }", + " return 0;", + "}", + "" ], "type": "text/javascript", "packages": {} @@ -7111,46 +9526,34 @@ } ], "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": {{fields}}\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"{{schemeId}}\",\"systemworkflow\"]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "does-not-exist" + "contenttype" ] }, - "description": "Updates a content type resolving the content type using the data in the body as the path param id does not exist." + "description": "Creates a content type using a workflow id and a workflow variable name." }, "response": [] }, { - "name": "Update Content Type with no existing id in body and not existing id in path param", + "name": "Delete ContentType", "event": [ { "listen": "test", @@ -7158,16 +9561,6 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", "});" ], "type": "text/javascript", @@ -7176,29 +9569,10 @@ } ], "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "PUT", + "method": "DELETE", "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"does-not-exist\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": {{fields}}\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], @@ -7207,33 +9581,23 @@ "v1", "contenttype", "id", - "does-not-exist" + "{{contentTypeId}}" ] - }, - "description": "Updates a content type resolving the content type using the id and variable in the body as the path param id does not exist. \nIn this test the id does not exist but the variable does." + } }, "response": [] }, { - "name": "Update Content Type without id in body and not existing id in path param", + "name": "Create ContentType with wrong workflow #1", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", - "});" + "" ], "type": "text/javascript", "packages": {} @@ -7241,64 +9605,43 @@ } ], "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": {{fields}}\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"doesNotExist\",\"systemworkflow\"]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "does-not-exist" + "contenttype" ] }, - "description": "Updates a content type resolving the content type using variable in the body as the path param id does not exist. \nIn this test the id in the body is not set, so the variable should be used." + "description": "Validates the proper error handling when a wrong workflow is used." }, "response": [] }, { - "name": "Update Content Type with not existing variable", + "name": "Create ContentType with wrong workflow #2", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeVariable = pm.collectionVariables.get(\"contentTypeVariable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.id).to.eql(contentTypeId);", - " pm.expect(jsonData.entity.variable).to.eql(contentTypeVariable);", - "});" + "" ], "type": "text/javascript", "packages": {} @@ -7306,53 +9649,41 @@ } ], "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"doesnotexist\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": {{fields}}\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"doesNotExist\"]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "does-not-exist" + "contenttype" ] }, - "description": "Updates a content type resolving the content type using the id and variable in the body as the path param id does not exist. \nIn this test the variable in the body does not exist." + "description": "Validates the proper error handling when a wrong workflow is used." }, "response": [] }, { - "name": "Update Content Type with not existing id and variable and path param", + "name": "Archive Scheme", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 404\", function () {", - " pm.response.to.have.status(404);", + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", "});" ], "type": "text/javascript", @@ -7362,51 +9693,65 @@ ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { - "key": "token", - "value": "{{jwt}}", + "key": "username", + "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, "method": "PUT", - "header": [], + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"does-not-exist\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"doesnotexist\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\"schemeName\": \"{{schemeName}}\", \"schemeArchived\": \"true\"}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/does-not-exist", + "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "does-not-exist" + "workflow", + "schemes", + "{{schemeId}}" ] }, - "description": "Given a content type ID and a payload containing content type properties.\nExpect that code is 200.\nExpect content type is updated without issues.\nExpect that the new properties (icon and sortOrder) are updated with the new values." + "description": "\n### Update Workflow Scheme\n\nUpdates an existing workflow scheme.\n\n#### Request Body\n- `schemeName` (string, optional): The name of the scheme.\n- `schemeArchived` (boolean, optional): Indicates if the scheme is archived.\n\n#### Response\nThe response for this request is documented as a JSON schema.\n" }, "response": [] }, { - "name": "Delete ContentType", + "name": "Delete Scheme", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", + "pm.test(\"Status code is 200 \", function () {", " pm.response.to.have.status(200);", "});" ], @@ -7417,54 +9762,49 @@ ], "request": { "auth": { - "type": "bearer", - "bearer": [ + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, { - "key": "token", - "value": "{{jwt}}", + "key": "username", + "value": "admin@dotcms.com", "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" } ] }, "method": "DELETE", "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "workflow", + "schemes", + "{{schemeId}}" ] - }, - "description": "Cleanup" - }, - "response": [] - }, - { - "name": "New Request", - "request": { - "method": "GET", - "header": [] + } }, "response": [] } ], - "description": "On this set of tests we are going to test multiple updates permutations.", - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{jwt}}", - "type": "string" - } - ] - }, + "description": "Covering different save scenarios for saving workflows in a content type.", "event": [ { "listen": "prerequest", @@ -7472,46 +9812,6 @@ "type": "text/javascript", "packages": {}, "exec": [ - "if (!pm.environment.get('jwt')) {", - " console.log(\"generating....\")", - " const serverURL = pm.environment.get('serverURL'); // Get the server URL from the environment variable", - " const apiUrl = `${serverURL}/api/v1/apitoken`; // Construct the full API URL", - "", - " if (!pm.environment.get('jwt')) {", - " const username = pm.environment.get(\"user\");", - " const password = pm.environment.get(\"password\");", - " const basicAuth = Buffer.from(`${username}:${password}`).toString('base64');", - "", - " const requestOptions = {", - " url: apiUrl,", - " method: \"POST\",", - " header: {", - " \"accept\": \"*/*\",", - " \"content-type\": \"application/json\",", - " \"Authorization\": `Basic ${basicAuth}`", - " },", - " body: {", - " mode: \"raw\",", - " raw: JSON.stringify({", - " \"expirationSeconds\": 7200,", - " \"userId\": \"dotcms.org.1\",", - " \"network\": \"0.0.0.0/0\",", - " \"claims\": {\"label\": \"postman-tests\"}", - " })", - " }", - " };", - "", - " pm.sendRequest(requestOptions, function (err, response) {", - " if (err) {", - " console.log(err);", - " } else {", - " const jwt = response.json().entity.jwt;", - " pm.environment.set('jwt', jwt);", - " console.log(jwt);", - " }", - " });", - " }", - "}", "" ] } @@ -7527,32 +9827,28 @@ } } ] - } - ], - "description": "In this folder we test different scenarios for handling the Content Type where we validate cases in order to not always rely on the Content Type ID." - }, - { - "name": "Fields", - "item": [ + }, { - "name": "Creation without id", + "name": "Update", "item": [ { - "name": "Create ContentType", + "name": "Create Scheme", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", + "pm.test(\"Status code is 200 \", function () {", " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing content type id\", function () {", + "pm.test(\"Storing workflow data\", function () {", " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});" + " pm.collectionVariables.set(\"schemeId\", jsonData.entity.id);", + " pm.collectionVariables.set(\"schemeName\", jsonData.entity.name);", + " pm.collectionVariables.set(\"schemeVariableName\", jsonData.entity.variableName);", + "});", + "" ], "type": "text/javascript", "packages": {} @@ -7569,103 +9865,24 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] + "raw": "{\"schemeName\": \"Test Schema {{$timestamp}}\", \"schemeDescription\": \"Test sechema\", \"schemeArchived\": \"false\"}" }, - "description": "Creates a content type and field without a field id or content type id in the field." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/workflow/schemes", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "workflow", + "schemes" ] }, - "description": "Validates the content type and field were created as expected." + "description": "Creates a test scheme" }, "response": [] }, - { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Cleanup." - }, - "response": [] - } - ], - "description": "This test tries to create a content type and field without provide a field ID in the body, this is the most common escenario creating a content type." - }, - { - "name": "Creation with non existing id", - "item": [ { "name": "Create ContentType", "event": [ @@ -7677,13 +9894,20 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing content type id\", function () {", + "pm.test(\"Storing content type data\", function () {", " var jsonData = pm.response.json();", " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[2].id);", + "});", "", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", - " pm.collectionVariables.set(\"contentTypeField1Variable\", jsonData.entity[0].fields[0].variable);", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -7701,7 +9925,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"123ec8e74bc0fd62172507{{$timestamp}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, "url": { "raw": "{{serverURL}}/api/v1/contenttype", @@ -7714,7 +9938,7 @@ "contenttype" ] }, - "description": "Creates a field using a non existing field id." + "description": "Creates a content type using a workflow id." }, "response": [] }, @@ -7731,14 +9955,13 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", - "", + "pm.test(\"Validate response\", function () {", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", + " ", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -7761,13 +9984,12 @@ "id", "{{contentTypeId}}" ] - }, - "description": "Validates the content type and field were created as expected." + } }, "response": [] }, { - "name": "Delete ContentType", + "name": "Update Content Type with workflow id", "event": [ { "listen": "test", @@ -7775,6 +9997,16 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var jsonData = pm.response.json();", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -7783,8 +10015,17 @@ } ], "request": { - "method": "DELETE", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -7798,18 +10039,12 @@ "{{contentTypeId}}" ] }, - "description": "Cleanup" + "description": "Updates a content type using a workflow id." }, "response": [] - } - ], - "description": "This test creates the Content Type with a field with a not existing field id in the body." - }, - { - "name": "Multiple update permutations Copy", - "item": [ + }, { - "name": "Create ContentType", + "name": "Update Content Type with workflow variable name", "event": [ { "listen": "test", @@ -7819,12 +10054,14 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing content type id\", function () {", + "pm.test(\"Validate response\", function () {", + "", " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", - " pm.collectionVariables.set(\"contentTypeField1Variable\", jsonData.entity[0].fields[0].variable);", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -7833,54 +10070,66 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\"]\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeId}}" ] }, - "description": "Simple creation to sep up the data for the update tests." + "description": "Updates a content type using a workflow variable name." }, "response": [] }, { - "name": "Get Content Type", + "name": "Update Content Type with workflow variable name and id", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", - "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Check response\", function () {", + "pm.test(\"Validate response\", function () {", "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", + " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", "", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", - "});" + " ", + " var workflows = jsonData.entity.workflows;", + " workflows = workflows.sort(compareBy);", + " pm.expect(2).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + " pm.expect(workflows[1].id).to.eql(testSchemeId);", + " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", + "});", + "", + "function compareBy(a, b) {", + " if (a.variableName < b.variableName) { return -1; }", + " if (a.variableName > b.variableName) { return 1; }", + " return 0;", + "}" ], "type": "text/javascript", "packages": {} @@ -7888,8 +10137,17 @@ } ], "request": { - "method": "GET", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\", \"{{schemeId}}\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -7903,29 +10161,19 @@ "{{contentTypeId}}" ] }, - "description": "Validates the content type and field were created as expected." + "description": "Updates a content type using a workflow variable name and a workflow id." }, "response": [] }, { - "name": "Update field with no variable name", + "name": "Update Content Type with wrong workflow #1", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", "});" ], "type": "text/javascript", @@ -7938,7 +10186,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\", \"doestNotExist\"]\n}", "options": { "raw": { "language": "json" @@ -7958,31 +10206,19 @@ "{{contentTypeId}}" ] }, - "description": "Updates the field with no variable name." + "description": "Validates the proper error handling when a wrong workflow is used." }, "response": [] }, { - "name": "Update field with no content type id", + "name": "Update Content Type with wrong workflow #2", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeId = pm.collectionVariables.get(\"contentTypeId\");", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", - " pm.expect(jsonData.entity.fields[0].contentTypeId).to.eql(contentTypeId);", + "pm.test(\"Status code should be 400\", function () {", + " pm.response.to.have.status(400);", "});" ], "type": "text/javascript", @@ -7995,7 +10231,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"doestNotExist\"]\n}", "options": { "raw": { "language": "json" @@ -8015,12 +10251,12 @@ "{{contentTypeId}}" ] }, - "description": "Updates the fields with no content type id in the fields." + "description": "Validates the proper error handling when a wrong workflow is used." }, "response": [] }, { - "name": "Update field with content type id", + "name": "Delete ContentType", "event": [ { "listen": "test", @@ -8028,16 +10264,6 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -8046,17 +10272,8 @@ } ], "request": { - "method": "PUT", + "method": "DELETE", "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -8069,30 +10286,19 @@ "id", "{{contentTypeId}}" ] - }, - "description": "Updates the fields with the content type id in the fields." + } }, "response": [] }, { - "name": "Update field with existing id", + "name": "Archive Scheme", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", + "pm.test(\"Status code is 200 \", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", - "", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", "});" ], "type": "text/javascript", @@ -8101,54 +10307,168 @@ } ], "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, "method": "PUT", - "header": [], + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\"schemeName\": \"{{schemeName}}\", \"schemeArchived\": \"true\"}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "workflow", + "schemes", + "{{schemeId}}" + ] + } + }, + "response": [] + }, + { + "name": "Delete Scheme", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } ] }, - "description": "Updates a field using an existing field id." + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "schemes", + "{{schemeId}}" + ] + } }, "response": [] + } + ], + "description": "Covering different update scenarios for saving workflows in a content type.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } }, { - "name": "Update field with no existing id", + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + } + ], + "description": "The content type allows to pass a simple array of workflows ids or variables, these tests cases will cover diferent escenarios for this workflows list." + }, + { + "name": "Structured workflows array", + "item": [ + { + "name": "Creation", + "item": [ + { + "name": "Create Scheme", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", + "pm.test(\"Status code is 200 \", function () {", " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", - "", + "pm.test(\"Storing workflow data\", function () {", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", - "});" + " pm.collectionVariables.set(\"schemeId\", jsonData.entity.id);", + " pm.collectionVariables.set(\"schemeName\", jsonData.entity.name);", + " pm.collectionVariables.set(\"schemeVariableName\", jsonData.entity.variableName);", + "});", + "" ], "type": "text/javascript", "packages": {} @@ -8156,36 +10476,35 @@ } ], "request": { - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"does-not-exist\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\"schemeName\": \"Test Schema {{$timestamp}}\", \"schemeDescription\": \"Test sechema\", \"schemeArchived\": \"false\"}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", + "raw": "{{serverURL}}/api/v1/workflow/schemes", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeVariable}}" + "workflow", + "schemes" ] }, - "description": "Updates the field with a non existing field id but existing field variable name." + "description": "Creates a new test scheme" }, "response": [] }, { - "name": "Update field without id", + "name": "Create ContentType with workflow id and variable name", "event": [ { "listen": "test", @@ -8195,14 +10514,19 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Check response\", function () {", - "", - " var contentTypeField1Id = pm.collectionVariables.get(\"contentTypeField1Id\");", - " var contentTypeField1Variable = pm.collectionVariables.get(\"contentTypeField1Variable\");", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", "", + "pm.test(\"Validate response\", function () {", " var jsonData = pm.response.json();", - " pm.expect(jsonData.entity.fields[0].id).to.eql(contentTypeField1Id);", - " pm.expect(jsonData.entity.fields[0].variable).to.eql(contentTypeField1Variable);", + " ", + " var workflows = jsonData.entity[0].workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -8211,43 +10535,52 @@ } ], "request": { - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"indexed\": true,\n \"dataType\": \"TEXT\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"listed\": true,\n \"unique\": false,\n \"name\": \"Name\",\n \"variable\": \"name\",\n \"fixed\": true\n }\n ],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeVariable}}" + "contenttype" ] }, - "description": "Updates a field without a field id in the body but with a valid variable name." + "description": "Creates a content type specifying a workflow id and variable name." }, "response": [] }, { - "name": "Update field without id and variable", + "name": "Get Content Type", "event": [ { "listen": "test", "script": { "exec": [ + "var jsonData = pm.response.json();", + "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -8256,19 +10589,10 @@ } ], "request": { - "method": "PUT", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeVariable}}", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], @@ -8277,10 +10601,9 @@ "v1", "contenttype", "id", - "{{contentTypeVariable}}" + "{{contentTypeId}}" ] - }, - "description": "Updates a content type with a field without a field id and field variable in the body, as there is not data to use to identify the field, a new field will be created." + } }, "response": [] }, @@ -8315,68 +10638,35 @@ "id", "{{contentTypeId}}" ] - }, - "description": "Cleanup" + } }, "response": [] - } - ] - } - ], - "description": "In this folder we test different scenarios for handling the Content Type fields where we validate cases in order to not always rely on the Content Type field ID." - } - ], - "description": "When saving content type and fields, we don't need to rely entirely on ids, if the id does not exist or is not provided, we should use variables as the key.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Test Workflows", - "item": [ - { - "name": "Simple workflows array", - "item": [ - { - "name": "Creation", - "item": [ + }, { - "name": "Create Scheme", + "name": "Create ContentType with workflow variable name", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 200 \", function () {", + "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing workflow data\", function () {", + "pm.test(\"Storing content type data\", function () {", " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"schemeId\", jsonData.entity.id);", - " pm.collectionVariables.set(\"schemeName\", jsonData.entity.name);", - " pm.collectionVariables.set(\"schemeVariableName\", jsonData.entity.variableName);", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", "});", - "" + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" ], "type": "text/javascript", "packages": {} @@ -8393,26 +10683,25 @@ ], "body": { "mode": "raw", - "raw": "{\"schemeName\": \"Test Schema {{$timestamp}}\", \"schemeDescription\": \"Test sechema\", \"schemeArchived\": \"false\"}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" }, "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "workflow", - "schemes" + "contenttype" ] }, - "description": "Creates a new test scheme" + "description": "Creates a content type using just the workflow variable name." }, "response": [] }, { - "name": "Create ContentType with workflow id", + "name": "Delete ContentType", "event": [ { "listen": "test", @@ -8420,21 +10709,6 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", "});" ], "type": "text/javascript", @@ -8443,49 +10717,45 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" - }, + "method": "DELETE", + "header": [], "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeId}}" ] - }, - "description": "Creates a content type using a workflow id." + } }, "response": [] }, { - "name": "Get Content Type", + "name": "Create ContentType with workflow id", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", - "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", "});", "", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", "pm.test(\"Validate response\", function () {", " var jsonData = pm.response.json();", " ", - " var workflows = jsonData.entity.workflows;", + " var workflows = jsonData.entity[0].workflows;", " pm.expect(1).to.eql(workflows.length);", " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", @@ -8497,21 +10767,29 @@ } ], "request": { - "method": "GET", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n }\n ]\n}" + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "contenttype" ] - } + }, + "description": "Creates a content type using just the workflow id." }, "response": [] }, @@ -8551,7 +10829,7 @@ "response": [] }, { - "name": "Create ContentType with workflow variable name", + "name": "Create ContentType with multiple workflows", "event": [ { "listen": "test", @@ -8568,13 +10846,27 @@ "});", "", "pm.test(\"Validate response\", function () {", + "", + " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", + " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", + "", " var jsonData = pm.response.json();", " ", " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", + " workflows = workflows.sort(compareBy);", + " pm.expect(2).to.eql(workflows.length);", " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" + " pm.expect(workflows[1].id).to.eql(testSchemeId);", + " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", + "});", + "", + "function compareBy(a, b) {", + " if (a.variableName < b.variableName) { return -1; }", + " if (a.variableName > b.variableName) { return 1; }", + " return 0;", + "}", + "" ], "type": "text/javascript", "packages": {} @@ -8591,7 +10883,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n },\n {\n \"id\": \"{{schemeId}}\",\n \"variableName\": \"{{schemeVariableName}}\"\n }\n ]\n}" }, "url": { "raw": "{{serverURL}}/api/v1/contenttype", @@ -8604,7 +10896,7 @@ "contenttype" ] }, - "description": "Creates a content type using a workflow variable name." + "description": "Creates a content type with multiple workflows" }, "response": [] }, @@ -8644,7 +10936,7 @@ "response": [] }, { - "name": "Create ContentType with workflow variable name and id", + "name": "Create ContentType with non existing id but valid variable", "event": [ { "listen": "test", @@ -8661,26 +10953,13 @@ "});", "", "pm.test(\"Validate response\", function () {", - "", - " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", - " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", - "", " var jsonData = pm.response.json();", " ", " var workflows = jsonData.entity[0].workflows;", - " workflows = workflows.sort(compareBy);", - " pm.expect(2).to.eql(workflows.length);", + " pm.expect(1).to.eql(workflows.length);", " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - " pm.expect(workflows[1].id).to.eql(testSchemeId);", - " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", "});", - "", - "function compareBy(a, b) {", - " if (a.variableName < b.variableName) { return -1; }", - " if (a.variableName > b.variableName) { return 1; }", - " return 0;", - "}", "" ], "type": "text/javascript", @@ -8698,7 +10977,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"{{schemeId}}\",\"systemworkflow\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bf12345\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" }, "url": { "raw": "{{serverURL}}/api/v1/contenttype", @@ -8711,12 +10990,12 @@ "contenttype" ] }, - "description": "Creates a content type using a workflow id and a workflow variable name." + "description": "Creates a content type with with a workflow using a non existing id but with a valid variable name." }, "response": [] }, { - "name": "Delete ContentType", + "name": "Create ContentType with non existing variable but valid id", "event": [ { "listen": "test", @@ -8724,7 +11003,23 @@ "exec": [ "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", - "});" + "});", + "", + "pm.test(\"Storing content type data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});", + "" ], "type": "text/javascript", "packages": {} @@ -8732,21 +11027,29 @@ } ], "request": { - "method": "DELETE", - "header": [], + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"doesNotExit\"\n }\n ]\n}" + }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "raw": "{{serverURL}}/api/v1/contenttype", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype", - "id", - "{{contentTypeId}}" + "contenttype" ] - } + }, + "description": "Creates a content type with with a workflow using a non existing variable but with a valid id." }, "response": [] }, @@ -8777,7 +11080,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"doesNotExist\",\"systemworkflow\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"doesNotExist\"\n }\n ]\n}" }, "url": { "raw": "{{serverURL}}/api/v1/contenttype", @@ -8821,7 +11124,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"doesNotExist\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"doesNotExist\"\n }\n ]\n}" }, "url": { "raw": "{{serverURL}}/api/v1/contenttype", @@ -9061,13 +11364,167 @@ " var jsonData = pm.response.json();", " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[2].id);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity[0].workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Creates a content type with a workflow using an id and variable name." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + " var jsonData = pm.response.json();", + " ", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + } + }, + "response": [] + }, + { + "name": "Update Content Type with workflow id and variable name", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate response\", function () {", + "", + " var jsonData = pm.response.json();", + "", + " var workflows = jsonData.entity.workflows;", + " pm.expect(1).to.eql(workflows.length);", + " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", + " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type using a workflow with id and variable name." + }, + "response": [] + }, + { + "name": "Update Content Type with workflow variable name", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Validate response\", function () {", + "", " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", + "", + " var workflows = jsonData.entity.workflows;", " pm.expect(1).to.eql(workflows.length);", " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", @@ -9079,48 +11536,49 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{serverURL}}/api/v1/contenttype", + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "contenttype" + "contenttype", + "id", + "{{contentTypeId}}" ] }, - "description": "Creates a content type using a workflow id." + "description": "Updates a content type using a workflow with just a variable name." }, "response": [] }, { - "name": "Get Content Type", + "name": "Update Content Type with workflow id", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();", - "", "pm.test(\"Status code should be ok 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Validate response\", function () {", + "", " var jsonData = pm.response.json();", - " ", + "", " var workflows = jsonData.entity.workflows;", " pm.expect(1).to.eql(workflows.length);", " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", @@ -9133,8 +11591,17 @@ } ], "request": { - "method": "GET", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", "host": [ @@ -9147,12 +11614,13 @@ "id", "{{contentTypeId}}" ] - } + }, + "description": "Updates a content type using a workflow with just an id." }, "response": [] }, { - "name": "Update Content Type with workflow id", + "name": "Update Content Type with with multiple workflows", "event": [ { "listen": "test", @@ -9164,13 +11632,25 @@ "", "pm.test(\"Validate response\", function () {", "", - " var jsonData = pm.response.json();", + " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", + " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", "", + " var jsonData = pm.response.json();", + " ", " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", + " workflows = workflows.sort(compareBy);", + " pm.expect(2).to.eql(workflows.length);", " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" + " pm.expect(workflows[1].id).to.eql(testSchemeId);", + " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", + "});", + "", + "function compareBy(a, b) {", + " if (a.variableName < b.variableName) { return -1; }", + " if (a.variableName > b.variableName) { return 1; }", + " return 0;", + "}" ], "type": "text/javascript", "packages": {} @@ -9182,7 +11662,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n },\n {\n \"id\": \"{{schemeId}}\",\n \"variableName\": \"{{schemeVariableName}}\"\n }\n ]\n}", "options": { "raw": { "language": "json" @@ -9202,12 +11682,12 @@ "{{contentTypeId}}" ] }, - "description": "Updates a content type using a workflow id." + "description": "Updates a content type with multiple workflow." }, "response": [] }, { - "name": "Update Content Type with workflow variable name", + "name": "Update Content Type with non existing id but valid variable", "event": [ { "listen": "test", @@ -9237,7 +11717,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\"]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bf12345\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", "options": { "raw": { "language": "json" @@ -9257,12 +11737,12 @@ "{{contentTypeId}}" ] }, - "description": "Updates a content type using a workflow variable name." + "description": "Updates a content type with a workflow where the id is invalid but with a valid variable name." }, "response": [] }, { - "name": "Update Content Type with workflow variable name and id", + "name": "Update Content Type with non existing variable but valid id", "event": [ { "listen": "test", @@ -9274,25 +11754,13 @@ "", "pm.test(\"Validate response\", function () {", "", - " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", - " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", - "", " var jsonData = pm.response.json();", - " ", + "", " var workflows = jsonData.entity.workflows;", - " workflows = workflows.sort(compareBy);", - " pm.expect(2).to.eql(workflows.length);", + " pm.expect(1).to.eql(workflows.length);", " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - " pm.expect(workflows[1].id).to.eql(testSchemeId);", - " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", - "});", - "", - "function compareBy(a, b) {", - " if (a.variableName < b.variableName) { return -1; }", - " if (a.variableName > b.variableName) { return 1; }", - " return 0;", - "}" + "});" ], "type": "text/javascript", "packages": {} @@ -9304,7 +11772,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\", \"{{schemeId}}\"]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"doesNotExit\"\n }\n ]\n}", "options": { "raw": { "language": "json" @@ -9324,7 +11792,7 @@ "{{contentTypeId}}" ] }, - "description": "Updates a content type using a workflow variable name and a workflow id." + "description": "Updates a content type with a workflow where the id valid but with an invalid variable name." }, "response": [] }, @@ -9349,7 +11817,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"systemworkflow\", \"doestNotExist\"]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"doesNotExist\"\n }\n ]\n}", "options": { "raw": { "language": "json" @@ -9369,7 +11837,7 @@ "{{contentTypeId}}" ] }, - "description": "Validates the proper error handling when a wrong workflow is used." + "description": "Validates the proper error handling when a wrong workflow id is used." }, "response": [] }, @@ -9394,7 +11862,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"doestNotExist\"]\n}", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"doesNotExist\"\n }\n ]\n}", "options": { "raw": { "language": "json" @@ -9414,7 +11882,7 @@ "{{contentTypeId}}" ] }, - "description": "Validates the proper error handling when a wrong workflow is used." + "description": "Validates the proper error handling when a wrong workflow variable name is used." }, "response": [] }, @@ -9596,1651 +12064,2196 @@ { "listen": "test", "script": { - "type": "text/javascript", - "packages": {}, + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + } + ], + "description": "The content type allows to pass also a more estructured array of workflows where you can specify the id and variable for each workflow, these tests cases will cover diferent escenarios for this workflows list." + } + ], + "description": "Testing the diferent scenarios for saving workflows in a Content Type", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Layout fields", + "item": [ + { + "name": "Create", + "item": [ + { + "name": "Create ContentType without layout fields", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity[0].fields;", + " pm.expect(3).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity[0].fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Test to validate the layout fields are created even if not layout fields are sent." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(3).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Validates the content type and fields were created as expected." + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { "exec": [ - "" - ] + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} } } - ] - } - ], - "description": "The content type allows to pass a simple array of workflows ids or variables, these tests cases will cover diferent escenarios for this workflows list." - }, - { - "name": "Structured workflows array", - "item": [ + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Cleanup" + }, + "response": [] + }, { - "name": "Creation", - "item": [ + "name": "Create ContentType with layout fields", + "event": [ { - "name": "Create Scheme", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200 \", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing workflow data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"schemeId\", jsonData.entity.id);", - " pm.collectionVariables.set(\"schemeName\", jsonData.entity.name);", - " pm.collectionVariables.set(\"schemeVariableName\", jsonData.entity.variableName);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity[0].fields;", + " pm.expect(3).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity[0].fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + "});" ], - "body": { - "mode": "raw", - "raw": "{\"schemeName\": \"Test Schema {{$timestamp}}\", \"schemeDescription\": \"Test sechema\", \"schemeArchived\": \"false\"}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "schemes" - ] - }, - "description": "Creates a new test scheme" - }, - "response": [] + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"testContentType{{$timestamp}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fixed\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name\"\n }\n ],\n \"workflow\": [\n \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n ]\n}" }, - { - "name": "Create ContentType with workflow id and variable name", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"indexed\": true,\n \"dataType\": \"TEXT\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"listed\": true,\n \"unique\": false,\n \"name\": \"Name\",\n \"variable\": \"name\",\n \"fixed\": true\n }\n ],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a content type specifying a workflow id and variable name." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype" + ] }, + "description": "Test to validate the layout fields are respected when sent in the request." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - } - }, - "response": [] + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(3).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Validates the content type and fields were created as expected." + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - } - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Cleanup" + }, + "response": [] + }, + { + "name": "Create ContentType with wrong layout", + "event": [ { - "name": "Create ContentType with workflow variable name", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity[0].fields;", + " pm.expect(4).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity[0].fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"testContentType{{$timestamp}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"dataType\": \"SYSTEM\",\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 10,\n \"unique\": false\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name\"\n }\n ],\n \"workflow\": [\n \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n ]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } + "path": [ + "api", + "v1", + "contenttype" + ] + }, + "description": "Test to validate the layout is fixed even if the layout in the body is wrong." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(4).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", + "});" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a content type using just the workflow variable name." - }, - "response": [] + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Validates the content type and fields were created as expected." + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - } - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Cleanup" + }, + "response": [] + } + ], + "description": "Folder to encapsulate multiple tests to validate the proper creation and handling of layout fields." + }, + { + "name": "Update", + "item": [ + { + "name": "Create ContentType", + "event": [ { - "name": "Create ContentType with workflow id", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", + " pm.collectionVariables.set(\"contentTypeField1Variable\", jsonData.entity[0].fields[0].variable);", + "});" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n }\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a content type using just the workflow id." - }, - "response": [] + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] }, + "description": "Simple creation to sep up the data for the update tests." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(3).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - } - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Validates the content type and fields were created as expected." + }, + "response": [] + }, + { + "name": "Update fields exceeding maximum columns", + "event": [ { - "name": "Create ContentType with multiple workflows", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", - " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", - "", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " workflows = workflows.sort(compareBy);", - " pm.expect(2).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - " pm.expect(workflows[1].id).to.eql(testSchemeId);", - " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", - "});", - "", - "function compareBy(a, b) {", - " if (a.variableName < b.variableName) { return -1; }", - " if (a.variableName > b.variableName) { return 1; }", - " return 0;", - "}", - "" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(11).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[7].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[10].clazz);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field4\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 7,\n \"unique\": false,\n \"variable\": \"columnField4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field5\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"columnField5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field6\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 11,\n \"unique\": false,\n \"variable\": \"columnField6\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 12,\n \"unique\": false,\n \"variable\": \"name6\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n },\n {\n \"id\": \"{{schemeId}}\",\n \"variableName\": \"{{schemeVariableName}}\"\n }\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a content type with multiple workflows" - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Updates the fields exceeding maximum ammounts of columns per row." + }, + "response": [] + }, + { + "name": "Update fields exceeding maximum columns with multiple rows", + "event": [ { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(22).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[7].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[10].clazz);", + "", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[11].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[12].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[13].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[14].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[15].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[16].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[17].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[18].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[19].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[20].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[21].clazz); ", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field4\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 7,\n \"unique\": false,\n \"variable\": \"columnField4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field5\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"columnField5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field6\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 11,\n \"unique\": false,\n \"variable\": \"columnField6\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 12,\n \"unique\": false,\n \"variable\": \"name6\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 13,\n \"unique\": false,\n \"variable\": \"rowField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field11\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 14,\n \"unique\": false,\n \"variable\": \"columnField11\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name11\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 15,\n \"unique\": false,\n \"variable\": \"name11\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field22\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 16,\n \"unique\": false,\n \"variable\": \"columnField22\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name22\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 17,\n \"unique\": false,\n \"variable\": \"name22\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field33\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 18,\n \"unique\": false,\n \"variable\": \"columnField33\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name33\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 19,\n \"unique\": false,\n \"variable\": \"name33\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field44\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 20,\n \"unique\": false,\n \"variable\": \"columnField44\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name44\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 21,\n \"unique\": false,\n \"variable\": \"name44\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field55\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 22,\n \"unique\": false,\n \"variable\": \"columnField55\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name55\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 23,\n \"unique\": false,\n \"variable\": \"name55\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field66\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 24,\n \"unique\": false,\n \"variable\": \"columnField66\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name66\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 25,\n \"unique\": false,\n \"variable\": \"name66\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - } - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Updates the fields exceeding maximum ammounts of columns per row." + }, + "response": [] + }, + { + "name": "Update fields validating order is respected", + "event": [ { - "name": "Create ContentType with non existing id but valid variable", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(11).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields type order\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[7].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[10].clazz);", + "});", + "", + "pm.test(\"Validate fields order\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"rowField1\").to.eql(fields[0].variable);", + " pm.expect(\"columnField1\").to.eql(fields[1].variable);", + " pm.expect(\"name1\").to.eql(fields[2].variable);", + " pm.expect(\"columnField2\").to.eql(fields[3].variable);", + " pm.expect(\"name2\").to.eql(fields[4].variable);", + " pm.expect(\"columnField3\").to.eql(fields[5].variable);", + " pm.expect(\"name3\").to.eql(fields[6].variable);", + " pm.expect(\"columnField4\").to.eql(fields[7].variable);", + " pm.expect(\"name4\").to.eql(fields[8].variable);", + " pm.expect(\"name5\").to.eql(fields[9].variable);", + " pm.expect(\"name6\").to.eql(fields[10].variable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field4\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 7,\n \"unique\": false,\n \"variable\": \"columnField4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name6\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates the fields validating the given order is respected." + }, + "response": [] + }, + { + "name": "Update fields changing order", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(11).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields type order\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[7].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[10].clazz);", + "});", + "", + "pm.test(\"Validate fields order\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"rowField1\").to.eql(fields[0].variable);", + " pm.expect(\"columnField1\").to.eql(fields[1].variable);", + " pm.expect(\"name1\").to.eql(fields[2].variable);", + " pm.expect(\"columnField2\").to.eql(fields[3].variable);", + " pm.expect(\"name2\").to.eql(fields[4].variable);", + " pm.expect(\"columnField3\").to.eql(fields[5].variable);", + " pm.expect(\"name3\").to.eql(fields[6].variable);", + " pm.expect(\"columnField4\").to.eql(fields[7].variable);", + " pm.expect(\"name6\").to.eql(fields[8].variable);", + " pm.expect(\"name4\").to.eql(fields[9].variable);", + " pm.expect(\"name5\").to.eql(fields[10].variable);", + "});" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bf12345\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a content type with with a workflow using a non existing id but with a valid variable name." - }, - "response": [] + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field4\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 7,\n \"unique\": false,\n \"variable\": \"columnField4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name6\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Updates the fields changing the order of the fields" + }, + "response": [] + }, + { + "name": "Update fields changing order again", + "event": [ { - "name": "Create ContentType with non existing variable but valid id", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(11).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields type order\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[7].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[10].clazz);", + "});", + "", + "pm.test(\"Validate fields order\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"rowField1\").to.eql(fields[0].variable);", + " pm.expect(\"columnField1\").to.eql(fields[1].variable);", + " pm.expect(\"name1\").to.eql(fields[2].variable);", + " pm.expect(\"columnField2\").to.eql(fields[3].variable);", + " pm.expect(\"name3\").to.eql(fields[4].variable);", + " pm.expect(\"columnField3\").to.eql(fields[5].variable);", + " pm.expect(\"name2\").to.eql(fields[6].variable);", + " pm.expect(\"columnField4\").to.eql(fields[7].variable);", + " pm.expect(\"name6\").to.eql(fields[8].variable);", + " pm.expect(\"name4\").to.eql(fields[9].variable);", + " pm.expect(\"name5\").to.eql(fields[10].variable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field4\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 7,\n \"unique\": false,\n \"variable\": \"columnField4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name6\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"doesNotExit\"\n }\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a content type with with a workflow using a non existing variable but with a valid id." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Updates the fields changing the order of the fields" + }, + "response": [] + }, + { + "name": "Update fields removing column", + "event": [ { - "name": "Create ContentType with wrong workflow #1", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate fields size\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(10).to.eql(fields.length);", + "});", + "", + "pm.test(\"Validate fields type order\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableRowField\").to.eql(fields[0].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[1].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[2].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[3].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[4].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableColumnField\").to.eql(fields[5].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[6].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[7].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[8].clazz);", + " pm.expect(\"com.dotcms.contenttype.model.field.ImmutableTextField\").to.eql(fields[9].clazz);", + "});", + "", + "pm.test(\"Validate fields order\", function () {", + " var jsonData = pm.response.json();", + " var fields = jsonData.entity.fields;", + " pm.expect(\"rowField1\").to.eql(fields[0].variable);", + " pm.expect(\"columnField1\").to.eql(fields[1].variable);", + " pm.expect(\"name1\").to.eql(fields[2].variable);", + " pm.expect(\"columnField2\").to.eql(fields[3].variable);", + " pm.expect(\"name3\").to.eql(fields[4].variable);", + " pm.expect(\"columnField3\").to.eql(fields[5].variable);", + " pm.expect(\"name2\").to.eql(fields[6].variable);", + " pm.expect(\"name6\").to.eql(fields[7].variable);", + " pm.expect(\"name4\").to.eql(fields[8].variable);", + " pm.expect(\"name5\").to.eql(fields[9].variable);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Row\",\n \"fieldTypeLabel\": \"Row\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Row Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 0,\n \"unique\": false,\n \"variable\": \"rowField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field1\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 1,\n \"unique\": false,\n \"variable\": \"columnField1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name1\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 2,\n \"unique\": false,\n \"variable\": \"name1\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field2\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 3,\n \"unique\": false,\n \"variable\": \"columnField2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name2\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 6,\n \"unique\": false,\n \"variable\": \"name2\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"SYSTEM\",\n \"fieldContentTypeProperties\": [],\n \"fieldType\": \"Column\",\n \"fieldTypeLabel\": \"Column\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": false,\n \"listed\": false,\n \"name\": \"Column Field3\",\n \"readOnly\": false,\n \"required\": false,\n \"searchable\": false,\n \"sortOrder\": 5,\n \"unique\": false,\n \"variable\": \"columnField3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name3\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 4,\n \"unique\": false,\n \"variable\": \"name3\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name4\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 9,\n \"unique\": false,\n \"variable\": \"name4\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name5\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 10,\n \"unique\": false,\n \"variable\": \"name5\"\n },\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n \"dataType\": \"TEXT\",\n \"fieldType\": \"Text\",\n \"fieldTypeLabel\": \"Text\",\n \"fieldVariables\": [],\n \"fixed\": false,\n \"forceIncludeInApi\": false,\n \"indexed\": true,\n \"listed\": true,\n \"name\": \"Name6\",\n \"readOnly\": false,\n \"required\": true,\n \"searchable\": true,\n \"sortOrder\": 8,\n \"unique\": false,\n \"variable\": \"name6\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates the fields removing a column an validating the layout is correct." + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"doesNotExist\"\n }\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Validates the proper error handling when a wrong workflow is used." - }, - "response": [] + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Cleanup" + }, + "response": [] + } + ], + "description": "Folder to encapsulate multiple tests to validate the proper update and handling of layout fields." + } + ], + "description": "Multiple tests validating the proper handling of layout fields when saving content types", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "System Action Mappings", + "item": [ + { + "name": "Create", + "item": [ + { + "name": "Create ContentType without systemActionMappings", + "event": [ { - "name": "Create ContentType with wrong workflow #2", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate systemActionMappings is empty\", function () {", + " var systemActionMappings = pm.response.json().entity[0].systemActionMappings;", + " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", + "});" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"doesNotExist\"\n }\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Validates the proper error handling when a wrong workflow is used." - }, - "response": [] + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType1{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, - { - "name": "Archive Scheme", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200 \", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\"schemeName\": \"{{schemeName}}\", \"schemeArchived\": \"true\"}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "schemes", - "{{schemeId}}" - ] - }, - "description": "\n### Update Workflow Scheme\n\nUpdates an existing workflow scheme.\n\n#### Request Body\n- `schemeName` (string, optional): The name of the scheme.\n- `schemeArchived` (boolean, optional): Indicates if the scheme is archived.\n\n#### Response\nThe response for this request is documented as a JSON schema.\n" - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype" + ] }, + "description": "Test to validate the content type is created without `systemActionMappings`." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ { - "name": "Delete Scheme", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200 \", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "schemes", - "{{schemeId}}" - ] - } - }, - "response": [] + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings is empty\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } } ], - "description": "Covering different save scenarios for saving workflows in a content type.", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Validates the content type and `systemActionMappings` were created as expected." + }, + "response": [] + }, + { + "name": "Delete ContentType", "event": [ { - "listen": "prerequest", + "listen": "test", "script": { - "type": "text/javascript", - "packages": {}, "exec": [ - "" - ] + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Cleanup" + }, + "response": [] + }, + { + "name": "Create ContentType with empty systemActionMappings", + "event": [ { "listen": "test", "script": { - "type": "text/javascript", - "packages": {}, "exec": [ - "" - ] + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate systemActionMappings is empty\", function () {", + " var systemActionMappings = pm.response.json().entity[0].systemActionMappings;", + " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} } } - ] - }, - { - "name": "Update", - "item": [ - { - "name": "Create Scheme", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200 \", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing workflow data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"schemeId\", jsonData.entity.id);", - " pm.collectionVariables.set(\"schemeName\", jsonData.entity.name);", - " pm.collectionVariables.set(\"schemeVariableName\", jsonData.entity.variableName);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\"schemeName\": \"Test Schema {{$timestamp}}\", \"schemeDescription\": \"Test sechema\", \"schemeArchived\": \"false\"}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "schemes" - ] - }, - "description": "Creates a test scheme" - }, - "response": [] - }, - { - "name": "Create ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Storing content type data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", - " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", - " pm.collectionVariables.set(\"contentTypeField1Id\", jsonData.entity[0].fields[0].id);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity[0].workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType{{$randomAlphaNumeric}}{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype" - ] - }, - "description": "Creates a content type with a workflow using an id and variable name." - }, - "response": [] - }, - { - "name": "Get Content Type", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - } - }, - "response": [] + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType2{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"systemActionMappings\": {},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" }, - { - "name": "Update Content Type with workflow id and variable name", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var jsonData = pm.response.json();", - "", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type using a workflow with id and variable name." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype" + ] }, + "description": "Test to validate the content type is created with empty `systemActionMappings`." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ { - "name": "Update Content Type with workflow variable name", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var jsonData = pm.response.json();", - "", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings is empty\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type using a workflow with just a variable name." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Validates the content type and `systemActionMappings` were created as expected." + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ { - "name": "Update Content Type with workflow id", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var jsonData = pm.response.json();", - "", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type using a workflow with just an id." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Cleanup" + }, + "response": [] + }, + { + "name": "Create ContentType with systemActionMappings", + "event": [ { - "name": "Update Content Type with with multiple workflows", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var testSchemeId = pm.collectionVariables.get(\"schemeId\");", - " var testSchemeVariableName = pm.collectionVariables.get(\"schemeVariableName\");", - "", - " var jsonData = pm.response.json();", - " ", - " var workflows = jsonData.entity.workflows;", - " workflows = workflows.sort(compareBy);", - " pm.expect(2).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - " pm.expect(workflows[1].id).to.eql(testSchemeId);", - " pm.expect(workflows[1].variableName).to.eql(testSchemeVariableName);", - "});", - "", - "function compareBy(a, b) {", - " if (a.variableName < b.variableName) { return -1; }", - " if (a.variableName > b.variableName) { return 1; }", - " return 0;", - "}" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate systemActionMappings exist\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity[0]).to.have.property('systemActionMappings');", + "});", + "", + "pm.test(\"Validate systemActionMappings contain 'NEW' and 'ARCHIVE'\", function () {", + " var systemActionMappings = pm.response.json().entity[0].systemActionMappings;", + " pm.expect(systemActionMappings).to.have.property('NEW');", + " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", + "});", + "", + "pm.test(\"Validate workflowAction.id inside 'NEW' and 'ARCHIVE'\", function () {", + " var systemActionMappings = pm.response.json().entity[0].systemActionMappings;", + " ", + " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", + " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType3{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"systemActionMappings\" : {\n \"NEW\" : \"b9d89c80-3d88-4311-8365-187323c96436\",\n \"ARCHIVE\": \"4da13a42-5d59-480c-ad8f-94a3adf809fe\"\n },\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"SystemWorkflow\"\n },\n {\n \"id\": \"{{schemeId}}\",\n \"variableName\": \"{{schemeVariableName}}\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type with multiple workflow." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype" + ] }, + "description": "Test to validate the content type is created with `systemActionMappings`." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ { - "name": "Update Content Type with non existing id but valid variable", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var jsonData = pm.response.json();", - "", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings exist\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", + "});", + "", + "pm.test(\"Validate systemActionMappings contain 'NEW' and 'ARCHIVE'\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.have.property('NEW');", + " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", + "});", + "", + "pm.test(\"Validate workflowAction.id inside 'NEW' and 'ARCHIVE'\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " ", + " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", + " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bf12345\",\n \"variableName\": \"SystemWorkflow\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type with a workflow where the id is invalid but with a valid variable name." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Validates the content type and `systemActionMappings` were created as expected." + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ { - "name": "Update Content Type with non existing variable but valid id", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Validate response\", function () {", - "", - " var jsonData = pm.response.json();", - "", - " var workflows = jsonData.entity.workflows;", - " pm.expect(1).to.eql(workflows.length);", - " pm.expect(workflows[0].id).to.eql(\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\");", - " pm.expect(workflows[0].variableName).to.eql(\"SystemWorkflow\");", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\",\n \"variableName\": \"doesNotExit\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Updates a content type with a workflow where the id valid but with an invalid variable name." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Cleanup" + }, + "response": [] + } + ], + "description": "Folder to encapsulate multiple tests to validate the proper creation and handling of `systemActionMappings`." + }, + { + "name": "Update", + "item": [ + { + "name": "Create ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing content type id\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"contentTypeId\", jsonData.entity[0].id);", + " pm.collectionVariables.set(\"contentTypeVariable\", jsonData.entity[0].variable);", + "});", + "", + "pm.test(\"Validate systemActionMappings is empty\", function () {", + " var systemActionMappings = pm.response.json().entity[0].systemActionMappings;", + " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"testContentType1{{$timestamp}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] }, + "description": "Simple creation to sep up the data for the update tests." + }, + "response": [] + }, + { + "name": "Get Content Type", + "event": [ { - "name": "Update Content Type with wrong workflow #1", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings is empty\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"id\": \"doesNotExist\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Validates the proper error handling when a wrong workflow id is used." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Validates the content type and `systemActionMappings` were created as expected." + }, + "response": [] + }, + { + "name": "Update without systemActionMappings", + "event": [ { - "name": "Update Content Type with wrong workflow #2", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 400\", function () {", - " pm.response.to.have.status(400);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings is empty\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n\t\"description\": \"Test Content Type\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"Test Content Type\",\n\t\"variable\": \"{{contentTypeVariable}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"inventory\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n \"id\": \"{{contentTypeField1Id}}\",\n \"contentTypeId\": \"{{contentTypeId}}\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\": [\n {\n \"variableName\": \"doesNotExist\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - }, - "description": "Validates the proper error handling when a wrong workflow variable name is used." - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Updates a content type without `systemActionMappings`." + }, + "response": [] + }, + { + "name": "Update with empty systemActionMappings", + "event": [ { - "name": "Delete ContentType", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be ok 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings is empty\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\": {},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "contenttype", - "id", - "{{contentTypeId}}" - ] - } - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Updates a content type with emtpy `systemActionMappings`." + }, + "response": [] + }, + { + "name": "Update with systemActionMappings", + "event": [ { - "name": "Archive Scheme", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200 \", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings exist\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", + "});", + "", + "pm.test(\"Validate systemActionMappings\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.have.property('NEW');", + " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", + "});", + "", + "pm.test(\"Validate workflowAction.id\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " ", + " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", + " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\" : {\n \"NEW\" : \"b9d89c80-3d88-4311-8365-187323c96436\",\n \"ARCHIVE\": \"4da13a42-5d59-480c-ad8f-94a3adf809fe\"\n },\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type with `systemActionMappings`." + }, + "response": [] + }, + { + "name": "Update without systemActionMappings again", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings exist\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", + "});", + "", + "pm.test(\"Validate systemActionMappings\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.have.property('NEW');", + " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", + "});", + "", + "pm.test(\"Validate workflowAction.id\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " ", + " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", + " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", + "});" ], - "body": { - "mode": "raw", - "raw": "{\"schemeName\": \"{{schemeName}}\", \"schemeArchived\": \"true\"}" - }, - "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "schemes", - "{{schemeId}}" - ] + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] }, + "description": "Updates a content type without `systemActionMappings` existing mappings should be unaffected." + }, + "response": [] + }, + { + "name": "Update with empty systemActionMappings again", + "event": [ { - "name": "Delete Scheme", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200 \", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript", - "packages": {} - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings is empty\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.be.an('object').that.is.empty;", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\": {},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/workflow/schemes/{{schemeId}}", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "workflow", - "schemes", - "{{schemeId}}" - ] - } - }, - "response": [] + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type with empty `systemActionMappings` removing all existing mappings." + }, + "response": [] + }, + { + "name": "Update with systemActionMappings adding mappings again", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings exist\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", + "});", + "", + "pm.test(\"Validate systemActionMappings\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.have.property('NEW');", + " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", + "});", + "", + "pm.test(\"Validate workflowAction.id\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " ", + " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", + " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } } ], - "description": "Covering different update scenarios for saving workflows in a content type.", + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\" : {\n \"NEW\" : \"b9d89c80-3d88-4311-8365-187323c96436\",\n \"ARCHIVE\": \"4da13a42-5d59-480c-ad8f-94a3adf809fe\"\n },\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type with `systemActionMappings` adding mappings again as previous test deleted existing mappings." + }, + "response": [] + }, + { + "name": "Update with systemActionMappings adding more mappings", "event": [ { - "listen": "prerequest", + "listen": "test", "script": { - "type": "text/javascript", - "packages": {}, "exec": [ - "" - ] + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings exist\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", + "});", + "", + "pm.test(\"Validate systemActionMappings\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.have.property('NEW');", + " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", + " pm.expect(systemActionMappings).to.have.property('PUBLISH');", + "});", + "", + "pm.test(\"Validate workflowAction.id\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " ", + " pm.expect(systemActionMappings.NEW.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", + " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", + " pm.expect(systemActionMappings.PUBLISH.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\" : {\n \"NEW\" : \"b9d89c80-3d88-4311-8365-187323c96436\",\n \"ARCHIVE\": \"4da13a42-5d59-480c-ad8f-94a3adf809fe\",\n \"PUBLISH\": \"b9d89c80-3d88-4311-8365-187323c96436\"\n },\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "options": { + "raw": { + "language": "json" + } } }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type with `systemActionMappings` adding extra mappings to the existing ones." + }, + "response": [] + }, + { + "name": "Update by removing systemActionMappings", + "event": [ { "listen": "test", "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Validate systemActionMappings exist\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity).to.have.property('systemActionMappings');", + "});", + "", + "pm.test(\"Validate systemActionMappings\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " pm.expect(systemActionMappings).to.not.have.property('NEW');", + " pm.expect(systemActionMappings).to.have.property('ARCHIVE');", + " pm.expect(systemActionMappings).to.have.property('PUBLISH');", + "});", + "", + "pm.test(\"Validate workflowAction.id\", function () {", + " var systemActionMappings = pm.response.json().entity.systemActionMappings;", + " ", + " pm.expect(systemActionMappings.ARCHIVE.workflowAction.id).to.eql(\"4da13a42-5d59-480c-ad8f-94a3adf809fe\");", + " pm.expect(systemActionMappings.PUBLISH.workflowAction.id).to.eql(\"b9d89c80-3d88-4311-8365-187323c96436\");", + "});" + ], "type": "text/javascript", - "packages": {}, + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"id\": \"{{contentTypeId}}\",\n \"description\": \"Test Content Type\",\n \"defaultType\": false,\n \"system\": false,\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"Test Content Type\",\n \"variable\": \"{{contentTypeVariable}}\",\n \"host\": \"SYSTEM_HOST\",\n \"fixed\": false,\n \"icon\": \"inventory\",\n \"fields\": [\n {\n \"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": false\n }\n ],\n \"systemActionMappings\" : {\n \"ARCHIVE\": \"4da13a42-5d59-480c-ad8f-94a3adf809fe\",\n \"PUBLISH\": \"b9d89c80-3d88-4311-8365-187323c96436\"\n },\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Updates a content type by removing one `systemActionMappings`." + }, + "response": [] + }, + { + "name": "Delete ContentType", + "event": [ + { + "listen": "test", + "script": { "exec": [ - "" - ] + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} } } - ] + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/{{contentTypeId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "{{contentTypeId}}" + ] + }, + "description": "Cleanup" + }, + "response": [] } ], - "description": "The content type allows to pass also a more estructured array of workflows where you can specify the id and variable for each workflow, these tests cases will cover diferent escenarios for this workflows list." + "description": "Folder to encapsulate multiple tests to validate the proper update and handling of `systemActionMappings`." } ], - "description": "Testing the diferent scenarios for saving workflows in a Content Type", + "description": "Group of tests to cover the most common operations on the content type `systemActionMappings`.", "event": [ { "listen": "prerequest", @@ -11334,175 +14347,5 @@ ] } } - ], - "variable": [ - { - "key": "testDetailPagePageId1", - "value": "" - }, - { - "key": "testDetailPagePageURL1", - "value": "" - }, - { - "key": "testDetailPagePageId2", - "value": "" - }, - { - "key": "testDetailPagePageURL2", - "value": "" - }, - { - "key": "testDetailPagePageInode1", - "value": "" - }, - { - "key": "testDetailPagePageInode2", - "value": "" - }, - { - "key": "contentTypeID", - "value": "" - }, - { - "key": "contentTypeVAR", - "value": "" - }, - { - "key": "contentTypeFieldID", - "value": "" - }, - { - "key": "pageDetailSiteId", - "value": "" - }, - { - "key": "pageDetailSiteName", - "value": "" - }, - { - "key": "contentTypeId", - "value": "" - }, - { - "key": "pageDetailPageId1", - "value": "" - }, - { - "key": "pageDetailPageInode1", - "value": "" - }, - { - "key": "pageDetailPageURL1", - "value": "" - }, - { - "key": "pageDetailPageId2", - "value": "" - }, - { - "key": "pageDetailPageInode2", - "value": "" - }, - { - "key": "pageDetailPageURL2", - "value": "" - }, - { - "key": "contentTypeVariable", - "value": "" - }, - { - "key": "contentTypeField1Id", - "value": "" - }, - { - "key": "contentTypeField1Variable", - "value": "" - }, - { - "key": "skipPreResquest", - "value": "" - }, - { - "key": "currentSiteJost", - "value": "" - }, - { - "key": "currentPageId", - "value": "" - }, - { - "key": "url", - "value": "" - }, - { - "key": "currentPageUrl", - "value": "" - }, - { - "key": "contentTypeIdWithStoryBlock", - "value": "" - }, - { - "key": "contentType.host", - "value": "" - }, - { - "key": "contentType.field1", - "value": "" - }, - { - "key": "contentType.field2", - "value": "" - }, - { - "key": "contentType.field3", - "value": "" - }, - { - "key": "contentType.field4", - "value": "" - }, - { - "key": "contentType.field4.varName", - "value": "" - }, - { - "key": "contentType.divider", - "value": "" - }, - { - "key": "contentType.columnDivider", - "value": "" - }, - { - "key": "contentType.field4.fieldVarOne.id", - "value": "" - }, - { - "key": "contentType.field4.fieldVarOne.key", - "value": "" - }, - { - "key": "fieldTypesArr", - "value": "" - }, - { - "key": "schemeId", - "value": "" - }, - { - "key": "schemeName", - "value": "" - }, - { - "key": "schemeVariableName", - "value": "" - }, - { - "key": "fields", - "value": "" - } ] -} \ No newline at end of file +} From 5280f2ce2f5288ad4ad21f033525920034a4b952 Mon Sep 17 00:00:00 2001 From: jdotcms Date: Wed, 6 Aug 2025 11:34:43 -0600 Subject: [PATCH 20/24] #32238 fixing postman issues --- .../ContentTypePages.postman_collection.json | 75 ++++++++++++++++++- 1 file changed, 72 insertions(+), 3 deletions(-) diff --git a/dotcms-postman/src/main/resources/postman/ContentTypePages.postman_collection.json b/dotcms-postman/src/main/resources/postman/ContentTypePages.postman_collection.json index 0d6e665096bb..ffef415ffec4 100644 --- a/dotcms-postman/src/main/resources/postman/ContentTypePages.postman_collection.json +++ b/dotcms-postman/src/main/resources/postman/ContentTypePages.postman_collection.json @@ -1,7 +1,7 @@ { "info": { "_postman_id": "45b68571-8ba8-4364-8f24-bdd277843329", - "name": "ContentTypePages", + "name": "ContentTypePagesResource", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "781456" }, @@ -22,7 +22,7 @@ "", "pm.test(\"Storing workflow data\", function () {", " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"currentSiteJost\", jsonData.entity.hostname);", + " pm.collectionVariables.set(\"currentSiteHost\", jsonData.entity.hostname);", "});", "" ], @@ -71,6 +71,27 @@ }, { "name": "CreatePageWithSystemTemplate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Storing workflow data\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"currentPageId\", jsonData.entity.identifier);", + " pm.collectionVariables.set(\"currentPageUrl\", jsonData.entity.url);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], "request": { "auth": { "type": "bearer", @@ -86,7 +107,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \n}", + "raw": "{\n\t\"contentlet\":{\n\t\t\"contentType\": \"htmlpageasset\",\n\t\t\"title\": \"Page1 {{$timestamp}}\",\n \"url\": \"page1-{{$timestamp}}\",\n \"friendlyName\":\"page1-{{$timestamp}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"0\",\n \"hostFolder\":\"{{currentSiteHost}}\",\n \"indexPolicy\":\"WAIT_FOR\"\n\t}\n}\n", "options": { "raw": { "language": "json" @@ -144,6 +165,16 @@ } ], "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, "method": "GET", "header": [], "url": { @@ -200,6 +231,16 @@ } ], "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, "method": "GET", "header": [], "url": { @@ -241,6 +282,16 @@ } ], "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, "method": "GET", "header": [], "url": { @@ -328,5 +379,23 @@ ] } } + ], + "variable": [ + { + "key": "currentSiteJost", + "value": "" + }, + { + "key": "currentSiteHost", + "value": "" + }, + { + "key": "currentPageId", + "value": "" + }, + { + "key": "currentPageUrl", + "value": "" + } ] } \ No newline at end of file From d08663a3854e56ea77524804f6424df1ccb952a0 Mon Sep 17 00:00:00 2001 From: jdotcms Date: Wed, 6 Aug 2025 13:00:02 -0600 Subject: [PATCH 21/24] #32238 fixing postman issues --- .../resources/postman/ContentTypePages.postman_collection.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotcms-postman/src/main/resources/postman/ContentTypePages.postman_collection.json b/dotcms-postman/src/main/resources/postman/ContentTypePages.postman_collection.json index ffef415ffec4..0d5faab9efdf 100644 --- a/dotcms-postman/src/main/resources/postman/ContentTypePages.postman_collection.json +++ b/dotcms-postman/src/main/resources/postman/ContentTypePages.postman_collection.json @@ -209,7 +209,7 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing workflow data\", function () {", + "pm.test(\"Checking Content Type Information\", function () {", " let jsonData = pm.response.json();", " let length = jsonData.entity.length;", " let currentPage = jsonData.pagination.currentPage;", From 24b5e8302075632af0e9f1d8f4903820d47453c9 Mon Sep 17 00:00:00 2001 From: jdotcms Date: Mon, 25 Aug 2025 11:11:07 -0600 Subject: [PATCH 22/24] #32238 reversing undesired changes on ct postman --- .../src/main/resources/postman/ContentTypeResourceTests.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json index 2518e2a00ec0..c493aa5937da 100644 --- a/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json +++ b/dotcms-postman/src/main/resources/postman/ContentTypeResourceTests.json @@ -14348,4 +14348,4 @@ } } ] -} +} \ No newline at end of file From 74c0cb8940f24b106c8a08a9ff7dfbaacc37f89b Mon Sep 17 00:00:00 2001 From: jdotcms Date: Tue, 26 Aug 2025 12:01:12 -0600 Subject: [PATCH 23/24] #32238 the GH throws 400, so introducing a logout on the beginning in case there is a wrong login set --- .../ContentTypePages.postman_collection.json | 97 ++++++++++++++++++- 1 file changed, 96 insertions(+), 1 deletion(-) diff --git a/dotcms-postman/src/main/resources/postman/ContentTypePages.postman_collection.json b/dotcms-postman/src/main/resources/postman/ContentTypePages.postman_collection.json index 0d5faab9efdf..0142b59e60f5 100644 --- a/dotcms-postman/src/main/resources/postman/ContentTypePages.postman_collection.json +++ b/dotcms-postman/src/main/resources/postman/ContentTypePages.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "45b68571-8ba8-4364-8f24-bdd277843329", + "_postman_id": "eb368c08-8543-40cf-b207-fc4ec18294cd", "name": "ContentTypePagesResource", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "781456" @@ -9,6 +9,39 @@ { "name": "ContentTypeForPages", "item": [ + { + "name": "Logout", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/logout", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "logout" + ] + }, + "description": "Logout before try with invalid user" + }, + "response": [] + }, { "name": "GetCurrentSite", "event": [ @@ -315,6 +348,68 @@ }, "response": [] } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "if (!pm.environment.get('jwt')) {", + " console.log(\"generating....\")", + " const serverURL = pm.environment.get('serverURL'); // Get the server URL from the environment variable", + " const apiUrl = `${serverURL}/api/v1/apitoken`; // Construct the full API URL", + "", + " if (!pm.environment.get('jwt')) {", + " const username = pm.environment.get(\"user\");", + " const password = pm.environment.get(\"password\");", + " const basicAuth = Buffer.from(`${username}:${password}`).toString('base64');", + "", + " const requestOptions = {", + " url: apiUrl,", + " method: \"POST\",", + " header: {", + " \"accept\": \"*/*\",", + " \"content-type\": \"application/json\",", + " \"Authorization\": `Basic ${basicAuth}`", + " },", + " body: {", + " mode: \"raw\",", + " raw: JSON.stringify({", + " \"expirationSeconds\": 7200,", + " \"userId\": \"dotcms.org.1\",", + " \"network\": \"0.0.0.0/0\",", + " \"claims\": {\"label\": \"postman-tests\"}", + " })", + " }", + " };", + "", + " pm.sendRequest(requestOptions, function (err, response) {", + " if (err) {", + " console.log(err);", + " } else {", + " const jwt = response.json().entity.jwt;", + " pm.environment.set('jwt', jwt);", + " console.log(jwt);", + " }", + " });", + " }", + "}", + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } ] } ], From ea243b0e3dc7395df0eb252f3143010e910d0599 Mon Sep 17 00:00:00 2001 From: jdotcms Date: Wed, 27 Aug 2025 14:30:12 -0600 Subject: [PATCH 24/24] #32238 trying to fix the postman --- .../ContentTypePages.postman_collection.json | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/dotcms-postman/src/main/resources/postman/ContentTypePages.postman_collection.json b/dotcms-postman/src/main/resources/postman/ContentTypePages.postman_collection.json index 0142b59e60f5..34a70f2dc85b 100644 --- a/dotcms-postman/src/main/resources/postman/ContentTypePages.postman_collection.json +++ b/dotcms-postman/src/main/resources/postman/ContentTypePages.postman_collection.json @@ -103,7 +103,7 @@ "response": [] }, { - "name": "CreatePageWithSystemTemplate", + "name": "GetFirstPage", "event": [ { "listen": "test", @@ -113,11 +113,11 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Storing workflow data\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"currentPageId\", jsonData.entity.identifier);", - " pm.collectionVariables.set(\"currentPageUrl\", jsonData.entity.url);", - "});", + "", + "var jsonData = pm.response.json();", + "pm.collectionVariables.set(\"currentPageId\", jsonData.contentlets[0].identifier);", + "pm.collectionVariables.set(\"currentPageUrl\", jsonData.contentlets[0].url);", + "", "" ], "type": "text/javascript", @@ -125,6 +125,9 @@ } } ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, "request": { "auth": { "type": "bearer", @@ -136,11 +139,11 @@ } ] }, - "method": "PUT", + "method": "GET", "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"contentlet\":{\n\t\t\"contentType\": \"htmlpageasset\",\n\t\t\"title\": \"Page1 {{$timestamp}}\",\n \"url\": \"page1-{{$timestamp}}\",\n \"friendlyName\":\"page1-{{$timestamp}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"0\",\n \"hostFolder\":\"{{currentSiteHost}}\",\n \"indexPolicy\":\"WAIT_FOR\"\n\t}\n}\n", + "raw": "", "options": { "raw": { "language": "json" @@ -148,18 +151,17 @@ } }, "url": { - "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "raw": "{{serverURL}}/api/content/render/false/query/+contentType:htmlpageasset", "host": [ "{{serverURL}}" ], "path": [ "api", - "v1", - "workflow", - "actions", - "default", - "fire", - "PUBLISH" + "content", + "render", + "false", + "query", + "+contentType:htmlpageasset" ] } },