mirror of
https://github.com/containers/podman.git
synced 2025-06-20 17:13:43 +08:00
e2e tests: more cleanup of BeTrue()s
Write a BeValidJSON() matcher, and replace IsJSONOutputValid(): sed -i -e 's/Expect(\(.*\)\.IsJSONOutputValid()).To(BeTrue())/Expect(\1.OutputToString())\.To(BeValidJSON())/' test/e2e/*_test.go (Plus a few manual tweaks) Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@ -76,7 +76,7 @@ var _ = Describe("Podman trust", func() {
|
||||
session := podmanTest.Podman([]string{"image", "trust", "show", "--registrypath", filepath.Join(INTEGRATION_ROOT, "test"), "--policypath", filepath.Join(INTEGRATION_ROOT, "test/policy.json"), "--json"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session.IsJSONOutputValid()).To(BeTrue())
|
||||
Expect(session.OutputToString()).To(BeValidJSON())
|
||||
var teststruct []map[string]string
|
||||
json.Unmarshal(session.Out.Contents(), &teststruct)
|
||||
Expect(len(teststruct)).To(Equal(3))
|
||||
@ -118,7 +118,7 @@ var _ = Describe("Podman trust", func() {
|
||||
Expect(session).Should(Exit(0))
|
||||
contents, err := ioutil.ReadFile(filepath.Join(INTEGRATION_ROOT, "test/policy.json"))
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
Expect(session.IsJSONOutputValid()).To(BeTrue())
|
||||
Expect(session.OutputToString()).To(BeValidJSON())
|
||||
Expect(string(session.Out.Contents())).To(Equal(string(contents) + "\n"))
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user