-
Notifications
You must be signed in to change notification settings - Fork 2
/
pistis_test.go
56 lines (40 loc) · 3.6 KB
/
pistis_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestGetCodeOwnerFingerprints(t *testing.T) {
result, err := fileToStrMap("test_fixtures/CODEOWNERS_FINGERPRINTS")
assert.Nil(t, err)
assert.NotNil(t, result)
email := "[email protected]"
fingerprint := "9cf35828cec50de0294e04a1c645433b1e5e7a65"
assert.Contains(t, result, email)
value, ok := result[email]
assert.True(t, ok)
assert.Equal(t, value, fingerprint)
}
func TestGetCodeOwnerUsernames(t *testing.T) {
result, err := fileToStrMap("test_fixtures/CODEOWNERS_USERNAMES")
assert.Nil(t, err)
assert.NotNil(t, result)
email := "[email protected]"
username := "crameleon"
assert.Contains(t, result, email)
value, ok := result[email]
assert.True(t, ok)
assert.Equal(t, value, username)
}
func TestGetExclusions(t *testing.T) {
result, err := fileToStrLines("test_fixtures/UNTRUSTED_COMMITS")
assert.Nil(t, err)
assert.NotNil(t, result)
assert.Contains(t, result, "5ea8af38993138b5164451434b453ad9fd3993bd")
}
/* not static
func TestBuildKeyring(t *testing.T) {
result := buildKeyring("test_fixtures/CODEOWNERS_USERNAMES", "https://gitlab.suse.de")
assert.NotNil(t, result)
assert.Contains(t, result, "-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: GopenPGP 2.8.0\nComment: https://gopenpgp.org\n\nxjMEYjjrdhYJKwYBBAHaRw8BAQdA2a6xdQeqXgqaZQqecJRAaFzzW/einDHKZPv1\n7A+ZncjNLkdlb3JnIFBmdWV0emVucmV1dGVyIDxncGZ1ZXR6ZW5yZXV0ZXJAc3Vz\nZS5kZT7CkwQTFgoAOxYhBJzzWCjOxQ3gKU4EocZFQzseXnplBQJi5DKZAhsBBQ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