@@ -50,6 +50,8 @@ public class UploaderTest extends AbstractTest {
5050 public static void setUp () throws Exception {
5151 String url = Utils .cloudinaryUrlFromContext (InstrumentationRegistry .getInstrumentation ().getContext ());
5252 cloudinary = new Cloudinary (url );
53+ cloudinary .config .analytics = false ;
54+ cloudinary .config .secure = false ;
5355 if (StringUtils .isBlank (url )) {
5456 throw new IllegalArgumentException ("UploaderTest - No cloudinary url configured" );
5557 }
@@ -88,7 +90,7 @@ public void testUpload() throws Exception {
8890 Map <String , Object > to_sign = new HashMap <String , Object >();
8991 to_sign .put ("public_id" , result .getString ("public_id" ));
9092 to_sign .put ("version" , ObjectUtils .asString (result .get ("version" )));
91- String expected_signature = cloudinary .apiSignRequest (to_sign , cloudinary .config .apiSecret );
93+ String expected_signature = cloudinary .apiSignRequest (to_sign , cloudinary .config .apiSecret , cloudinary . config . signatureVersion );
9294 Assert .assertEquals (result .get ("signature" ), expected_signature );
9395 }
9496
@@ -119,7 +121,7 @@ public void onProgress(long bytesUploaded, long totalBytes) {
119121 Map <String , Object > to_sign = new HashMap <String , Object >();
120122 to_sign .put ("public_id" , result .getString ("public_id" ));
121123 to_sign .put ("version" , ObjectUtils .asString (result .get ("version" )));
122- String expected_signature = cloudinary .apiSignRequest (to_sign , cloudinary .config .apiSecret );
124+ String expected_signature = cloudinary .apiSignRequest (to_sign , cloudinary .config .apiSecret , cloudinary . config . signatureVersion );
123125 Assert .assertEquals (result .get ("signature" ), expected_signature );
124126 }
125127
@@ -135,7 +137,7 @@ public void testUnsignedUpload() throws Exception {
135137 to_sign .put ("public_id" , result .getString ("public_id" ));
136138 to_sign .put ("version" , ObjectUtils .asString (result .get ("version" )));
137139 Log .d ("TestRunner" , cloudinary .config .apiSecret );
138- String expected_signature = cloudinary .apiSignRequest (to_sign , cloudinary .config .apiSecret );
140+ String expected_signature = cloudinary .apiSignRequest (to_sign , cloudinary .config .apiSecret , cloudinary . config . signatureVersion );
139141 Assert .assertEquals (result .get ("signature" ), expected_signature );
140142 }
141143
@@ -149,7 +151,7 @@ public void testUploadUrl() throws Exception {
149151 Map <String , Object > to_sign = new HashMap <String , Object >();
150152 to_sign .put ("public_id" , (String ) result .get ("public_id" ));
151153 to_sign .put ("version" , ObjectUtils .asString (result .get ("version" )));
152- String expected_signature = cloudinary .apiSignRequest (to_sign , cloudinary .config .apiSecret );
154+ String expected_signature = cloudinary .apiSignRequest (to_sign , cloudinary .config .apiSecret , cloudinary . config . signatureVersion );
153155 Assert .assertEquals (result .get ("signature" ), expected_signature );
154156 }
155157
@@ -167,7 +169,7 @@ public void testUploadDataUri() throws Exception {
167169 Map <String , Object > to_sign = new HashMap <String , Object >();
168170 to_sign .put ("public_id" , (String ) result .get ("public_id" ));
169171 to_sign .put ("version" , ObjectUtils .asString (result .get ("version" )));
170- String expected_signature = cloudinary .apiSignRequest (to_sign , cloudinary .config .apiSecret );
172+ String expected_signature = cloudinary .apiSignRequest (to_sign , cloudinary .config .apiSecret , cloudinary . config . signatureVersion );
171173 Assert .assertEquals (result .get ("signature" ), expected_signature );
172174 }
173175
@@ -182,15 +184,15 @@ public void testUploadExternalSignature() throws Exception {
182184
183185 Map <String , Object > params = new HashMap <String , Object >();
184186 params .put ("timestamp" , Long .valueOf (System .currentTimeMillis () / 1000L ).toString ());
185- params .put ("signature" , this .cloudinary .apiSignRequest (params , apiSecret ));
187+ params .put ("signature" , this .cloudinary .apiSignRequest (params , apiSecret , cloudinary . config . signatureVersion ));
186188 Cloudinary emptyCloudinary = new Cloudinary (config );
187189 JSONObject result = new JSONObject (emptyCloudinary .uploader ().upload (getAssetStream (TEST_IMAGE ), params ));
188190 Assert .assertEquals (result .getLong ("width" ), 241L );
189191 Assert .assertEquals (result .getLong ("height" ), 51L );
190192 Map <String , Object > to_sign = new HashMap <String , Object >();
191193 to_sign .put ("public_id" , result .getString ("public_id" ));
192194 to_sign .put ("version" , ObjectUtils .asString (result .get ("version" )));
193- String expected_signature = cloudinary .apiSignRequest (to_sign , apiSecret );
195+ String expected_signature = cloudinary .apiSignRequest (to_sign , apiSecret , cloudinary . config . signatureVersion );
194196 Assert .assertEquals (result .get ("signature" ), expected_signature );
195197 }
196198
0 commit comments