mirror of
https://github.com/containers/podman.git
synced 2025-06-23 02:18:13 +08:00
Merge pull request #8029 from Luap99/image-trust-show-raw
Fix podman image trust show --raw output
This commit is contained in:
@ -49,7 +49,7 @@ func showTrust(cmd *cobra.Command, args []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if showTrustOptions.Raw {
|
if showTrustOptions.Raw {
|
||||||
fmt.Println(report.Raw)
|
fmt.Println(string(report.Raw))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if showTrustOptions.JSON {
|
if showTrustOptions.JSON {
|
||||||
|
@ -74,4 +74,26 @@ var _ = Describe("Podman trust", func() {
|
|||||||
}
|
}
|
||||||
Expect(teststruct["default"][0]["type"]).To(Equal("insecureAcceptAnything"))
|
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"))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user