github.com/jfrog/jfrog-cli-core/v2@v2.51.0/artifactory/commands/oc/startbuild_test.go (about) 1 package oc 2 3 import ( 4 "github.com/stretchr/testify/assert" 5 "testing" 6 ) 7 8 func TestValidateAllowedOptions(t *testing.T) { 9 ocStartBuildCmd := NewOcStartBuildCommand() 10 11 testCases := []struct { 12 args []string 13 valid bool 14 }{ 15 {[]string{}, true}, 16 {[]string{"-F"}, true}, 17 {[]string{"-w"}, false}, 18 {[]string{"--wait", "false"}, false}, 19 {[]string{"-F", "--template={{.name}}", "-o='json'"}, false}, 20 {[]string{"repo", "-o='json'"}, false}, 21 {[]string{"--output=json", "-F"}, false}, 22 } 23 24 for _, testCase := range testCases { 25 ocStartBuildCmd = ocStartBuildCmd.SetOcArgs(testCase.args) 26 err := ocStartBuildCmd.validateAllowedOptions() 27 assert.Equal(t, testCase.valid, err == nil, "Test args:", testCase.args) 28 } 29 }