MCPcopy Create free account
hub / github.com/apache/devlake / Test_getBambooWebURL

Function Test_getBambooWebURL

backend/plugins/bamboo/tasks/shared_test.go:22–81  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

20import "testing"
21
22func Test_getBambooWebURL(t *testing.T) {
23 type args struct {
24 endpoint string
25 }
26 tests := []struct {
27 name string
28 args args
29 want string
30 wantErr bool
31 }{
32 {
33 name: "without-bamboo",
34 args: args{endpoint: "http://54.158.1.10:30001/rest/api/latest"},
35 want: "http://54.158.1.10:30001",
36 wantErr: false,
37 },
38 {
39 name: "without-bamboo-1",
40 args: args{endpoint: "http://54.158.1.10:30001/rest/api/latest/"},
41 want: "http://54.158.1.10:30001",
42 wantErr: false,
43 },
44 {
45 name: "with-bamboo",
46 args: args{endpoint: "http://54.158.1.10:30001/bamboo/rest/api/latest"},
47 want: "http://54.158.1.10:30001/bamboo",
48 wantErr: false,
49 },
50 {
51 name: "with-bamboo-1",
52 args: args{endpoint: "http://54.158.1.10:30001/bamboo/rest/api/latest/"},
53 want: "http://54.158.1.10:30001/bamboo",
54 wantErr: false,
55 },
56 {
57 name: "with-others",
58 args: args{endpoint: "http://54.158.1.10:30001/abc/rest/api/latest"},
59 want: "http://54.158.1.10:30001/abc",
60 wantErr: false,
61 },
62 {
63 name: "with-others-1",
64 args: args{endpoint: "http://54.158.1.10:30001/abc/rest/api/latest/repos"},
65 want: "http://54.158.1.10:30001/abc",
66 wantErr: false,
67 },
68 }
69 for _, tt := range tests {
70 t.Run(tt.name, func(t *testing.T) {
71 got, err := getBambooHomePage(tt.args.endpoint)
72 if (err != nil) != tt.wantErr {
73 t.Errorf("getbambooHomePage() error = %v, wantErr %v", err, tt.wantErr)
74 return
75 }
76 if got != tt.want {
77 t.Errorf("getbambooHomePage() got = %v, want %v", got, tt.want)
78 }
79 })

Callers

nothing calls this directly

Calls 2

getBambooHomePageFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected