Source configuration uses owner instead of user

"Owner" is the name GitHub uses in its API to reference the owner of a
repository. "User" is not correct when the owner is an organization.

This removes some confusion I've encountered over how to configure the
resource while maintaining backwards compatibility.
This commit is contained in:
Kris Hicks
2017-04-10 08:52:27 -07:00
parent 7c5e8c7b3c
commit 3b050c148c
4 changed files with 50 additions and 21 deletions

View File

@@ -55,7 +55,7 @@ var _ = Describe("GitHub Client", func() {
Context("with an OAuth Token", func() {
BeforeEach(func() {
source = Source{
User: "concourse",
Owner: "concourse",
Repository: "concourse",
AccessToken: "abc123",
}
@@ -78,7 +78,7 @@ var _ = Describe("GitHub Client", func() {
Context("without an OAuth Token", func() {
BeforeEach(func() {
source = Source{
User: "concourse",
Owner: "concourse",
Repository: "concourse",
}
@@ -97,10 +97,31 @@ var _ = Describe("GitHub Client", func() {
})
})
Describe("when the source is configured with the deprecated user field", func() {
BeforeEach(func() {
source = Source{
User: "some-owner",
Repository: "some-repo",
}
server.AppendHandlers(
ghttp.CombineHandlers(
ghttp.VerifyRequest("GET", "/repos/some-owner/some-repo/releases"),
ghttp.RespondWith(200, "[]"),
),
)
})
It("uses the provided user as the owner", func() {
_, err := client.ListReleases()
Ω(err).ShouldNot(HaveOccurred())
})
})
Describe("GetRelease", func() {
BeforeEach(func() {
source = Source{
User: "concourse",
Owner: "concourse",
Repository: "concourse",
}
})
@@ -136,7 +157,7 @@ var _ = Describe("GitHub Client", func() {
Describe("GetReleaseByTag", func() {
BeforeEach(func() {
source = Source{
User: "concourse",
Owner: "concourse",
Repository: "concourse",
}
})