-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:update ApplicationTest and add TestDefaultConfig
- Loading branch information
1 parent
7d049a9
commit cc4f1bc
Showing
2 changed files
with
88 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/test/java/org/casbin/casdoor/support/TestDefaultConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package org.casbin.casdoor.support; | ||
|
||
/* | ||
@author zhangJH | ||
@create 2023-10-12-8:16 | ||
*/ | ||
|
||
|
||
import org.casbin.casdoor.config.CasdoorConfig; | ||
|
||
import java.util.Random; | ||
|
||
/** | ||
* Default Config for casDoor at test | ||
* */ | ||
public class TestDefaultConfig { | ||
|
||
public static String getRandomCode(int length) { | ||
byte[] stdNums = "0123456789".getBytes(); | ||
byte[] result = new byte[length]; | ||
Random r = new Random(System.nanoTime()); | ||
for (int i = 0; i < length; i++) { | ||
result[i] = stdNums[r.nextInt(stdNums.length)]; | ||
} | ||
return new String(result); | ||
} | ||
|
||
public static String getRandomName(String prefix) { | ||
return prefix + "_" + getRandomCode(6); | ||
} | ||
private static final String TEST_CASDOOR_ENDPOINT = "https://demo.casdoor.com"; | ||
private static final String TEST_CLIENT_ID = "294b09fbc17f95daf2fe"; | ||
private static final String TEST_CLIENT_SECRET = "dd8982f7046ccba1bbd7851d5c1ece4e52bf039d"; | ||
private static final String TEST_CASDOOR_ORGANIZATION = "casbin"; | ||
private static final String TEST_CASDOOR_APPLICATION = "app-vue-python-example"; | ||
private static final String TEST_CASDOOR_CERTIFICATE = | ||
"MIIE+TCCAuGgAwIBAgIDAeJ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Kb0\n" + | ||
"wn8CAwEAAaMQMA4wDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQsFAAOCAgEAn2lf\n" + | ||
"DKkLX+F1vKRO/5gJ+Plr8P5NKuQkmwH97b8CS2gS1phDyNgIc4/LSdzuf4Awe6ve\n" + | ||
"C06lVdWSIis8UPUPdjmT2uMPSNjwLxG3QsrimMURNwFlLTfRem/heJe0Zgur9J1M\n" + | ||
"8haawdSdJjH2RgmFoDeE2r8NVRfhbR8KnCO1ddTJKuS1N0/irHz21W4jt4rxzCvl\n" + | ||
"2nR42Fybap3O/g2JXMhNNROwZmNjgpsF7XVENCSuFO1jTywLaqjuXCg54IL7XVLG\n" + | ||
"omKNNNcc8h1FCeKj/nnbGMhodnFWKDTsJcbNmcOPNHo6ixzqMy/Hqc+mWYv7maAG\n" + | ||
"Jtevs3qgMZ8F9Qzr3HpUc6R3ZYYWDY/xxPisuKftOPZgtH979XC4mdf0WPnOBLqL\n" + | ||
"2DJ1zaBmjiGJolvb7XNVKcUfDXYw85ZTZQ5b9clI4e+6bmyWqQItlwt+Ati/uFEV\n" + | ||
"XzCj70B4lALX6xau1kLEpV9O1GERizYRz5P9NJNA7KoO5AVMp9w0DQTkt+LbXnZE\n" + | ||
"HHnWKy8xHQKZF9sR7YBPGLs/Ac6tviv5Ua15OgJ/8dLRZ/veyFfGo2yZsI+hKVU5\n" + | ||
"nCCJHBcAyFnm1hdvdwEdH33jDBjNB6ciotJZrf/3VYaIWSalADosHAgMWfXuWP+h\n" + | ||
"8XKXmzlxuHbTMQYtZPDgspS5aK+S4Q9wb8RRAYo="; | ||
|
||
public static CasdoorConfig InitConfig() { | ||
return new CasdoorConfig(TEST_CASDOOR_ENDPOINT, TEST_CLIENT_ID, TEST_CLIENT_SECRET, TEST_CASDOOR_CERTIFICATE, TEST_CASDOOR_ORGANIZATION, TEST_CASDOOR_APPLICATION); | ||
|
||
} | ||
} |