Add possiblity to limit actions to tagged or named repository

This commit is contained in:
Mikołaj Pęczkowski 2021-11-07 14:05:45 +01:00
parent 5c98ab6554
commit 23e4547e52
11 changed files with 345 additions and 24 deletions

View file

@ -39,6 +39,22 @@ func TestParsingDefaultArguments(t *testing.T) {
func TestParsingWithoutCommand(t *testing.T) {
// First item in os.Args is appPath, this have to be mocked
fakeOSArgs := []string{"appName", "--name", "test"}
results, err := ParseCliArguments("", "", fakeOSArgs)
if err == nil {
t.Errorf("Expected error, not results: %v", results)
}
if err.Error() != errNoCommand {
t.Errorf("Expected to get \"%v\", instead of this got \"%v\"", errNoCommand, err.Error())
}
}
func TestParsingNothingProvided(t *testing.T) {
// First item in os.Args is appPath, this have to be mocked
fakeOSArgs := []string{"appName"}
@ -49,3 +65,19 @@ func TestParsingWithoutCommand(t *testing.T) {
}
}
func TestParsingNameAndTags(t *testing.T) {
// First item in os.Args is appPath, this have to be mocked
fakeOSArgs := []string{"appName", "status", "--tag", "example", "--name", "example"}
results, err := ParseCliArguments("", "", fakeOSArgs)
if err == nil {
t.Errorf("Expected error, not results: %v", results)
}
if err.Error() != errNameAndTagsTogether {
t.Errorf("Expected to get \"%v\", instead of this got \"%v\"", errNameAndTagsTogether, err.Error())
}
}