File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,8 +38,9 @@ func New(userName, password string) *Client {
3838 client .password = password
3939 client .httpClient = cleanhttp .DefaultClient ()
4040 client .SetTimeout (time .Second * DEFAULT_TIMEOUT )
41- client .SetAPIVersion (DEFAULT_API_VERSION )
42- client .SetAPIBaseUrl (DEFAULT_API_BASEURL )
41+
42+ client .apiVersion = DEFAULT_API_VERSION
43+ client .apiBaseUrl = DEFAULT_API_BASEURL
4344
4445 return & client
4546}
@@ -49,16 +50,6 @@ func (c *Client) SetTimeout(timeout time.Duration) {
4950 c .httpClient .Timeout = timeout
5051}
5152
52- // SetAPIVersion tells the client which API version to use
53- func (c * Client ) SetAPIVersion (version string ) {
54- c .apiVersion = version
55- }
56-
57- // SetAPIBaseUrl tells the client which API URL to use
58- func (c * Client ) SetAPIBaseUrl (url string ) {
59- c .apiBaseUrl = url
60- }
61-
6253// CreateRequestUrl creates and returns a complete request URL for the specified API location
6354func (c * Client ) CreateRequestUrl (location string ) string {
6455 return fmt .Sprintf ("%s%s" , c .getBaseUrl (), location )
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ func TestGetAccount(t *testing.T) {
105105 }
106106}
107107
108- // TestErrorHandling performs various type checking on errors returned from the service and the underlying client
108+ // TestErrorHandling checks that the correct error type is returned from service methods
109109func TestErrorHandling (t * testing.T ) {
110110 // Perform a bogus request that will certainly fail
111111 _ , err := svc .StartServer (& request.StartServerRequest {
@@ -119,19 +119,6 @@ func TestErrorHandling(t *testing.T) {
119119 if actualErrorType != expectedErrorType {
120120 t .Errorf ("TestErrorHandling expected %s, got %s" , expectedErrorType , actualErrorType )
121121 }
122-
123- // Create a service where the client is misconfigured
124- brokenClient := client .New ("foo" , "bar" )
125- brokenClient .SetAPIBaseUrl ("???¤#Whttp://example.com" )
126- brokenSvc := New (brokenClient )
127-
128- _ , err = brokenSvc .GetAccount ()
129- expectedErrorType = "*url.Error"
130- actualErrorType = reflect .TypeOf (err ).String ()
131-
132- if actualErrorType != expectedErrorType {
133- t .Errorf ("TestErrorHandling expected %s, got %s" , expectedErrorType , actualErrorType )
134- }
135122}
136123
137124// TestCreateModifyDeleteServer performs the following actions:
You can’t perform that action at this time.
0 commit comments