@@ -143,8 +143,9 @@ func TestClientUpdateRoleBadConnection(t *testing.T) {
143143 config := & Config {APIID : "foo" , APIKey : "bar" , BaseURL : "badness.incapsula.com" }
144144 client := & Client {config : config , httpClient : & http.Client {Timeout : time .Millisecond * 1 }}
145145 roleID := 123
146+ accountID := 456
146147 requestDTO := RoleDetailsBasicDTO {}
147- updateRoleResponse , err := client .UpdateAccountRole (roleID , requestDTO )
148+ updateRoleResponse , err := client .UpdateAccountRole (roleID , accountID , requestDTO )
148149 if err == nil {
149150 t .Errorf ("Should have received an error" )
150151 }
@@ -158,9 +159,11 @@ func TestClientUpdateRoleBadConnection(t *testing.T) {
158159
159160func TestClientUpdateRoleBadJSON (t * testing.T ) {
160161 roleID := 123
162+ accountID := 456
161163 server := httptest .NewServer (http .HandlerFunc (func (rw http.ResponseWriter , req * http.Request ) {
162- if req .URL .String () != fmt .Sprintf ("/%s/%d" , endpointRoleUpdate , roleID ) {
163- t .Errorf ("Should have have hit /%s/%d endpoint. Got: %s" , endpointAccountUpdate , roleID , req .URL .String ())
164+ expectedURL := fmt .Sprintf ("/%s/%d?caid=%d" , endpointRoleUpdate , roleID , accountID )
165+ if req .URL .String () != expectedURL {
166+ t .Errorf ("Should have hit %s endpoint. Got: %s" , expectedURL , req .URL .String ())
164167 }
165168 rw .Write ([]byte (`{` ))
166169 }))
@@ -169,7 +172,7 @@ func TestClientUpdateRoleBadJSON(t *testing.T) {
169172 config := & Config {APIID : "foo" , APIKey : "bar" , BaseURLAPI : server .URL }
170173 client := & Client {config : config , httpClient : & http.Client {}}
171174 requestDTO := RoleDetailsBasicDTO {}
172- updateRoleResponse , err := client .UpdateAccountRole (roleID , requestDTO )
175+ updateRoleResponse , err := client .UpdateAccountRole (roleID , accountID , requestDTO )
173176 if err == nil {
174177 t .Errorf ("Should have received an error" )
175178 }
0 commit comments