Add possiblity to limit actions to tagged or named repository
This commit is contained in:
parent
5c98ab6554
commit
23e4547e52
11 changed files with 345 additions and 24 deletions
|
|
@ -1,6 +1,11 @@
|
|||
package app
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"gitlab.com/revalus/grm/config"
|
||||
)
|
||||
|
||||
func TestGetFileExtension(t *testing.T) {
|
||||
|
||||
|
|
@ -32,5 +37,49 @@ func TestErrorInGetExcensionFile(t *testing.T) {
|
|||
if err == nil {
|
||||
t.Errorf("Expected to get error, instead of this got result %v", result)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestIsItemInSlice(t *testing.T) {
|
||||
testedSlice := []string{"1", "2", "3", "4", "5"}
|
||||
|
||||
result := checkIsItemInSlice("0", testedSlice)
|
||||
if result {
|
||||
t.Error("Expected to get false as result")
|
||||
}
|
||||
|
||||
result = checkIsItemInSlice("1", testedSlice)
|
||||
if !result {
|
||||
t.Error("Expected to get true as result")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsAnyInSlice(t *testing.T) {
|
||||
testedSlice := []string{"1", "2", "3", "4", "5"}
|
||||
|
||||
result := checkAnyOfItemInSlice([]string{"0", "10"}, testedSlice)
|
||||
if result {
|
||||
t.Error("Expected to get false as result")
|
||||
}
|
||||
|
||||
result = checkAnyOfItemInSlice([]string{"0", "5"}, testedSlice)
|
||||
if !result {
|
||||
t.Error("Expected to get true as result")
|
||||
}
|
||||
}
|
||||
|
||||
func TestReverseStringsSlice(t *testing.T) {
|
||||
testedSlice := []config.RepositoryConfig{
|
||||
{Name: "test1"},
|
||||
{Name: "test2"},
|
||||
{Name: "test3"},
|
||||
}
|
||||
expectedResult := []config.RepositoryConfig{
|
||||
{Name: "test3"},
|
||||
{Name: "test2"},
|
||||
{Name: "test1"},
|
||||
}
|
||||
result := reverseRepositoryConfigs(testedSlice)
|
||||
if !reflect.DeepEqual(result, expectedResult) {
|
||||
t.Errorf("Expected to get \"%#v\", instead of this got \"%#v\"", expectedResult, result)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue