@@ -32,7 +32,7 @@ public class AuthTokenTest {
3232 @ Before
3333 public void setUp () {
3434 System .out .println ("Running " + this .getClass ().getName () + "." + currentTest .getMethodName ());
35- this .cloudinary = new Cloudinary ("cloudinary://a:b@test123?load_strategies=false" );
35+ this .cloudinary = new Cloudinary ("cloudinary://a:b@test123?load_strategies=false&analytics=false " );
3636 final AuthToken authToken = new AuthToken (KEY ).duration (300 );
3737 authToken .startTime (11111111 ); // start time is set for test purposes
3838 cloudinary .config .authToken = authToken ;
@@ -74,28 +74,28 @@ public void testAuthenticatedUrl() {
7474
7575 String message = "should add token if authToken is globally set and signed = true" ;
7676 String url = cloudinary .url ().signed (true ).resourceType ("image" ).type ("authenticated" ).version ("1486020273" ).generate ("sample.jpg" );
77- assertEquals (message ,"http ://test123-res.cloudinary.com/image/authenticated/v1486020273/sample.jpg?__cld_token__=st=11111111~exp=11111411~hmac=8db0d753ee7bbb9e2eaf8698ca3797436ba4c20e31f44527e43b6a6e995cfdb3" , url );
77+ assertEquals (message ,"https ://test123-res.cloudinary.com/image/authenticated/v1486020273/sample.jpg?__cld_token__=st=11111111~exp=11111411~hmac=8db0d753ee7bbb9e2eaf8698ca3797436ba4c20e31f44527e43b6a6e995cfdb3" , url );
7878
7979 message = "should add token for 'public' resource" ;
8080 url = cloudinary .url ().signed (true ).resourceType ("image" ).type ("public" ).version ("1486020273" ).generate ("sample.jpg" );
81- assertEquals (message ,"http ://test123-res.cloudinary.com/image/public/v1486020273/sample.jpg?__cld_token__=st=11111111~exp=11111411~hmac=c2b77d9f81be6d89b5d0ebc67b671557e88a40bcf03dd4a6997ff4b994ceb80e" , url );
81+ assertEquals (message ,"https ://test123-res.cloudinary.com/image/public/v1486020273/sample.jpg?__cld_token__=st=11111111~exp=11111411~hmac=c2b77d9f81be6d89b5d0ebc67b671557e88a40bcf03dd4a6997ff4b994ceb80e" , url );
8282
8383 message = "should not add token if signed is false" ;
8484 url = cloudinary .url ().resourceType ("image" ).type ("authenticated" ).version ("1486020273" ).generate ("sample.jpg" );
85- assertEquals (message ,"http ://test123-res.cloudinary.com/image/authenticated/v1486020273/sample.jpg" , url );
85+ assertEquals (message ,"https ://test123-res.cloudinary.com/image/authenticated/v1486020273/sample.jpg" , url );
8686
8787 message = "should not add token if authToken is globally set but null auth token is explicitly set and signed = true" ;
8888 url = cloudinary .url ().authToken (AuthToken .NULL_AUTH_TOKEN ).signed (true ).resourceType ("image" ).type ("authenticated" ).version ("1486020273" ).generate ("sample.jpg" );
89- assertEquals (message ,"http ://test123-res.cloudinary.com/image/authenticated/s--v2fTPYTu--/v1486020273/sample.jpg" , url );
89+ assertEquals (message ,"https ://test123-res.cloudinary.com/image/authenticated/s--v2fTPYTu--/v1486020273/sample.jpg" , url );
9090
9191 message = "explicit authToken should override global setting" ;
9292 url = cloudinary .url ().signed (true ).authToken (new AuthToken (ALT_KEY ).startTime (222222222 ).duration (100 )).resourceType ("image" ).type ("authenticated" ).transformation (new Transformation ().crop ("scale" ).width (300 )).generate ("sample.jpg" );
93- assertEquals (message ,"http ://test123-res.cloudinary.com/image/authenticated/c_scale,w_300/sample.jpg?__cld_token__=st=222222222~exp=222222322~hmac=55cfe516530461213fe3b3606014533b1eca8ff60aeab79d1bb84c9322eebc1f" , url );
93+ assertEquals (message ,"https ://test123-res.cloudinary.com/image/authenticated/c_scale,w_300/sample.jpg?__cld_token__=st=222222222~exp=222222322~hmac=55cfe516530461213fe3b3606014533b1eca8ff60aeab79d1bb84c9322eebc1f" , url );
9494
9595 message = "should compute expiration as start time + duration" ;
9696 url = cloudinary .url ().signed (true ).authToken (new AuthToken ().startTime (11111111 ).duration (300 ))
9797 .type ("authenticated" ).version ("1486020273" ).generate ("sample.jpg" );
98- assertEquals (message ,"http ://test123-res.cloudinary.com/image/authenticated/v1486020273/sample.jpg?__cld_token__=st=11111111~exp=11111411~hmac=8db0d753ee7bbb9e2eaf8698ca3797436ba4c20e31f44527e43b6a6e995cfdb3" , url );
98+ assertEquals (message ,"https ://test123-res.cloudinary.com/image/authenticated/v1486020273/sample.jpg?__cld_token__=st=11111111~exp=11111411~hmac=8db0d753ee7bbb9e2eaf8698ca3797436ba4c20e31f44527e43b6a6e995cfdb3" , url );
9999
100100 }
101101
@@ -120,7 +120,7 @@ public void testTokenGeneration(){
120120 public void testUrlInTag () {
121121 String message = "should add token to an image tag url" ;
122122 String url = cloudinary .url ().signed (true ).resourceType ("image" ).type ("authenticated" ).version ("1486020273" ).imageTag ("sample.jpg" );
123- assertThat (url , Matchers .matchesPattern ("<img.*src='http ://res.cloudinary.com/test123/image/authenticated/v1486020273/sample.jpg\\ ?__cld_token__=st=11111111~exp=11111411~hmac=9bd6f41e2a5893da8343dc8eb648de8bf73771993a6d1457d49851250caf3b80.*>" ));
123+ assertThat (url , Matchers .matchesPattern ("<img.*src='https ://res.cloudinary.com/test123/image/authenticated/v1486020273/sample.jpg\\ ?__cld_token__=st=11111111~exp=11111411~hmac=9bd6f41e2a5893da8343dc8eb648de8bf73771993a6d1457d49851250caf3b80.*>" ));
124124
125125 }
126126
0 commit comments