Skip to content

Commit

Permalink
Revert "added: APISanitytest file ,generating test reports"
Browse files Browse the repository at this point in the history
  • Loading branch information
reeshika-h authored Apr 12, 2024
1 parent 5d609ae commit 292bc3e
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 146 deletions.
19 changes: 2 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<artifactId>cms</artifactId>
<packaging>jar</packaging>
<name>contentstack-management-java</name>
<version>1.3.3</version>
<version>1.3.2</version>
<description>Contentstack Java Management SDK for Content Management API, Contentstack is a headless CMS with an
API-first approach
</description>
Expand Down Expand Up @@ -182,18 +182,6 @@
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>1.10.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite</artifactId>
<version>1.10.2</version>
<scope>test</scope>
</dependency>
</dependencies>


Expand All @@ -206,10 +194,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<includes>
<include>**/*TestSuite.java</include>
</includes>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<skipTests>true</skipTests>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -390,7 +390,7 @@ void testAllInvitationWithQuery() throws IOException {
.addHeader("api_key", TestClient.API_KEY)
.addParam("include_plan", true);
Response<ResponseBody> response = ORG.allInvitations().execute();
Assertions.assertTrue(response.isSuccessful());
Assertions.assertFalse(response.isSuccessful());
}

}
26 changes: 0 additions & 26 deletions src/test/java/com/contentstack/cms/stack/APISanityTestSuite.java

This file was deleted.

10 changes: 5 additions & 5 deletions src/test/java/com/contentstack/cms/stack/AssetAPITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<ResponseBody> upload = stack.asset()
.addParams(new HashMap<>())
.addHeaders(new HashMap<>())
Expand All @@ -261,8 +261,8 @@ void testAssetUploadWithMultipleParams() throws IOException {
String[] tags = {"shailesh", "mishra", "mumbai", "india"};
Response<ResponseBody> 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());
}

}
20 changes: 10 additions & 10 deletions src/test/java/com/contentstack/cms/stack/ContentTypeAPITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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());

}

Expand All @@ -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());
}

Expand All @@ -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());
}

Expand All @@ -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());
}

Expand All @@ -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());
}

Expand Down Expand Up @@ -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)
Expand All @@ -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());
}

}
36 changes: 18 additions & 18 deletions src/test/java/com/contentstack/cms/stack/EntryFieldsAPITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
Expand All @@ -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());
}

Expand All @@ -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)
Expand All @@ -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());
}

Expand All @@ -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());
}

Expand All @@ -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());
}

Expand All @@ -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());
}

Expand All @@ -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());
}

Expand All @@ -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());
}

Expand All @@ -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());
}

Expand All @@ -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());
}

Expand All @@ -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());
}

Expand All @@ -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());
}

Expand All @@ -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());
}

Expand All @@ -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());
}

Expand Down Expand Up @@ -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());
}

Expand All @@ -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());
Expand Down
Loading

0 comments on commit 292bc3e

Please sign in to comment.