test(education): verify collection permission seeds

This commit is contained in:
2026-07-31 04:53:37 +08:00
parent de7fe04c0c
commit 10a4e087ea

View File

@@ -868,6 +868,23 @@ class EducationFlywayMigrationIntegrationTest {
.hasMessageContaining("Education Question Placement RBAC seed ID conflicts");
}
@Test
void shouldProvisionAndProtectCollectionPermissions() throws SQLException {
String schema = createSchema("collection_permissions");
configureFlyway(schema, false).target("4100").load().migrate();
createSystemMenuFixture(schema);
configureFlyway(schema, false).load().migrate();
assertThat(queryStrings(schema, "SELECT permission FROM system_menu WHERE id BETWEEN 6806 AND 6808 ORDER BY id"))
.containsExactly("education:collection:author", "education:collection:publish", "education:collection:archive");
String conflictSchema = createSchema("collection_permission_conflict");
configureFlyway(conflictSchema, false).target("4100").load().migrate();
createSystemMenuFixture(conflictSchema);
execute(conflictSchema, "INSERT INTO system_menu(id,name,permission,type,sort,parent_id,status,deleted) VALUES(6806,'Conflict','education:collection:other',3,6,6800,0,0)");
assertThatThrownBy(() -> configureFlyway(conflictSchema, false).load().migrate())
.hasMessageContaining("Education collection RBAC seed IDs conflict");
}
@Test
void shouldAttachGraphGuardToEveryCatalogReference() throws SQLException {
String schema = createSchema("catalog_triggers");