MCPcopy
hub / github.com/ossf/scorecard / TestContributors

Function TestContributors

checks/contributors_test.go:31–200  ·  view source on GitHub ↗

TestContributors tests the contributors check.

(t *testing.T)

Source from the content-addressed store, hash-verified

29
30// TestContributors tests the contributors check.
31func TestContributors(t *testing.T) {
32 t.Parallel()
33 tests := []struct {
34 err error
35 name string
36 contrib []clients.User
37 expectedDetail string
38 expected checker.CheckResult
39 }{
40 {
41 err: nil,
42 name: "Two contributors without company",
43 contrib: []clients.User{
44 {
45 Organizations: []clients.User{
46 {
47 Login: "org1",
48 },
49 {
50 Login: "org2",
51 },
52 },
53 },
54 },
55 expected: checker.CheckResult{
56 Score: 0,
57 },
58 },
59 {
60 err: nil,
61 name: "Valid contributors with enough contributors and companies",
62 contrib: []clients.User{
63 {
64 Companies: []string{"company1"},
65 NumContributions: 10,
66 Organizations: []clients.User{
67 {
68 Login: "org1",
69 },
70 {
71 Login: "org2",
72 },
73 },
74 },
75 {
76 Companies: []string{"company2"},
77 NumContributions: 10,
78 Organizations: []clients.User{
79 {
80 Login: "org1",
81 },
82 {
83 Login: "org2",
84 },
85 },
86 },
87 {
88 Companies: []string{"company3"},

Callers

nothing calls this directly

Calls 5

EXPECTMethod · 0.95
ContributorsFunction · 0.70
RunMethod · 0.65
ListContributorsMethod · 0.65
FlushMethod · 0.65

Tested by

no test coverage detected