snapshot of https://github.com/cortezaproject/corteza.git (2024.9.x, 2026-09-18; blobs > 131072B omitted)
Some checks failed
SonarQube / SonarQube (push) Failing after 5m28s
E2e test on main branch push / server and client test (map[name:admin port:8080]) (push) Failing after 3m33s
Server and lib tests / Library test (js) (push) Failing after 1m36s
Server and lib tests / Library test (vue) (push) Successful in 2m24s
Server and lib tests / Web client test (admin) (push) Successful in 2m52s
Server and lib tests / Web client test (compose) (push) Successful in 3m23s
Server and lib tests / Web client test (discovery) (push) Successful in 2m49s
Server and lib tests / Web client test (one) (push) Successful in 2m52s
Server and lib tests / Web client test (privacy) (push) Successful in 2m44s
Server and lib tests / Web client test (reporter) (push) Successful in 2m56s
Server and lib tests / Web client test (workflow) (push) Successful in 3m0s
Server and lib tests / Server tests (push) Failing after 4m55s
E2e test on main branch push / notify-failure (push) Failing after 9s
Server and lib tests / Send matrix testing notification (push) Successful in 2s
Mark stale issues and pull requests / stale (push) Successful in 40s
Some checks failed
SonarQube / SonarQube (push) Failing after 5m28s
E2e test on main branch push / server and client test (map[name:admin port:8080]) (push) Failing after 3m33s
Server and lib tests / Library test (js) (push) Failing after 1m36s
Server and lib tests / Library test (vue) (push) Successful in 2m24s
Server and lib tests / Web client test (admin) (push) Successful in 2m52s
Server and lib tests / Web client test (compose) (push) Successful in 3m23s
Server and lib tests / Web client test (discovery) (push) Successful in 2m49s
Server and lib tests / Web client test (one) (push) Successful in 2m52s
Server and lib tests / Web client test (privacy) (push) Successful in 2m44s
Server and lib tests / Web client test (reporter) (push) Successful in 2m56s
Server and lib tests / Web client test (workflow) (push) Successful in 3m0s
Server and lib tests / Server tests (push) Failing after 4m55s
E2e test on main branch push / notify-failure (push) Failing after 9s
Server and lib tests / Send matrix testing notification (push) Successful in 2s
Mark stale issues and pull requests / stale (push) Successful in 40s
This commit is contained in:
107
server/compose/service/access_control.gen_test.go
generated
Normal file
107
server/compose/service/access_control.gen_test.go
generated
Normal file
@@ -0,0 +1,107 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/cortezaproject/corteza/server/compose/types"
|
||||
"github.com/cortezaproject/corteza/server/pkg/rbac"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestAccessControl_ResourceLoader(t *testing.T) {
|
||||
svc := accessControl{}
|
||||
|
||||
// Has wildcard resources
|
||||
testCases := []struct {
|
||||
resource string
|
||||
expected rbac.Resource
|
||||
err error
|
||||
}{
|
||||
{
|
||||
resource: "corteza::compose:chart/1/*",
|
||||
expected: rbac.NewResource(types.ChartRbacResource(1, 0)),
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
resource: "corteza::compose:chart/*/*",
|
||||
expected: rbac.NewResource(types.ChartRbacResource(0, 0)),
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
resource: "corteza::compose:module/3/*",
|
||||
expected: rbac.NewResource(types.ModuleRbacResource(3, 0)),
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
resource: "corteza::compose:module/*/*",
|
||||
expected: rbac.NewResource(types.ModuleRbacResource(0, 0)),
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
resource: "corteza::compose:module-field/5/*/*",
|
||||
expected: rbac.NewResource(types.ModuleFieldRbacResource(5, 0, 0)),
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
resource: "corteza::compose:module-field/*/*/*",
|
||||
expected: rbac.NewResource(types.ModuleFieldRbacResource(0, 0, 0)),
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
resource: "corteza::compose:namespace/*",
|
||||
expected: rbac.NewResource(types.NamespaceRbacResource(0)),
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
resource: "corteza::compose:page/9/*",
|
||||
expected: rbac.NewResource(types.PageRbacResource(9, 0)),
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
resource: "corteza::compose:page/*/*",
|
||||
expected: rbac.NewResource(types.PageRbacResource(0, 0)),
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
resource: "corteza::compose:page-layout/11/*/*",
|
||||
expected: rbac.NewResource(types.PageLayoutRbacResource(11, 0, 0)),
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
resource: "corteza::compose:page-layout/*/*/*",
|
||||
expected: rbac.NewResource(types.PageLayoutRbacResource(0, 0, 0)),
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
resource: "corteza::compose:record/14/*/*",
|
||||
expected: rbac.NewResource(types.RecordRbacResource(14, 0, 0)),
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
resource: "corteza::compose:record/*/*/*",
|
||||
expected: rbac.NewResource(types.RecordRbacResource(0, 0, 0)),
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
resource: "corteza::compose",
|
||||
expected: &types.Component{},
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
resource: "unknown_resource_type:17",
|
||||
expected: nil,
|
||||
err: fmt.Errorf("unknown resource type %q", "unknown_resource_type:17"),
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.resource, func(t *testing.T) {
|
||||
res, err := svc.resourceLoader(context.Background(), tc.resource)
|
||||
|
||||
require.Equal(t, tc.expected, res)
|
||||
require.Equal(t, tc.err, err)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user