Skip to content

Commit

Permalink
KAIZEN: Improve api/v1 coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanilves committed Apr 10, 2018
1 parent 2755579 commit 68f3977
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions api/v1/v1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package v1

import (
"fmt"
log "github.com/sirupsen/logrus"
"testing"

"github.com/stretchr/testify/assert"

"github.com/ivanilves/lstags/api/registry"
"github.com/ivanilves/lstags/repository"
)

func runEnd2EndJob(pullRefs, seedRefs []string) ([]string, error) {
Expand Down Expand Up @@ -128,3 +130,31 @@ func TestEnd2End(t *testing.T) {
assert.Equal(testCase.expectedPushRefs, pushRefs, fmt.Sprintf("%+v", testCase))
}
}

func TestNew_VerboseLogging(t *testing.T) {
assert := assert.New(t)

New(Config{VerboseLogging: true})

assert.Equal(log.DebugLevel, log.GetLevel())
}

func TestNew_InsecureRegistryEx(t *testing.T) {
const ex = ".*"

assert := assert.New(t)

New(Config{InsecureRegistryEx: ex})

assert.Equal(ex, repository.InsecureRegistryEx)
}

func TestNew_InvalidDockerJSONConfigFile(t *testing.T) {
assert := assert.New(t)

api, err := New(Config{DockerJSONConfigFile: "/i/do/not/exist/sorry"})

assert.Nil(api)

assert.NotNil(err)
}

0 comments on commit 68f3977

Please sign in to comment.