summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/images/trust_show.go2
-rw-r--r--test/e2e/trust_test.go22
2 files changed, 23 insertions, 1 deletions
diff --git a/cmd/podman/images/trust_show.go b/cmd/podman/images/trust_show.go
index d968f6d80..d1f85d34d 100644
--- a/cmd/podman/images/trust_show.go
+++ b/cmd/podman/images/trust_show.go
@@ -49,7 +49,7 @@ func showTrust(cmd *cobra.Command, args []string) error {
return err
}
if showTrustOptions.Raw {
- fmt.Println(report.Raw)
+ fmt.Println(string(report.Raw))
return nil
}
if showTrustOptions.JSON {
diff --git a/test/e2e/trust_test.go b/test/e2e/trust_test.go
index 82b0f9f26..987023e4c 100644
--- a/test/e2e/trust_test.go
+++ b/test/e2e/trust_test.go
@@ -74,4 +74,26 @@ var _ = Describe("Podman trust", func() {
}
Expect(teststruct["default"][0]["type"]).To(Equal("insecureAcceptAnything"))
})
+
+ It("podman image trust show --json", func() {
+ session := podmanTest.Podman([]string{"image", "trust", "show", "--json"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.IsJSONOutputValid()).To(BeTrue())
+ var teststruct []map[string]string
+ json.Unmarshal(session.Out.Contents(), &teststruct)
+ Expect(teststruct[0]["name"]).To(Equal("* (default)"))
+ Expect(teststruct[0]["repo_name"]).To(Equal("default"))
+ Expect(teststruct[0]["type"]).To(Equal("accept"))
+ Expect(teststruct[1]["type"]).To(Equal("insecureAcceptAnything"))
+ })
+
+ It("podman image trust show --raw", func() {
+ session := podmanTest.Podman([]string{"image", "trust", "show", "--raw"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.IsJSONOutputValid()).To(BeTrue())
+ Expect(session.OutputToString()).To(ContainSubstring("default"))
+ Expect(session.OutputToString()).To(ContainSubstring("insecureAcceptAnything"))
+ })
})