@@ -25,3 +25,28 @@ func TestGetAllCustomPaths(t *testing.T) {
2525 }
2626
2727}
28+ func TestFindPath (t * testing.T ) {
29+ os .Setenv ("GHS_CUSTOM_PATH_images/digilex-infordoc-images" , "https://storage.gra.cloud.ovh.net/v1/AUTH_ed33ec9e34c64b54aca49d6fcb6dc4c8/infordoc-img" )
30+ os .Setenv ("GHS_CUSTOM_REWRITE_images/digilex-infordoc-images" , "" )
31+ os .Setenv ("GHS_CUSTOM_PATH_images.digilex-infordoc/1" , "https://storage.gra.cloud.ovh.net/v1/AUTH_ed33ec9e34c64b54aca49d6fcb6dc4c8/img" )
32+ os .Setenv ("GHS_CUSTOM_PATH_/images/digilex-infordoc-img" , "https://storage.gra.cloud.ovh.net/v1/AUTH_ed33ec9e34c64b54aca49d6fcb6dc4c8/infordoc" )
33+
34+ result , path := FindPath ("/images/digilex-infordoc-images" )
35+
36+ assert .True (t , result )
37+ assert .True (t , path .GetTarget () == "https://storage.gra.cloud.ovh.net/v1/AUTH_ed33ec9e34c64b54aca49d6fcb6dc4c8/infordoc-img" )
38+ assert .True (t , path .IsRewrite ())
39+
40+ result1 , path1 := FindPath ("/images/digilex-infordoc/1" )
41+
42+ assert .True (t , result1 )
43+ assert .True (t , path1 .GetTarget () == "https://storage.gra.cloud.ovh.net/v1/AUTH_ed33ec9e34c64b54aca49d6fcb6dc4c8/img" )
44+ assert .True (t , path1 .IsRewrite () == false )
45+
46+ result2 , path2 := FindPath ("/images/digilex-infordoc-img" )
47+
48+ assert .True (t , result2 )
49+ assert .True (t , path2 .GetTarget () == "https://storage.gra.cloud.ovh.net/v1/AUTH_ed33ec9e34c64b54aca49d6fcb6dc4c8/infordoc" )
50+ assert .True (t , path2 .IsRewrite () == false )
51+
52+ }
0 commit comments