优化
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package com.baiyue.iam.repository;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class InitialIdentitySeedSqlContractTest {
|
||||
@Test
|
||||
void initializesPlatformAndItTestCustomerIdentitiesWithStableIds() throws Exception {
|
||||
assertIdentitySeed(new ClassPathResource("db/phase1-admin-rbac.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8));
|
||||
assertIdentitySeed(Files.readString(unifiedSql(), StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
private static void assertIdentitySeed(String sql) {
|
||||
assertThat(sql)
|
||||
.contains("(0, 'PLATFORM', '虫虫出海平台'")
|
||||
.contains("(10001, 'IT_TEST', 'IT 测试客户'")
|
||||
.contains("(2000001, 1000001, 'INTERNAL', '平台系统管理员'")
|
||||
.contains("(2000002, 1000002, 'ENTERPRISE', 'IT 测试客户管理员'")
|
||||
.contains("(3000001, 0, 2000001, 'EMPLOYEE'")
|
||||
.contains("(3000002, 10001, 2000002, 'OWNER'")
|
||||
.contains("tenant_code = VALUES(tenant_code)")
|
||||
.doesNotContain("PHASE1_DEMO")
|
||||
.doesNotContain("一期演示企业");
|
||||
}
|
||||
|
||||
private static Path unifiedSql() {
|
||||
Path path = Path.of("deploy", "sql", "头程数据库统一增量-MySQL8.sql");
|
||||
return Files.exists(path) ? path : Path.of("..", "deploy", "sql", "头程数据库统一增量-MySQL8.sql");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user