mirror of
https://github.com/hashicorp/vault.git
synced 2026-06-27 18:10:26 -04:00
Upgrade `cloudflare/circl` to v1.6.3 to resolve CVE-2026-1229. We had several transient dependencies that depend on various versions of `circl` that also needed to be updated in order to resolve the latest version everywhere. - github.com/ProtonMail/go-crypto v1.2.0 => v1.3.0 - github.com/google/go-github v17 => v83/v83.0.0 - github.com/google/go-github/v81 => v83/v83.0.0 Signed-off-by: Ryan Cragun <me@ryan.ec> Co-authored-by: Ryan Cragun <me@ryan.ec>
86 lines
2.6 KiB
Go
86 lines
2.6 KiB
Go
// Copyright IBM Corp. 2016, 2025
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package github
|
|
|
|
import (
|
|
"testing"
|
|
|
|
libgithub "github.com/google/go-github/v83/github"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func Test_CopyPullRequest_getCoAuthoredByTrailers(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
for name, test := range map[string]struct {
|
|
commits []*libgithub.RepositoryCommit
|
|
expected []string
|
|
}{
|
|
"no commits": {
|
|
nil,
|
|
nil,
|
|
},
|
|
"one author one commit": {
|
|
[]*libgithub.RepositoryCommit{
|
|
{Commit: &libgithub.Commit{Author: &libgithub.CommitAuthor{
|
|
Name: libgithub.Ptr("John Doe"),
|
|
Email: libgithub.Ptr("john@example.com"),
|
|
}}},
|
|
},
|
|
[]string{"Co-Authored-By: John Doe <john@example.com>"},
|
|
},
|
|
"one author multiple commits": {
|
|
[]*libgithub.RepositoryCommit{
|
|
{Commit: &libgithub.Commit{Author: &libgithub.CommitAuthor{
|
|
Name: libgithub.Ptr("John Doe"),
|
|
Email: libgithub.Ptr("john@example.com"),
|
|
}}},
|
|
{Commit: &libgithub.Commit{Author: &libgithub.CommitAuthor{
|
|
Name: libgithub.Ptr("John Doe"),
|
|
Email: libgithub.Ptr("john@example.com"),
|
|
}}},
|
|
},
|
|
[]string{"Co-Authored-By: John Doe <john@example.com>"},
|
|
},
|
|
"multiple authors with one commit each": {
|
|
[]*libgithub.RepositoryCommit{
|
|
{Commit: &libgithub.Commit{Author: &libgithub.CommitAuthor{
|
|
Name: libgithub.Ptr("John Doe"),
|
|
Email: libgithub.Ptr("john@example.com"),
|
|
}}},
|
|
{Commit: &libgithub.Commit{Author: &libgithub.CommitAuthor{
|
|
Name: libgithub.Ptr("Jane Doe"),
|
|
Email: libgithub.Ptr("jane@example.com"),
|
|
}}},
|
|
},
|
|
[]string{"Co-Authored-By: John Doe <john@example.com>", "Co-Authored-By: Jane Doe <jane@example.com>"},
|
|
},
|
|
"multiple authors with multiple commits": {
|
|
[]*libgithub.RepositoryCommit{
|
|
{Commit: &libgithub.Commit{Author: &libgithub.CommitAuthor{
|
|
Name: libgithub.Ptr("John Doe"),
|
|
Email: libgithub.Ptr("john@example.com"),
|
|
}}},
|
|
{Commit: &libgithub.Commit{Author: &libgithub.CommitAuthor{
|
|
Name: libgithub.Ptr("Jane Doe"),
|
|
Email: libgithub.Ptr("jane@example.com"),
|
|
}}},
|
|
{Commit: &libgithub.Commit{Author: &libgithub.CommitAuthor{
|
|
Name: libgithub.Ptr("Jane Doe"),
|
|
Email: libgithub.Ptr("jane@example.com"),
|
|
}}},
|
|
{Commit: &libgithub.Commit{Author: &libgithub.CommitAuthor{
|
|
Name: libgithub.Ptr("John Doe"),
|
|
Email: libgithub.Ptr("john@example.com"),
|
|
}}},
|
|
},
|
|
[]string{"Co-Authored-By: John Doe <john@example.com>", "Co-Authored-By: Jane Doe <jane@example.com>"},
|
|
},
|
|
} {
|
|
t.Run(name, func(t *testing.T) {
|
|
req := &CopyPullRequestReq{}
|
|
require.EqualValues(t, test.expected, req.getCoAuthoredByTrailers(test.commits))
|
|
})
|
|
}
|
|
}
|