Skip to content

Commit 87e080a

Browse files
committed
fix gofmt and goimports issues
1 parent 71c4d43 commit 87e080a

File tree

4 files changed

+22
-23
lines changed

4 files changed

+22
-23
lines changed

logout_request_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,4 @@ func TestParseLogoutRequestWithISO8601(t *testing.T) {
9191
t.Errorf("Expected IssueInstant to be <%v>, got <%v>",
9292
instant, l.IssueInstant)
9393
}
94-
}
94+
}

rest_client.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package cas
22

33
import (
4-
"net/url"
5-
"net/http"
6-
"github.com/golang/glog"
74
"fmt"
8-
"path"
95
"io/ioutil"
6+
"net/http"
7+
"net/url"
8+
"path"
9+
10+
"github.com/golang/glog"
1011
)
1112

1213
// https://apereo.github.io/cas/4.2.x/protocol/REST-Protocol.html
@@ -17,7 +18,6 @@ type TicketGrantingTicket string
1718
// ServiceTicket stands for the access granted by the CAS server to an application for a specific user, also known as ST
1819
type ServiceTicket string
1920

20-
2121
// RestOptions provide options for the RestClient
2222
type RestOptions struct {
2323
CasURL *url.URL
@@ -175,4 +175,4 @@ func (c *RestClient) Logout(tgt TicketGrantingTicket) error {
175175
}
176176

177177
return nil
178-
}
178+
}

rest_client_test.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package cas
22

33
import (
4-
"testing"
5-
"net/http/httptest"
64
"net/http"
5+
"net/http/httptest"
76
"net/url"
7+
"testing"
88
)
99

1010
func TestRequestGrantingTicket(t *testing.T) {
@@ -81,16 +81,15 @@ func TestRequestServiceTicket(t *testing.T) {
8181
t.Error("failed to create cas url from test server")
8282
}
8383

84-
8584
serviceURL, err := url.Parse("https://hitchhiker.com/heartOfGold")
8685
if err != nil {
8786
t.Error("failed to create service url")
8887
}
8988

9089
restClient := NewRestClient(&RestOptions{
91-
CasURL: casURL,
90+
CasURL: casURL,
9291
ServiceURL: serviceURL,
93-
Client: server.Client(),
92+
Client: server.Client(),
9493
})
9594

9695
st, err := restClient.RequestServiceTicket(TicketGrantingTicket("TGT-abc"))
@@ -113,9 +112,9 @@ func TestRequestServiceTicket(t *testing.T) {
113112
}
114113

115114
restClient = NewRestClient(&RestOptions{
116-
CasURL: casURL,
115+
CasURL: casURL,
117116
ServiceURL: serviceURL,
118-
Client: server.Client(),
117+
Client: server.Client(),
119118
})
120119

121120
_, err = restClient.RequestServiceTicket(TicketGrantingTicket("TGT-abc"))
@@ -186,4 +185,4 @@ func TestLogout(t *testing.T) {
186185
if err == nil {
187186
t.Errorf("logout should failed for this TGT")
188187
}
189-
}
188+
}

url_scheme_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ func TestDefaultURLScheme(t *testing.T) {
1010
scheme := NewDefaultURLScheme(url)
1111

1212
u, err := scheme.Login()
13-
assertUrl(t, "/cas/login", u, err)
13+
assertURL(t, "/cas/login", u, err)
1414
u, err = scheme.Logout()
15-
assertUrl(t, "/cas/logout", u, err)
15+
assertURL(t, "/cas/logout", u, err)
1616
u, err = scheme.Validate()
17-
assertUrl(t, "/cas/validate", u, err)
17+
assertURL(t, "/cas/validate", u, err)
1818
u, err = scheme.ServiceValidate()
19-
assertUrl(t, "/cas/serviceValidate", u, err)
19+
assertURL(t, "/cas/serviceValidate", u, err)
2020
u, err = scheme.RestGrantingTicket()
21-
assertUrl(t, "/cas/v1/tickets", u, err)
21+
assertURL(t, "/cas/v1/tickets", u, err)
2222
u, err = scheme.RestServiceTicket("TGT-123")
23-
assertUrl(t, "/cas/v1/tickets/TGT-123", u, err)
23+
assertURL(t, "/cas/v1/tickets/TGT-123", u, err)
2424
u, err = scheme.RestLogout("TGT-123")
25-
assertUrl(t, "/cas/v1/tickets/TGT-123", u, err)
25+
assertURL(t, "/cas/v1/tickets/TGT-123", u, err)
2626
}
2727

28-
func assertUrl(t *testing.T, expected string, u *url.URL, err error) {
28+
func assertURL(t *testing.T, expected string, u *url.URL, err error) {
2929
if err != nil {
3030
t.Fatalf("returned error")
3131
}

0 commit comments

Comments
 (0)