emit metadata in output

[#76848252]

Signed-off-by: Chris Brown <cbrown@pivotal.io>
This commit is contained in:
Alex Suraci
2015-02-18 10:06:04 -08:00
committed by Chris Brown
parent 3dc650adc8
commit c4436c0350
5 changed files with 101 additions and 19 deletions

View File

@@ -55,25 +55,19 @@ var _ = Describe("In Command", func() {
})
buildRelease := func(id int, tag string) github.RepositoryRelease {
url := "http://google.com"
name := "release-name"
body := "*markdown*"
return github.RepositoryRelease{
ID: &id,
TagName: &tag,
HTMLURL: &url,
Name: &name,
Body: &body,
ID: github.Int(id),
TagName: github.String(tag),
HTMLURL: github.String("http://google.com"),
Name: github.String("release-name"),
Body: github.String("*markdown*"),
}
}
buildAsset := func(name string) github.ReleaseAsset {
url := server.URL() + "/" + name
return github.ReleaseAsset{
Name: &name,
BrowserDownloadURL: &url,
BrowserDownloadURL: github.String(server.URL() + "/" + name),
}
}
@@ -158,6 +152,14 @@ var _ = Describe("In Command", func() {
Ω(inResponse.Version).Should(Equal(resource.Version{Tag: "v0.35.0"}))
})
It("has some sweet metadata", func() {
Ω(inResponse.Metadata).Should(ConsistOf(
resource.MetadataPair{Name: "url", Value: "http://google.com"},
resource.MetadataPair{Name: "name", Value: "release-name", URL: "http://google.com"},
resource.MetadataPair{Name: "body", Value: "*markdown*", Markdown: true},
))
})
It("downloads all of the files", func() {
_, err := os.Stat(filepath.Join(destDir, "example.txt"))
Ω(err).ShouldNot(HaveOccurred())
@@ -196,6 +198,14 @@ var _ = Describe("In Command", func() {
Ω(inResponse.Version).Should(Equal(resource.Version{Tag: "v0.35.0"}))
})
It("has some sweet metadata", func() {
Ω(inResponse.Metadata).Should(ConsistOf(
resource.MetadataPair{Name: "url", Value: "http://google.com"},
resource.MetadataPair{Name: "name", Value: "release-name", URL: "http://google.com"},
resource.MetadataPair{Name: "body", Value: "*markdown*", Markdown: true},
))
})
It("fetches from the latest release", func() {
_, err := os.Stat(filepath.Join(destDir, "example.txt"))
Ω(err).ShouldNot(HaveOccurred())