mirror of
https://github.com/goharbor/harbor.git
synced 2025-12-05 04:54:30 +01:00
test:add-filterToPatterns-unit-test (#22511)
Signed-off-by: Anurag Ojha <aojharaj2004@gmail.com>
This commit is contained in:
parent
e9bc2c3047
commit
71bbd5615a
@ -22,7 +22,38 @@ func Test_filterToPatterns(t *testing.T) {
|
||||
wantRepoPattern string
|
||||
wantTagsPattern string
|
||||
}{
|
||||
// TODO: Add test cases.
|
||||
{
|
||||
name: "name and tag filters provided",
|
||||
args: args{
|
||||
filters: []*model.Filter{
|
||||
{Type: model.FilterTypeName, Value: "demo/app"},
|
||||
{Type: model.FilterTypeTag, Value: "v1.*"},
|
||||
},
|
||||
},
|
||||
wantNamespacePattern: "demo",
|
||||
wantRepoPattern: "demo/app",
|
||||
wantTagsPattern: "v1.*",
|
||||
},
|
||||
{
|
||||
name: "only name filter provided",
|
||||
args: args{
|
||||
filters: []*model.Filter{
|
||||
{Type: model.FilterTypeName, Value: "team/project"},
|
||||
},
|
||||
},
|
||||
wantNamespacePattern: "team",
|
||||
wantRepoPattern: "team/project",
|
||||
wantTagsPattern: "",
|
||||
},
|
||||
{
|
||||
name: "empty filters slice",
|
||||
args: args{
|
||||
filters: []*model.Filter{},
|
||||
},
|
||||
wantNamespacePattern: "",
|
||||
wantRepoPattern: "",
|
||||
wantTagsPattern: "",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user