Skip to content

Commit 469c740

Browse files
nadavofitocker
authored andcommitted
Add async parameter to upload params + test (#63)
1 parent 5d84093 commit 469c740

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

cloudinary-android-test/src/main/java/com/cloudinary/test/UploaderTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,14 @@ public void testEager() throws Exception {
163163
ObjectUtils.asMap("eager", Collections.singletonList(new Transformation().crop("scale").width(2.0))));
164164
}
165165

166+
public void testUploadAsync() throws Exception {
167+
if (cloudinary.config.apiSecret == null)
168+
return;
169+
JSONObject result = new JSONObject(cloudinary.uploader().upload(getAssetStream(TEST_IMAGE),
170+
ObjectUtils.asMap("transformation", new Transformation().crop("scale").width(2.0), "async", true)));
171+
assertEquals(result.getString("status"), "pending");
172+
}
173+
166174
public void testHeaders() throws Exception {
167175
if (cloudinary.config.apiSecret == null)
168176
return;

cloudinary-core/src/main/java/com/cloudinary/Util.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
public class Util {
1010
static final String[] BOOLEAN_UPLOAD_OPTIONS = new String[]{"backup", "exif", "faces", "colors", "image_metadata", "use_filename", "unique_filename",
11-
"eager_async", "invalidate", "discard_original_filename", "overwrite", "phash", "return_delete_token"};
11+
"eager_async", "invalidate", "discard_original_filename", "overwrite", "phash", "return_delete_token", "async"};
1212

1313
@SuppressWarnings({"rawtypes", "unchecked"})
1414
public static final Map<String, Object> buildUploadParams(Map options) {

cloudinary-test-common/src/main/java/com/cloudinary/test/AbstractUploaderTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,12 @@ public void testEager() throws IOException {
167167
cloudinary.uploader().upload(SRC_TEST_IMAGE, asMap("eager", Collections.singletonList(new Transformation().crop("scale").width(2.0)), "tags", SDK_TEST_TAG));
168168
}
169169

170+
@Test
171+
public void testUploadAsync() throws IOException {
172+
Map result = cloudinary.uploader().upload(SRC_TEST_IMAGE, asMap("transformation", new Transformation().crop("scale").width(2.0), "async", true));
173+
assertEquals((String)result.get("status"), "pending");
174+
}
175+
170176
@Test
171177
public void testHeaders() throws IOException {
172178
cloudinary.uploader().upload(SRC_TEST_IMAGE, asMap("headers", new String[]{"Link: 1"}, "tags", SDK_TEST_TAG));

0 commit comments

Comments
 (0)