create_test.go 820 B

12345678910111213141516171819202122232425262728293031323334
  1. package context
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/docker/api/context/store"
  6. _ "github.com/docker/api/example"
  7. "github.com/docker/api/tests/framework"
  8. . "github.com/onsi/gomega"
  9. "github.com/stretchr/testify/suite"
  10. )
  11. type PsSuite struct {
  12. framework.CliSuite
  13. }
  14. func (sut *PsSuite) TestCreateContextDataMoby() {
  15. data, description, err := getContextData(context.TODO(), "moby", AciCreateOpts{})
  16. Expect(err).To(BeNil())
  17. Expect(data).To(Equal(store.MobyContext{}))
  18. Expect(description).To(Equal(""))
  19. }
  20. func (sut *PsSuite) TestErrorOnUnknownContextType() {
  21. _, _, err := getContextData(context.TODO(), "foo", AciCreateOpts{})
  22. Expect(err).To(MatchError("incorrect context type foo, must be one of (aci | moby | docker)"))
  23. }
  24. func TestPs(t *testing.T) {
  25. RegisterTestingT(t)
  26. suite.Run(t, new(PsSuite))
  27. }