forked from TrueCloudLab/frostfs-node
[#937] ape: Validate chain resource name
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
e3573de6db
commit
483a67b170
6 changed files with 259 additions and 18 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"encoding/hex"
|
||||
"testing"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/ape"
|
||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
|
||||
"github.com/spf13/viper"
|
||||
|
@ -95,7 +96,7 @@ func TestNamespaceRegexp(t *testing.T) {
|
|||
},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
require.Equal(t, tc.matched, frostfsidNamespaceNameRegexp.MatchString(tc.namespace))
|
||||
require.Equal(t, tc.matched, ape.NamespaceNameRegexp.MatchString(tc.namespace))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +129,7 @@ func TestSubjectNameRegexp(t *testing.T) {
|
|||
},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
require.Equal(t, tc.matched, frostfsidSubjectNameRegexp.MatchString(tc.subject))
|
||||
require.Equal(t, tc.matched, ape.SubjectNameRegexp.MatchString(tc.subject))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +167,7 @@ func TestSubjectGroupRegexp(t *testing.T) {
|
|||
},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
require.Equal(t, tc.matched, frostfsidGroupNameRegexp.MatchString(tc.subject))
|
||||
require.Equal(t, tc.matched, ape.GroupNameRegexp.MatchString(tc.subject))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue