Files
podman/pkg/bindings/test/generator_test.go
Valentin Rothberg bd09b7aa79 bump go module to version 4
Automated for .go files via gomove [1]:
`gomove github.com/containers/podman/v3 github.com/containers/podman/v4`

Remaining files via vgrep [2]:
`vgrep github.com/containers/podman/v3`

[1] https://github.com/KSubedi/gomove
[2] https://github.com/vrothberg/vgrep

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-18 12:47:07 +01:00

52 lines
1.3 KiB
Go

package bindings_test
import (
"github.com/containers/podman/v4/pkg/bindings/containers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gstruct"
)
var _ = Describe("Podman API Bindings", func() {
boxedTrue, boxedFalse := new(bool), new(bool)
*boxedTrue = true
*boxedFalse = false
It("verify simple setters", func() {
boxedString := new(string)
*boxedString = "Test"
actual := new(containers.AttachOptions).
WithDetachKeys("Test").WithLogs(true).WithStream(false)
Expect(*actual).To(MatchAllFields(Fields{
"DetachKeys": Equal(boxedString),
"Logs": Equal(boxedTrue),
"Stream": Equal(boxedFalse),
}))
Expect(actual.GetDetachKeys()).To(Equal("Test"))
Expect(actual.GetLogs()).To(Equal(true))
Expect(actual.GetStream()).To(Equal(false))
})
It("verify composite setters", func() {
boxedInt := new(int)
*boxedInt = 50
actual := new(containers.ListOptions).
WithFilters(map[string][]string{"Test": {"Test Filter"}}).
WithLast(50)
Expect(*actual).To(MatchAllFields(Fields{
"All": BeNil(),
"External": BeNil(),
"Filters": HaveKeyWithValue("Test", []string{"Test Filter"}),
"Last": Equal(boxedInt),
"Namespace": BeNil(),
"Size": BeNil(),
"Sync": BeNil(),
}))
})
})