func TestList(t *testing.T) {
	namespace := "test-namespace"
	if ns, ok := os.LookupEnv("NAMESPACE"); ok {
		namespace = ns
	}
	testClient, err := client.NewClient(client.ConfigPath(""))
	assert.NoError(t, err)
	pipeline := &PipelineResource{Name: "Foo", Namespace: namespace}
	_, err = pipeline.List(&testClient)
	assert.NoError(t, err)
}
func TestCreate(t *testing.T) {
namespace := "test-namespace"
if ns, ok := os.LookupEnv("NAMESPACE"); ok {
namespace = ns
}
testClient, err := client.NewClient(client.ConfigPath(""))
assert.NoError(t, err)
pipeline := &PipelineResource{Name: "foo-bar", Namespace: namespace}
err = pipeline.Deploy(&testClient)
assert.NoError(t, err)
pipeline = &PipelineResource{Name: "foo-bar", Namespace: namespace}
err = pipeline.Deploy(&testClient)
assert.Error(t, err)
result, err := pipeline.Get(&testClient)
assert.NoError(t, err)
assert.Equal(t, "foo-bar", result.Name)
err = pipeline.Delete(&testClient)
assert.NoError(t, err)
}
package pipelineresource
import (
	"os"
	"testing"
	"github.com/stretchr/testify/assert"
	"github.com/triggermesh/tm/pkg/client"
)