Skip to content

Commit

Permalink
Merge pull request containers#8029 from Luap99/image-trust-show-raw
Browse files Browse the repository at this point in the history
Fix podman image trust show --raw output
  • Loading branch information
openshift-merge-robot authored Oct 16, 2020
2 parents c3ecdd0 + a261819 commit fe1b6cc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/podman/images/trust_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
22 changes: 22 additions & 0 deletions test/e2e/trust_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
})
})

0 comments on commit fe1b6cc

Please sign in to comment.