func (s *DeploySuite) TestDeployInfoDiff(c *check.C) { user, _ := s.token.User() a := app.App{Name: "g1", Platform: "python", TeamOwner: s.team.Name} err := app.CreateApp(&a, user) c.Assert(err, check.IsNil) recorder := httptest.NewRecorder() timestamp := time.Now() depData := []app.DeployData{ {App: "g1", Timestamp: timestamp.Add(-3600 * time.Second), Commit: "e293e3e3me03ejm3puejmp3ej3iejop32", Error: "", Origin: "git"}, {App: "g1", Timestamp: timestamp, Commit: "e82nn93nd93mm12o2ueh83dhbd3iu112", Error: "", Origin: "git", Diff: "fake-diff"}, } lastDeploy := depData[1] evts := insertDeploysAsEvents(depData, c) url := fmt.Sprintf("/deploys/%s", evts[1].UniqueID.Hex()) request, err := http.NewRequest("GET", url, nil) c.Assert(err, check.IsNil) request.Header.Set("Authorization", "bearer "+s.token.GetValue()) server := RunServer(true) server.ServeHTTP(recorder, request) c.Assert(recorder.Code, check.Equals, http.StatusOK) c.Assert(recorder.Header().Get("Content-Type"), check.Equals, "application/json") lastDeploy.ID = evts[1].UniqueID var result app.DeployData err = json.Unmarshal(recorder.Body.Bytes(), &result) c.Assert(err, check.IsNil) result.Timestamp = lastDeploy.Timestamp result.RemoveDate = lastDeploy.RemoveDate result.Duration = 0 result.Log = "" c.Assert(result, check.DeepEquals, lastDeploy) }