feat: add platform resource audit baseline
This commit is contained in:
19
backend/api/internal/logic/platform/resource_test.go
Normal file
19
backend/api/internal/logic/platform/resource_test.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package platform
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestExpectedResources(t *testing.T) {
|
||||
assertContract(t, ExpectedResources(), "gas", "gas_basic", Writable, "list")
|
||||
assertContract(t, ExpectedResources(), "device", "saf_event", Writable, "list")
|
||||
assertContract(t, ExpectedResources(), "wallet", "wallet_ledger", ReadOnly, "list")
|
||||
}
|
||||
|
||||
func assertContract(t *testing.T, contracts []ResourceContract, domain, name string, mode ResourceMode, pageKind string) {
|
||||
t.Helper()
|
||||
for _, contract := range contracts {
|
||||
if contract.Domain == domain && contract.Name == name && contract.Mode == mode && contract.PageKind == pageKind {
|
||||
return
|
||||
}
|
||||
}
|
||||
t.Fatalf("missing resource contract %s/%s with mode %q and page kind %q", domain, name, mode, pageKind)
|
||||
}
|
||||
Reference in New Issue
Block a user