Cleaning up the operations code in client

This commit is contained in:
nikhiljindal
2015-01-28 20:41:37 -08:00
parent fcb1cd30ff
commit dc92d3c7a2
13 changed files with 38 additions and 230 deletions

View File

@@ -157,10 +157,10 @@ func TestValidatesHostParameter(t *testing.T) {
}
func TestDoRequestBearer(t *testing.T) {
status := &api.Status{Status: api.StatusWorking}
status := &api.Status{Status: api.StatusFailure}
expectedBody, _ := latest.Codec.Encode(status)
fakeHandler := util.FakeHandler{
StatusCode: 202,
StatusCode: 400,
ResponseBody: string(expectedBody),
T: t,
}
@@ -187,11 +187,11 @@ func TestDoRequestBearer(t *testing.T) {
}
}
func TestDoRequestAccepted(t *testing.T) {
status := &api.Status{Status: api.StatusWorking}
func TestDoRequestWithoutPassword(t *testing.T) {
status := &api.Status{Status: api.StatusFailure}
expectedBody, _ := latest.Codec.Encode(status)
fakeHandler := util.FakeHandler{
StatusCode: 202,
StatusCode: 400,
ResponseBody: string(expectedBody),
T: t,
}
@@ -228,11 +228,11 @@ func TestDoRequestAccepted(t *testing.T) {
fakeHandler.ValidateRequest(t, "/"+testapi.Version()+"/test", "GET", nil)
}
func TestDoRequestAcceptedSuccess(t *testing.T) {
func TestDoRequestSuccess(t *testing.T) {
status := &api.Status{Status: api.StatusSuccess}
expectedBody, _ := latest.Codec.Encode(status)
fakeHandler := util.FakeHandler{
StatusCode: 202,
StatusCode: 200,
ResponseBody: string(expectedBody),
T: t,
}
@@ -339,10 +339,3 @@ func TestDoRequestCreated(t *testing.T) {
}
fakeHandler.ValidateRequest(t, "/"+testapi.Version()+"/test", "GET", nil)
}
func TestDefaultPoll(t *testing.T) {
c := &RESTClient{PollPeriod: 0}
if req, ok := c.DefaultPoll("test"); req != nil || ok {
t.Errorf("expected nil request and not poll")
}
}