Skip to content

Commit e4c4808

Browse files
content type uid in asset
1 parent ea7dfad commit e4c4808

File tree

2 files changed

+11
-22
lines changed

2 files changed

+11
-22
lines changed

src/main/java/com/contentstack/cms/stack/ContentType.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,6 @@ public Call<ResponseBody> reference( Boolean isIncludeGlobalField) {
345345
* is mandatory), along with the stack API key, to make a valid Content Management API request. Read more about
346346
* authentication.
347347
*
348-
* @param contentTypeUid
349-
* The unique ID of the content type that you wish to update. The uid is generated based on the title of the
350-
* content type. The unique ID of a content type is unique across a stack.
351348
* @return Call
352349
* @see <a
353350
* href="https://www.contentstack.com/docs/developers/apis/content-management-api/#get-all-references-of-content-type">
@@ -372,9 +369,6 @@ public Call<ResponseBody> referenceIncludeGlobalField() {
372369
* Authtoken (anyone is mandatory), along with the stack API key, to make a valid Content Management API request.
373370
* Read more about authentication.
374371
*
375-
* @param contentTypeUid
376-
* The unique ID of the content type that you wish to update. The uid is generated based on the title of the
377-
* content type. The unique ID of a content type is unique across a stack.
378372
* @return Call
379373
* @see <a href="https://www.contentstack.com/docs/developers/apis/content-management-api/#export-a-content-type">
380374
* Export A Content Type</a>

src/test/java/com/contentstack/cms/stack/ContentTypeAPITest.java

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@
88
import io.github.cdimascio.dotenv.Dotenv;
99
import okhttp3.ResponseBody;
1010
import org.json.simple.JSONObject;
11-
import org.junit.Ignore;
1211
import org.junit.jupiter.api.*;
1312
import retrofit2.Response;
1413

1514
import java.io.IOException;
1615
import java.util.HashMap;
17-
import java.util.Map;
1816
import java.util.logging.Logger;
1917

2018
@Tag("api")
@@ -84,10 +82,7 @@ void testFetchAPI() throws IOException {
8482
@Test
8583
@Order(3)
8684
void testSingleApi() throws IOException {
87-
Map<String, Object> mapQuery = new HashMap<>();
88-
mapQuery.put("version", 1);
89-
mapQuery.put("include_global_field_schema", true);
90-
Response<ResponseBody> response = contentType.single(contentTypeUid).execute();
85+
Response<ResponseBody> response = contentType.single().execute();
9186
if (response.isSuccessful()) {
9287
JsonObject jsonObject = Utils.toJson(response);
9388
Assertions.assertTrue(jsonObject.has("content_type"));
@@ -101,7 +96,7 @@ void testSingleApi() throws IOException {
10196
@Test
10297
void testUpdate() throws IOException {
10398
JSONObject requestBody = Utils.readJson("mockcontenttype/update.json");
104-
Response<ResponseBody> response = contentType.update("fake_content_type", requestBody).execute();
99+
Response<ResponseBody> response = contentType.update( requestBody).execute();
105100
if (response.isSuccessful()) {
106101
JsonObject jsonObject = Utils.toJson(response);
107102
Assertions.assertTrue(jsonObject.has("notice"));
@@ -114,7 +109,7 @@ void testUpdate() throws IOException {
114109
void testFieldVisibilityRule() throws IOException {
115110
JSONObject requestBody = Utils.readJson("mockcontenttype/visibility.json");
116111
Response<ResponseBody> response = contentType.fieldVisibilityRule(
117-
"fake_content_type", requestBody).execute();
112+
requestBody).execute();
118113
Assertions.assertFalse(response.isSuccessful());
119114

120115
}
@@ -123,7 +118,7 @@ void testFieldVisibilityRule() throws IOException {
123118
@Test
124119
@Disabled("No need to import all time")
125120
void testReference() throws IOException {
126-
Response<ResponseBody> response = contentType.reference(contentTypeUid, false).execute();
121+
Response<ResponseBody> response = contentType.reference( false).execute();
127122
if (response.isSuccessful()) {
128123
JsonObject jsonObject = Utils.toJson(response);
129124
Assertions.assertTrue(jsonObject.has("references"));
@@ -136,23 +131,23 @@ void testReference() throws IOException {
136131
@Order(7)
137132
@Test
138133
void testReferenceIncludingGlobalField() throws IOException {
139-
Response<ResponseBody> response = contentType.referenceIncludeGlobalField(contentTypeUid).execute();
134+
Response<ResponseBody> response = contentType.referenceIncludeGlobalField().execute();
140135
assert response.body() != null;
141136
Assertions.assertTrue(response.isSuccessful());
142137
}
143138

144139
@Order(8)
145140
@Test
146141
void testExport() throws IOException {
147-
Response<ResponseBody> response = contentType.export(contentTypeUid).execute();
142+
Response<ResponseBody> response = contentType.export().execute();
148143
assert response.body() != null;
149144
Assertions.assertTrue(response.isSuccessful());
150145
}
151146

152147
@Order(9)
153148
@Test
154149
void testExportByVersion() throws IOException {
155-
Response<ResponseBody> response = contentType.export(contentTypeUid, 1).execute();
150+
Response<ResponseBody> response = contentType.export( 1).execute();
156151
if (response.isSuccessful()) {
157152
JsonObject jsonObject = Utils.toJson(response);
158153
Assertions.assertTrue(jsonObject.has("schema"));
@@ -193,17 +188,17 @@ void testImportOverwrite() throws IOException {
193188

194189
@Order(12)
195190
@Test
196-
@Ignore
197-
void testDelete() throws IOException {
198-
Response<ResponseBody> response = contentType.delete("fake_content_type").execute();
191+
@Disabled("avoid running delete forcefully")
192+
void testDeleteContentType() throws IOException {
193+
Response<ResponseBody> response = contentType.delete().execute();
199194
Assertions.assertTrue(response.isSuccessful());
200195
}
201196

202197
@Order(13)
203198
@Disabled("avoid running delete forcefully")
204199
@Test
205200
void testDeleteForcefully() throws IOException {
206-
Response<ResponseBody> response = contentType.delete(contentTypeUid).execute();
201+
Response<ResponseBody> response = contentType.delete().execute();
207202
assert response.body() != null;
208203
if (response.isSuccessful()) {
209204
JsonObject jsonObject = Utils.toJson(response);

0 commit comments

Comments
 (0)