Skip to content

Commit d7b8bd2

Browse files
author
Amir Tocker
committed
Modify explicit test - don't use twitter
1 parent 228a6f4 commit d7b8bd2

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,11 @@ public void testRename() throws Exception {
149149
public void testExplicit() throws Exception {
150150
if (cloudinary.config.apiSecret == null)
151151
return;
152-
JSONObject result = new JSONObject(cloudinary.uploader().explicit("cloudinary",
153-
ObjectUtils.asMap("eager", Collections.singletonList(new Transformation().crop("scale").width(2.0)), "type", "twitter_name")));
154-
String url = cloudinary.url().type("twitter_name").transformation(new Transformation().crop("scale").width(2.0)).format("png")
155-
.version(result.get("version")).generate("cloudinary");
156-
assertEquals(result.getJSONArray("eager").getJSONObject(0).get("url"), url);
152+
JSONObject result = new JSONObject(cloudinary.uploader().explicit("sample",
153+
ObjectUtils.asMap("eager", Collections.singletonList(new Transformation().crop("scale").width(2.0)), "type", "upload")));
154+
String url = cloudinary.url().transformation(new Transformation().crop("scale").width(2.0)).format("jpg")
155+
.version(result.get("version")).generate("sample");
156+
assertEquals(url, result.getJSONArray("eager").getJSONObject(0).get("url"));
157157
}
158158

159159
public void testEager() throws Exception {
@@ -293,7 +293,7 @@ public void testCategorizationRequest() {
293293
try {
294294
cloudinary.uploader().upload(getAssetStream(TEST_IMAGE), ObjectUtils.asMap("categorization", "illegal"));
295295
} catch (Exception e) {
296-
assertTrue(e.getMessage().matches(".*illegal is not a valid.*"));
296+
assertTrue(e.getMessage().matches("(.*)(Illegal value|not a valid|invalid)(.*)"));
297297
}
298298
}
299299

@@ -304,7 +304,7 @@ public void testDetectionRequest() {
304304
try {
305305
cloudinary.uploader().upload(getAssetStream(TEST_IMAGE), ObjectUtils.asMap("detection", "illegal"));
306306
} catch (Exception e) {
307-
assertTrue(e.getMessage().matches(".*illegal is not a valid.*"));
307+
assertTrue(e.getMessage().matches(".*(Illegal value|not a valid|invalid).*"));
308308
}
309309
}
310310

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ public void testUniqueFilename() throws Exception {
147147

148148
@Test
149149
public void testExplicit() throws IOException {
150-
Map result = cloudinary.uploader().explicit("cloudinary", ObjectUtils.asMap("eager", Collections.singletonList(new Transformation().crop("scale").width(2.0)), "type", "twitter_name"));
151-
String url = cloudinary.url().type("twitter_name").transformation(new Transformation().crop("scale").width(2.0)).format("png").version(result.get("version")).generate("cloudinary");
150+
Map result = cloudinary.uploader().explicit("sample", ObjectUtils.asMap("eager", Collections.singletonList(new Transformation().crop("scale").width(2.0)), "type", "upload"));
151+
String url = cloudinary.url().transformation(new Transformation().crop("scale").width(2.0)).format("jpg").version(result.get("version")).generate("sample");
152152
String eagerUrl = (String) ((Map) ((List) result.get("eager")).get(0)).get("url");
153153
String cloudName = cloudinary.config.cloudName;
154154
assertEquals(eagerUrl.substring(eagerUrl.indexOf(cloudName)), url.substring(url.indexOf(cloudName)));

0 commit comments

Comments
 (0)