-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsetters_test.go
74 lines (58 loc) · 1.32 KB
/
setters_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
72
73
74
package docs
import (
"reflect"
"testing"
)
func TestUnitInfoSetLicense(t *testing.T) {
t.Parallel()
info := Info{
Title: "tester",
}
lic := "MIT"
urlTest := "https://github.com/kaynetik"
info.SetLicense(lic, urlTest)
if info.License.Name != lic {
t.Errorf("license name not set correctly")
}
if info.License.URL != URL(urlTest) {
t.Error("license URL not set correctly")
}
}
func TestUnitInfoGetInfo(t *testing.T) {
t.Parallel()
oasPrep := OAS{Info: Info{
Title: testingPostfix,
}}
got := oasPrep.GetInfo()
if !reflect.DeepEqual(got, &oasPrep.Info) {
t.Errorf("failed getting OAS.Info reference")
}
}
func TestUnitSetOASVersion(t *testing.T) {
t.Parallel()
oasPrep := OAS{Info: Info{
Title: testingPostfix,
}}
verToSet := "3.1.1"
oasPrep.SetOASVersion(verToSet)
if oasPrep.OASVersion != OASVersion(verToSet) {
t.Error("failed setting OAS.OASVersion")
}
}
func TestUnitSetTag(t *testing.T) {
t.Parallel()
tags := Tags{}
tName := "pettag"
tDesc := "Everything about your Pets"
tED := ExternalDocs{
Description: "Find out more about our store (Swagger UI Example)",
URL: "http://swagger.io",
}
tags.SetTag(tName, tDesc, tED)
firstTag := tags[0]
if firstTag.Name != tName ||
firstTag.Description != tDesc ||
firstTag.ExternalDocs != tED {
t.Error("tag not set properly")
}
}