-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
signatures_test.go
71 lines (58 loc) · 1.62 KB
/
signatures_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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package cobblerclient
import (
"testing"
)
func TestGetSignatures(t *testing.T) {
c := createStubHTTPClientSingle(t, "get-signatures")
result, err := c.GetSignatures()
FailOnError(t, err)
if result.Breeds["redhat"]["rhel4"].VersionFile != `(redhat|sl|centos)-release-4(AS|WS|ES)[\.-]+(.*)\.rpm` {
t.Fatalf("Expected a different regex!")
}
}
func TestGetValidBreeds(t *testing.T) {
c := createStubHTTPClientSingle(t, "get-valid-breeds")
res, err := c.GetValidBreeds()
FailOnError(t, err)
if len(res) <= 1 {
t.Fatalf("Expected a length of greater then one.")
}
}
func TestGetValidOsVersionsForBreed(t *testing.T) {
c := createStubHTTPClientSingle(
t,
"get-valid-os-verions-for-breed",
)
res, err := c.GetValidOsVersionsForBreed("redhat")
FailOnError(t, err)
if len(res) <= 1 {
t.Fatalf("Expected a length of greater then one.")
}
}
func TestGetValidOsVersions(t *testing.T) {
c := createStubHTTPClientSingle(t, "get-valid-os-versions")
res, err := c.GetValidOsVersions()
FailOnError(t, err)
if len(res) <= 1 {
t.Fatalf("Expected a length of greater then one.")
}
}
func TestGetValidArchs(t *testing.T) {
c := createStubHTTPClientSingle(t, "get-valid-archs")
res, err := c.GetValidArchs()
FailOnError(t, err)
if len(res) <= 1 {
t.Fatalf("Expected a length of greater then one.")
}
}
func TestBackgroundSignatureUpdate(t *testing.T) {
c := createStubHTTPClientSingle(
t,
"background-signature-update",
)
res, err := c.BackgroundSignatureUpdate()
FailOnError(t, err)
if res != "2022-09-30_195846_Updating Signatures_6c5300d51c224984b4319fb536cc21d0" {
t.Fatalf("Expected a different Event-ID!")
}
}