From 292bc3e89eb90a33971fba933947e1bf91a54cba Mon Sep 17 00:00:00 2001
From: reeshika-h <157372605+reeshika-h@users.noreply.github.com>
Date: Fri, 12 Apr 2024 17:23:41 +0530
Subject: [PATCH] Revert "added: APISanitytest file ,generating test reports"
---
pom.xml | 19 +-----
.../cms/organization/OrgApiTests.java | 4 +-
.../cms/stack/APISanityTestSuite.java | 26 --------
.../contentstack/cms/stack/AssetAPITest.java | 10 +--
.../cms/stack/ContentTypeAPITest.java | 20 +++---
.../cms/stack/EntryFieldsAPITest.java | 36 +++++------
.../cms/stack/ExtensionAPITest.java | 14 ++---
.../contentstack/cms/stack/RoleAPITest.java | 4 +-
.../contentstack/cms/stack/StackAPITest.java | 2 +-
.../cms/stack/TaxonomyAPITest.java | 15 ++++-
.../resources/mockcontenttype/visibility.json | 61 ++-----------------
11 files changed, 65 insertions(+), 146 deletions(-)
delete mode 100644 src/test/java/com/contentstack/cms/stack/APISanityTestSuite.java
diff --git a/pom.xml b/pom.xml
index b3ae7c9d..fb974ab4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
cms
jar
contentstack-management-java
- 1.3.3
+ 1.3.2
Contentstack Java Management SDK for Content Management API, Contentstack is a headless CMS with an
API-first approach
@@ -182,18 +182,6 @@
activation
1.1.1
-
- org.junit.platform
- junit-platform-runner
- 1.10.2
- test
-
-
- org.junit.platform
- junit-platform-suite
- 1.10.2
- test
-
@@ -206,10 +194,7 @@
maven-surefire-plugin
3.0.0-M5
-
- **/*TestSuite.java
-
- ${project.build.directory}/surefire-reports
+ true
true
diff --git a/src/test/java/com/contentstack/cms/organization/OrgApiTests.java b/src/test/java/com/contentstack/cms/organization/OrgApiTests.java
index 117a973e..d835f764 100644
--- a/src/test/java/com/contentstack/cms/organization/OrgApiTests.java
+++ b/src/test/java/com/contentstack/cms/organization/OrgApiTests.java
@@ -15,7 +15,7 @@
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@Tag("unit")
-public class OrgApiTests {
+class OrgApiTests {
private static Organization ORG;
private final String ORG_ID = TestClient.ORGANIZATION_UID;
@@ -390,7 +390,7 @@ void testAllInvitationWithQuery() throws IOException {
.addHeader("api_key", TestClient.API_KEY)
.addParam("include_plan", true);
Response response = ORG.allInvitations().execute();
- Assertions.assertTrue(response.isSuccessful());
+ Assertions.assertFalse(response.isSuccessful());
}
}
diff --git a/src/test/java/com/contentstack/cms/stack/APISanityTestSuite.java b/src/test/java/com/contentstack/cms/stack/APISanityTestSuite.java
deleted file mode 100644
index a1b6577f..00000000
--- a/src/test/java/com/contentstack/cms/stack/APISanityTestSuite.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.contentstack.cms.stack;
-import com.contentstack.cms.organization.OrgApiTests;
-import org.junit.platform.runner.JUnitPlatform;
-import org.junit.platform.suite.api.SelectClasses;
-import org.junit.runner.RunWith;
-
-
-@SuppressWarnings("deprecation")
-@RunWith(JUnitPlatform.class)
-@SelectClasses({
- TaxonomyAPITest.class,
- AssetAPITest.class,
- ContentTypeAPITest.class,
- EntryFieldsAPITest.class,
- EnvironmentAPITest.class,
- ExtensionAPITest.class,
- LocaleAPITest.class,
- RoleAPITest.class,
- StackAPITest.class,
- TokenAPITest.class,
- OrgApiTests.class
-
-})
-public class APISanityTestSuite {
-
-}
diff --git a/src/test/java/com/contentstack/cms/stack/AssetAPITest.java b/src/test/java/com/contentstack/cms/stack/AssetAPITest.java
index e1a6ac71..c64b1a8b 100644
--- a/src/test/java/com/contentstack/cms/stack/AssetAPITest.java
+++ b/src/test/java/com/contentstack/cms/stack/AssetAPITest.java
@@ -248,10 +248,10 @@ void testAssetDownloadPermanentUrl() throws IOException {
@Test
void testAssetUploadWithMultipleParams() throws IOException {
- String description = "The calender has been placed to assets";
- String filePath = "/Users/reeshika.hosmani/Downloads/iot-icon.png";
+ String description = "The calender has been placed to assets by ishaileshmishra";
+ String filePath = "/Users/shaileshmishra/Documents/workspace/GitHub/contentstack-management-java/src/test/resources/asset.png";
Contentstack client = new Contentstack.Builder().build();
- Stack stack = client.stack(API_KEY, MANAGEMENT_TOKEN);
+ Stack stack = client.stack("Your-api-key", "authorization");
Response upload = stack.asset()
.addParams(new HashMap<>())
.addHeaders(new HashMap<>())
@@ -261,8 +261,8 @@ void testAssetUploadWithMultipleParams() throws IOException {
String[] tags = {"shailesh", "mishra", "mumbai", "india"};
Response uploadMultiple = stack.asset().
uploadAsset(filePath, "parent_uid", "Fake Image", "Something as description", tags).execute();
- Assertions.assertTrue(uploadMultiple.isSuccessful());
- Assertions.assertTrue(upload.isSuccessful());
+ Assertions.assertFalse(uploadMultiple.isSuccessful());
+ Assertions.assertFalse(upload.isSuccessful());
}
}
diff --git a/src/test/java/com/contentstack/cms/stack/ContentTypeAPITest.java b/src/test/java/com/contentstack/cms/stack/ContentTypeAPITest.java
index f969995e..3dda2538 100644
--- a/src/test/java/com/contentstack/cms/stack/ContentTypeAPITest.java
+++ b/src/test/java/com/contentstack/cms/stack/ContentTypeAPITest.java
@@ -14,7 +14,7 @@ class ContentTypeAPITest {
public static ContentType contentType;
protected static String API_KEY = TestClient.API_KEY;
protected static String MANAGEMENT_TOKEN = TestClient.MANAGEMENT_TOKEN;
- protected static String contentTypeUid = "fake_content_type";
+ protected static String contentTypeUid = "contentType";
protected static Stack stack;
private int _COUNT = 2;
@@ -96,7 +96,7 @@ void testSingleApi() {
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type", request.url().toString());
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/contentType", request.url().toString());
}
@Order(5)
@@ -113,7 +113,7 @@ void testUpdate() {
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type", request.url().toString());
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/contentType", request.url().toString());
}
@Order(6)
@@ -130,7 +130,7 @@ void testFieldVisibilityRule() {
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type", request.url().toString());
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/contentType", request.url().toString());
}
@@ -148,7 +148,7 @@ void testReference() {
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNotNull(request.url().encodedQuery());
Assertions.assertEquals(
- "https://api.contentstack.io/v3/content_types/fake_content_type/references?include_global_fields=false",
+ "https://api.contentstack.io/v3/content_types/contentType/references?include_global_fields=false",
request.url().toString());
}
@@ -167,7 +167,7 @@ void testReferenceIncludingGlobalField() {
Assertions.assertNotNull(request.url().encodedQuery());
Assertions.assertEquals("include_global_fields=true", request.url().encodedQuery());
Assertions.assertEquals(
- "https://api.contentstack.io/v3/content_types/fake_content_type/references?include_global_fields=true",
+ "https://api.contentstack.io/v3/content_types/contentType/references?include_global_fields=true",
request.url().toString());
}
@@ -184,7 +184,7 @@ void testExport() {
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type/export",
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/contentType/export",
request.url().toString());
}
@@ -202,7 +202,7 @@ void testExportByVersion() {
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNotNull(request.url().encodedQuery());
Assertions.assertEquals("version=1", request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type/export?version=1",
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/contentType/export?version=1",
request.url().toString());
}
@@ -253,7 +253,7 @@ void testDeleteContentType() {
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type", request.url().toString());
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/contentType", request.url().toString());
}
@Order(14)
@@ -269,7 +269,7 @@ void testDeleteForcefully() {
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type", request.url().toString());
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/contentType", request.url().toString());
}
}
diff --git a/src/test/java/com/contentstack/cms/stack/EntryFieldsAPITest.java b/src/test/java/com/contentstack/cms/stack/EntryFieldsAPITest.java
index e209b269..981635a0 100644
--- a/src/test/java/com/contentstack/cms/stack/EntryFieldsAPITest.java
+++ b/src/test/java/com/contentstack/cms/stack/EntryFieldsAPITest.java
@@ -18,7 +18,7 @@ class EntryFieldsAPITest {
private static String API_KEY = TestClient.API_KEY;
private static String MANAGEMENT_TOKEN = TestClient.MANAGEMENT_TOKEN;
private static ContentType contentType = TestClient.getClient().stack(API_KEY, MANAGEMENT_TOKEN)
- .contentType("fake_content_type");
+ .contentType("test");
@BeforeAll
public static void setup() throws IOException {
@@ -37,7 +37,7 @@ void testEntryFindAll() {
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type/entries", request.url().toString());
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/test/entries", request.url().toString());
}
@Order(2)
@@ -53,7 +53,7 @@ void testEntryFetch() {
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type/entries/" + TestClient.API_KEY,
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/test/entries/" + TestClient.API_KEY,
request.url().toString());
}
@@ -74,7 +74,7 @@ void testEntryCreate() {
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type/entries", request.url().toString());
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/test/entries", request.url().toString());
}
@Order(4)
@@ -96,7 +96,7 @@ void testUpdate() {
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type/entries/" + TestClient.API_KEY,
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/test/entries/" + TestClient.API_KEY,
request.url().toString());
}
@@ -119,7 +119,7 @@ void testAtomicOperation() {
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type/entries/" + TestClient.API_KEY,
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/test/entries/" + TestClient.API_KEY,
request.url().toString());
}
@@ -136,7 +136,7 @@ void testEntryDelete() {
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type/entries/" + API_KEY,
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/test/entries/" + API_KEY,
request.url().toString());
}
@@ -160,7 +160,7 @@ void testEntryVersionName() {
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
Assertions.assertEquals(
- "https://api.contentstack.io/v3/content_types/fake_content_type/entries/" + TestClient.API_KEY + "/versions/1/name",
+ "https://api.contentstack.io/v3/content_types/test/entries/" + TestClient.API_KEY + "/versions/1/name",
request.url().toString());
}
@@ -178,7 +178,7 @@ void testEntryDetailOfAllVersion() {
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type/entries/" + API_KEY + "/versions",
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/test/entries/" + API_KEY + "/versions",
request.url().toString());
}
@@ -202,7 +202,7 @@ void testEntryDeleteVersionName() {
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
Assertions.assertEquals(
- "https://api.contentstack.io/v3/content_types/fake_content_type/entries/" + API_KEY + "/versions/1/name",
+ "https://api.contentstack.io/v3/content_types/test/entries/" + API_KEY + "/versions/1/name",
request.url().toString());
}
@@ -220,7 +220,7 @@ void testEntryGetReference() {
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type/entries/" + API_KEY + "/references",
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/test/entries/" + API_KEY + "/references",
request.url().toString());
}
@@ -243,7 +243,7 @@ void testEntryLocalise() {
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNotNull(request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type/entries/" + API_KEY + "?locale=en-us",
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/test/entries/" + API_KEY + "?locale=en-us",
request.url().toString());
}
@@ -260,7 +260,7 @@ void testEntryExport() {
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type/entries/" + API_KEY + "/export",
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/test/entries/" + API_KEY + "/export",
request.url().toString());
}
@@ -276,7 +276,7 @@ void testEntryImports() {
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type/entries/import",
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/test/entries/import",
request.url().toString());
}
@@ -294,7 +294,7 @@ void testEntryImportExisting() {
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type/entries/" + API_KEY + "/import",
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/test/entries/" + API_KEY + "/import",
request.url().toString());
}
@@ -317,7 +317,7 @@ void testEntryPublish() {
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type/entries/" + API_KEY + "/publish",
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/test/entries/" + API_KEY + "/publish",
request.url().toString());
}
@@ -361,7 +361,7 @@ void testPublishWithReference() {
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
Assertions.assertNull(request.url().encodedQuery());
- Assertions.assertEquals("https://api.contentstack.io/v3/content_types/fake_content_type/entries/" + API_KEY + "/unpublish",
+ Assertions.assertEquals("https://api.contentstack.io/v3/content_types/test/entries/" + API_KEY + "/unpublish",
request.url().toString());
}
@@ -378,7 +378,7 @@ public void testEntryQuery() {
Assertions.assertEquals(4, request.url().pathSegments().size());
Assertions.assertEquals("v3", request.url().pathSegments().get(0));
Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
- Assertions.assertEquals("fake_content_type", request.url().pathSegments().get(2));
+ Assertions.assertEquals("product", request.url().pathSegments().get(2));
Assertions.assertEquals("entries", request.url().pathSegments().get(3));
Assertions.assertNull(request.body());
Assertions.assertEquals("query={\"taxonomies.taxonomy_uid\":\"{ \\\"$in\\\" : [\\\"term_uid1\\\" , \\\"term_uid2\\\" ] }\"}", request.url().query());
diff --git a/src/test/java/com/contentstack/cms/stack/ExtensionAPITest.java b/src/test/java/com/contentstack/cms/stack/ExtensionAPITest.java
index d4ff4a28..975e9b3b 100644
--- a/src/test/java/com/contentstack/cms/stack/ExtensionAPITest.java
+++ b/src/test/java/com/contentstack/cms/stack/ExtensionAPITest.java
@@ -40,7 +40,7 @@ void extensionGetAll() {
extension.addHeader("authtoken", AUTHTOKEN);
Request request = extension.find().request();
- Assertions.assertEquals(4, request.headers().names().size());
+ Assertions.assertEquals(3, request.headers().names().size());
Assertions.assertEquals("GET", request.method());
Assertions.assertTrue(request.url().isHttps());
Assertions.assertEquals("api.contentstack.io", request.url().host());
@@ -60,7 +60,7 @@ void getSingleWithUid() {
extension.addHeader("authtoken", AUTHTOKEN);
Request request = extension.fetch().request();
- Assertions.assertEquals(4, request.headers().names().size());
+ Assertions.assertEquals(3, request.headers().names().size());
Assertions.assertEquals("GET", request.method());
Assertions.assertTrue(request.url().isHttps());
Assertions.assertEquals("api.contentstack.io", request.url().host());
@@ -79,7 +79,7 @@ void extensionUpdate() {
extension.addHeader("authtoken", AUTHTOKEN);
Request request = extension.update(new JSONObject()).request();
- Assertions.assertEquals(3, request.headers().names().size());
+ Assertions.assertEquals(2, request.headers().names().size());
Assertions.assertEquals("PUT", request.method());
Assertions.assertTrue(request.url().isHttps());
Assertions.assertEquals("api.contentstack.io", request.url().host());
@@ -98,7 +98,7 @@ void extensionDelete() {
extension.addHeader("authtoken", AUTHTOKEN);
Request request = extension.delete().request();
- Assertions.assertEquals(4, request.headers().names().size());
+ Assertions.assertEquals(3, request.headers().names().size());
Assertions.assertEquals("DELETE", request.method());
Assertions.assertTrue(request.url().isHttps());
Assertions.assertEquals("api.contentstack.io", request.url().host());
@@ -116,7 +116,7 @@ void extensionGetSingle() {
extension.addHeader("authtoken", AUTHTOKEN);
Request request = extension.fetch().request();
- Assertions.assertEquals(4, request.headers().names().size());
+ Assertions.assertEquals(3, request.headers().names().size());
Assertions.assertEquals("GET", request.method());
Assertions.assertTrue(request.url().isHttps());
Assertions.assertEquals("api.contentstack.io", request.url().host());
@@ -149,7 +149,7 @@ public void writeTo(BufferedSink sink) {
param.put("include_branch", false);
Request request = extension.uploadCustomField(params).request();
- Assertions.assertEquals(3, request.headers().names().size());
+ Assertions.assertEquals(2, request.headers().names().size());
Assertions.assertEquals("POST", request.method());
Assertions.assertTrue(request.url().isHttps());
Assertions.assertEquals("api.contentstack.io", request.url().host());
@@ -169,7 +169,7 @@ void extensionDeleteAgain() {
extension.addHeader("authtoken", AUTHTOKEN);
Request request = extension.delete().request();
- Assertions.assertEquals(4, request.headers().names().size());
+ Assertions.assertEquals(3, request.headers().names().size());
Assertions.assertEquals("DELETE", request.method());
Assertions.assertTrue(request.url().isHttps());
Assertions.assertEquals("api.contentstack.io", request.url().host());
diff --git a/src/test/java/com/contentstack/cms/stack/RoleAPITest.java b/src/test/java/com/contentstack/cms/stack/RoleAPITest.java
index c22260a6..c7966f5c 100644
--- a/src/test/java/com/contentstack/cms/stack/RoleAPITest.java
+++ b/src/test/java/com/contentstack/cms/stack/RoleAPITest.java
@@ -84,7 +84,7 @@ void updateRole() {
object.put("key", "value");
Request request = roles.update(object).request();
- Assertions.assertEquals(3, request.headers().names().size());
+ Assertions.assertEquals(2, request.headers().names().size());
Assertions.assertEquals("PUT", request.method());
Assertions.assertTrue(request.url().isHttps());
Assertions.assertEquals("api.contentstack.io", request.url().host());
@@ -101,7 +101,7 @@ void deleteRole() {
roles.addHeader("authtoken", AUTHTOKEN);
roles.addHeader("api_key", API_KEY);
Request request = roles.delete().request();
- Assertions.assertEquals(3, request.headers().names().size());
+ Assertions.assertEquals(2, request.headers().names().size());
Assertions.assertEquals("DELETE", request.method());
Assertions.assertTrue(request.url().isHttps());
Assertions.assertEquals("api.contentstack.io", request.url().host());
diff --git a/src/test/java/com/contentstack/cms/stack/StackAPITest.java b/src/test/java/com/contentstack/cms/stack/StackAPITest.java
index 7e7b5222..38d40078 100644
--- a/src/test/java/com/contentstack/cms/stack/StackAPITest.java
+++ b/src/test/java/com/contentstack/cms/stack/StackAPITest.java
@@ -158,7 +158,7 @@ void testStackTransferOwnership() {
assert response.errorBody() != null;
Error error = new Gson().fromJson(response.errorBody().string(), Error.class);
int errCode = error.getErrorCode();
- Assertions.assertEquals(105, errCode);
+ Assertions.assertEquals(309, errCode);
}
} catch (IOException e) {
log.warning(e.getLocalizedMessage());
diff --git a/src/test/java/com/contentstack/cms/stack/TaxonomyAPITest.java b/src/test/java/com/contentstack/cms/stack/TaxonomyAPITest.java
index 51b50737..197f1083 100644
--- a/src/test/java/com/contentstack/cms/stack/TaxonomyAPITest.java
+++ b/src/test/java/com/contentstack/cms/stack/TaxonomyAPITest.java
@@ -44,6 +44,7 @@ void fetchAll(){
try {
Response response = taxonomy.find().execute();
+ System.out.println(response.body().string());
if (response.isSuccessful()) {
Assertions.assertTrue(response.isSuccessful());
} else {
@@ -58,6 +59,7 @@ void fetchAll(){
void fetchSingle() {
try {
Response response = taxonomy.fetch("regions").execute();
+ System.out.println(response);
if (response.isSuccessful()) {
Assertions.assertTrue(response.isSuccessful());
} else {
@@ -75,6 +77,9 @@ void createTaxonomy() throws IOException {
taxonomy.addHeader(Util.API_KEY, API_KEY);
taxonomy.addHeader(Util.AUTHORIZATION, MANAGEMENT_TOKEN);
Request request = taxonomy.create(requestBody).request();
+ Response resp = taxonomy.create(requestBody).execute();
+ System.out.println(resp);
+ System.out.println(request);
Assertions.assertEquals(2, request.headers().names().size());
Assertions.assertEquals("POST", request.method());
Assertions.assertTrue(request.url().isHttps());
@@ -93,6 +98,7 @@ void updateTaxonomy() {
taxonomy.addHeader(Util.API_KEY, API_KEY);
taxonomy.addHeader(Util.AUTHORIZATION, MANAGEMENT_TOKEN);
Request request = taxonomy.update("sample_one",updateBody).request();
+ System.out.println(request);
Assertions.assertEquals(2, request.headers().names().size());
Assertions.assertEquals("PUT", request.method());
Assertions.assertTrue(request.url().isHttps());
@@ -118,6 +124,7 @@ void deleteTaxonomy(){
taxonomy.addHeaders(headers);
taxonomy.addParams(params);
Request request = taxonomy.delete("sample_one").request();
+ System.out.println(request);
Assertions.assertEquals(5, request.headers().names().size());
Assertions.assertEquals("DELETE", request.method());
Assertions.assertTrue(request.url().isHttps());
@@ -134,7 +141,9 @@ void createTerm() throws IOException {
terms.clearParams();
JSONObject term = Utils.readJson("mockTaxonomy/createTerm.json");
Request request = terms.create(term).request();
- Assertions.assertEquals(3, request.headers().names().size());
+// Response resp= terms.create(term).execute();
+// System.out.println(resp);
+ Assertions.assertEquals(2, request.headers().names().size());
Assertions.assertEquals("POST", request.method());
Assertions.assertTrue(request.url().isHttps());
Assertions.assertEquals("api.contentstack.io", request.url().host());
@@ -153,6 +162,8 @@ void fetchAllTerms() throws IOException {
terms.clearParams();
terms.addParam("limit", 3);
Request request = terms.find().request();
+ Response resp = terms.find().execute();
+ System.out.println(resp.body().string());
Assertions.assertEquals(2, request.headers().names().size());
Assertions.assertEquals("GET", request.method());
Assertions.assertTrue(request.url().isHttps());
@@ -172,6 +183,8 @@ void fetchAllTerms() throws IOException {
void fetchSingleTerm() throws IOException {
terms.clearParams();
Request request = terms.fetch("india").request();
+// Response resp = terms.fetch("india").execute();
+// System.out.println(resp);
Assertions.assertEquals(2, request.headers().names().size());
Assertions.assertEquals("GET", request.method());
Assertions.assertTrue(request.url().isHttps());
diff --git a/src/test/resources/mockcontenttype/visibility.json b/src/test/resources/mockcontenttype/visibility.json
index 8e1391df..00d45e3d 100644
--- a/src/test/resources/mockcontenttype/visibility.json
+++ b/src/test/resources/mockcontenttype/visibility.json
@@ -1,69 +1,16 @@
{
"content_type": {
- "title": "fake_content_type",
- "uid": "fake_content_type",
- "schema": [{
- "display_name": "Title",
- "uid": "title",
- "data_type": "text",
- "field_metadata": {
- "_default": true
- },
- "unique": false,
- "mandatory": true,
- "multiple": false
- },
- {
- "display_name": "URL",
- "uid": "url",
- "data_type": "text",
- "field_metadata": {
- "_default": true
- },
- "unique": false,
- "multiple": false
- },
- {
- "display_name": "Single Line Textbox",
- "uid": "single_line_textbox",
- "data_type": "text",
- "field_metadata": {
- "_default": true
- },
- "unique": false,
- "multiple": false
- },
- {
- "display_name": "Multi Line Textbox",
- "uid": "multi_line_textbox",
- "data_type": "text",
- "field_metadata": {
- "_default": true
- },
- "unique": false,
- "multiple": false
- }
- ],
"field_rules": [{
"conditions": [{
- "operand_field": "single_line_textbox",
+ "operand_field": "operand_field_uid",
"operator": "equals",
- "value": "abc"
+ "value": "value_corresponding_to_operator"
}],
"match_type": "all",
"actions": [{
"action": "show",
- "target_field": "multi_line_textbox"
+ "target_field": "target_field_uid"
}]
- }],
- "options": {
- "title": "title",
- "publishable": true,
- "is_page": true,
- "singleton": false,
- "sub_title": ["url"],
- "url_pattern": "/:title",
- "url_prefix": "/"
- }
+ }]
}
}
\ No newline at end of file