feat(firstleg): implement container customs workflow
This commit is contained in:
+70
@@ -0,0 +1,70 @@
|
||||
package com.baiyue.iam.repository;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class ContainerCustomsPermissionSqlContractTest {
|
||||
|
||||
@Test
|
||||
void registersOnlyTheFinalPlatformPermissionsAndDefaultRoles() throws Exception {
|
||||
String sql = sql();
|
||||
|
||||
assertThat(sql).contains(
|
||||
"5102170",
|
||||
"5102172",
|
||||
"platform:firstleg:customs:list",
|
||||
"platform:firstleg:customs:manage",
|
||||
"'/first-leg/customs'",
|
||||
"role.role_code IN ('PLATFORM_ADMIN', 'ORDER_OPERATOR')",
|
||||
"ON DUPLICATE KEY UPDATE",
|
||||
"INSERT IGNORE INTO iam_role_permission",
|
||||
"guard_phase3_container_customs_permission_ids",
|
||||
"assert_phase3_container_customs_permissions",
|
||||
"SIGNAL SQLSTATE '45000'"
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void removesLegacyCaseAndLoadingListExportPermissionsWithoutAliases() throws Exception {
|
||||
String sql = sql();
|
||||
|
||||
assertThat(sql).contains(
|
||||
"DELETE role_permission",
|
||||
"DELETE FROM iam_permission",
|
||||
"'platform:firstleg:customs:view'",
|
||||
"'platform:firstleg:customs:review'",
|
||||
"'platform:firstleg:customs:submit'",
|
||||
"'platform:firstleg:customs:receipt'",
|
||||
"'platform:firstleg:loading-list:export'"
|
||||
);
|
||||
assertThat(sql).doesNotContain(
|
||||
"hasAnyAuthority",
|
||||
"merchant:customs",
|
||||
"platform:firstleg:customs:cases"
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void reusesOrderPermissionsForMerchantTaxRefundDocuments() throws Exception {
|
||||
String sql = sql();
|
||||
|
||||
assertThat(sql).contains(
|
||||
"merchant:order:view/edit",
|
||||
"买单无客户入口"
|
||||
);
|
||||
assertThat(sql).doesNotContain(
|
||||
"'merchant:order:view'",
|
||||
"'merchant:order:edit'",
|
||||
"'MERCHANT'"
|
||||
);
|
||||
}
|
||||
|
||||
private String sql() throws Exception {
|
||||
return new ClassPathResource("db/phase3-container-customs-permissions.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user