mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-08 03:31:59 +02:00
test: internal/client/github tests
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
parent
5731815e62
commit
9a546a9782
@ -323,3 +323,33 @@ func TestReleaseNotes(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "**Full Changelog**: https://github.com/someone/something/compare/v1.0.0...v1.1.0", log)
|
||||
}
|
||||
|
||||
func TestCloseMilestone(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
t.Log(r.URL.Path)
|
||||
|
||||
if r.URL.Path == "/repos/someone/something/milestones" {
|
||||
r, err := os.Open("testdata/github/milestones.json")
|
||||
require.NoError(t, err)
|
||||
_, err = io.Copy(w, r)
|
||||
require.NoError(t, err)
|
||||
return
|
||||
}
|
||||
}))
|
||||
defer srv.Close()
|
||||
|
||||
ctx := context.New(config.Project{
|
||||
GitHubURLs: config.GitHubURLs{
|
||||
API: srv.URL + "/",
|
||||
},
|
||||
})
|
||||
client, err := NewGitHub(ctx, "test-token")
|
||||
require.NoError(t, err)
|
||||
repo := Repo{
|
||||
Owner: "someone",
|
||||
Name: "something",
|
||||
}
|
||||
|
||||
require.NoError(t, client.CloseMilestone(ctx, repo, "v1.13.0"))
|
||||
}
|
||||
|
1
internal/client/testdata/github/milestones.json
vendored
Normal file
1
internal/client/testdata/github/milestones.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
[{"url":"https://api.github.com/repos/goreleaser/goreleaser/milestones/15","html_url":"https://github.com/goreleaser/goreleaser/milestone/15","labels_url":"https://api.github.com/repos/goreleaser/goreleaser/milestones/15/labels","id":8544910,"node_id":"MI_kwDOBJgEXs4AgmKO","number":15,"title":"v1.13.0","description":"","creator":{"login":"caarlos0","id":245435,"node_id":"MDQ6VXNlcjI0NTQzNQ==","avatar_url":"https://avatars.githubusercontent.com/u/245435?v=4","gravatar_id":"","url":"https://api.github.com/users/caarlos0","html_url":"https://github.com/caarlos0","followers_url":"https://api.github.com/users/caarlos0/followers","following_url":"https://api.github.com/users/caarlos0/following{/other_user}","gists_url":"https://api.github.com/users/caarlos0/gists{/gist_id}","starred_url":"https://api.github.com/users/caarlos0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caarlos0/subscriptions","organizations_url":"https://api.github.com/users/caarlos0/orgs","repos_url":"https://api.github.com/users/caarlos0/repos","events_url":"https://api.github.com/users/caarlos0/events{/privacy}","received_events_url":"https://api.github.com/users/caarlos0/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":69,"state":"open","created_at":"2022-10-15T19:46:55Z","updated_at":"2022-11-18T00:42:55Z","due_on":null,"closed_at":null}]
|
Loading…
Reference in New Issue
Block a user