1
0
mirror of https://github.com/containers/image.git synced 2025-04-18 19:44:05 +03:00
image/transports/stub_test.go
Miloslav Trmač 5d6fbfcbc8 Add transports/StubTransport
This is useful primarily so that we can use build tags to remove transports
from transports/alltransports, while giving users more hints about what
to do instead of a bland “unknown transport”.

Tests can also use this instead of their own mocks.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2017-06-19 16:30:58 +02:00

19 lines
411 B
Go

package transports
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestStubTransport(t *testing.T) {
const name = "whatever"
s := NewStubTransport(name)
assert.Equal(t, name, s.Name())
_, err := s.ParseReference("this is rejected regardless of content")
assert.Error(t, err)
err = s.ValidatePolicyConfigurationScope("this is accepted regardless of content")
assert.NoError(t, err)
}