Skip to content

Commit

Permalink
Test additional functionality for status updating
Browse files Browse the repository at this point in the history
  • Loading branch information
lkysow committed Oct 13, 2017
1 parent 1d5efb9 commit a1d8dcc
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions server/github_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,32 @@ func TestUpdate(t *testing.T) {
client.VerifyWasCalledOnce().UpdateStatus(repoModel, pullModel, "success", "Plan Success", "Atlantis")
}

func TestUpdateProjectResult_Error(t *testing.T) {
RegisterMockTestingT(t)
ctx := &server.CommandContext{
BaseRepo: repoModel,
Pull: pullModel,
Command: &server.Command{Name: server.Plan},
}
client := mocks.NewMockClient()
s := server.GithubStatus{client}
s.UpdateProjectResult(ctx, server.CommandResponse{Error: errors.New("err")})
client.VerifyWasCalledOnce().UpdateStatus(repoModel, pullModel, server.Error.String(), "Plan Error", "Atlantis")
}

func TestUpdateProjectResult_Failure(t *testing.T) {
RegisterMockTestingT(t)
ctx := &server.CommandContext{
BaseRepo: repoModel,
Pull: pullModel,
Command: &server.Command{Name: server.Plan},
}
client := mocks.NewMockClient()
s := server.GithubStatus{client}
s.UpdateProjectResult(ctx, server.CommandResponse{Failure: "failure"})
client.VerifyWasCalledOnce().UpdateStatus(repoModel, pullModel, server.Failure.String(), "Plan Failure", "Atlantis")
}

func TestUpdateProjectResult(t *testing.T) {
t.Log("should use worst status")
RegisterMockTestingT(t)
Expand Down

0 comments on commit a1d8dcc

Please sign in to comment.