Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
X-Guardian committed Mar 1, 2024
1 parent 7a9c7a9 commit 26ec5b3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions server/controllers/locks_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func TestGetLock_None(t *testing.T) {
req = mux.SetURLVars(req, map[string]string{"id": "id"})
w := httptest.NewRecorder()
lc.GetLock(w, req)
ResponseContains(t, w, http.StatusNotFound, "No lock found at id \"id\"")
ResponseContains(t, w, http.StatusNotFound, "No lock found at id 'id'")
}

func TestGetLock_Success(t *testing.T) {
Expand Down Expand Up @@ -215,7 +215,7 @@ func TestDeleteLock_InvalidLockID(t *testing.T) {
req = mux.SetURLVars(req, map[string]string{"id": "%A@"})
w := httptest.NewRecorder()
lc.DeleteLock(w, req)
ResponseContains(t, w, http.StatusBadRequest, "Invalid lock id \"%A@\"")
ResponseContains(t, w, http.StatusBadRequest, "Invalid lock id '%A@'")
}

func TestDeleteLock_LockerErr(t *testing.T) {
Expand Down Expand Up @@ -247,7 +247,7 @@ func TestDeleteLock_None(t *testing.T) {
req = mux.SetURLVars(req, map[string]string{"id": "id"})
w := httptest.NewRecorder()
lc.DeleteLock(w, req)
ResponseContains(t, w, http.StatusNotFound, "No lock found at id \"id\"")
ResponseContains(t, w, http.StatusNotFound, "No lock found at id 'id'")
}

func TestDeleteLock_OldFormat(t *testing.T) {
Expand All @@ -265,7 +265,7 @@ func TestDeleteLock_OldFormat(t *testing.T) {
req = mux.SetURLVars(req, map[string]string{"id": "id"})
w := httptest.NewRecorder()
lc.DeleteLock(w, req)
ResponseContains(t, w, http.StatusOK, "Deleted lock id \"id\"")
ResponseContains(t, w, http.StatusOK, "Deleted lock id 'id'")
cp.VerifyWasCalled(Never()).CreateComment(Any[logging.SimpleLogging](), Any[models.Repo](), Any[int](), Any[string](), Any[string]())
}

Expand Down Expand Up @@ -321,7 +321,7 @@ func TestDeleteLock_UpdateProjectStatus(t *testing.T) {
req = mux.SetURLVars(req, map[string]string{"id": "id"})
w := httptest.NewRecorder()
lc.DeleteLock(w, req)
ResponseContains(t, w, http.StatusOK, "Deleted lock id \"id\"")
ResponseContains(t, w, http.StatusOK, "Deleted lock id 'id'")
status, err := backend.GetPullStatus(pull)
Ok(t, err)
Assert(t, status.Projects != nil, "status projects was nil")
Expand Down Expand Up @@ -363,7 +363,7 @@ func TestDeleteLock_CommentFailed(t *testing.T) {
req = mux.SetURLVars(req, map[string]string{"id": "id"})
w := httptest.NewRecorder()
lc.DeleteLock(w, req)
ResponseContains(t, w, http.StatusOK, "Deleted lock id \"id\"")
ResponseContains(t, w, http.StatusOK, "Deleted lock id 'id'")
}

func TestDeleteLock_CommentSuccess(t *testing.T) {
Expand Down Expand Up @@ -400,7 +400,7 @@ func TestDeleteLock_CommentSuccess(t *testing.T) {
req = mux.SetURLVars(req, map[string]string{"id": "id"})
w := httptest.NewRecorder()
lc.DeleteLock(w, req)
ResponseContains(t, w, http.StatusOK, "Deleted lock id \"id\"")
ResponseContains(t, w, http.StatusOK, "Deleted lock id 'id'")
cp.VerifyWasCalled(Once()).CreateComment(Any[logging.SimpleLogging](), Eq(pull.BaseRepo), Eq(pull.Num),
Eq("**Warning**: The plan for dir: `path` workspace: `workspace` was **discarded** via the Atlantis UI.\n\n"+
"To `apply` this plan you must run `plan` again."), Eq(""))
Expand Down
4 changes: 2 additions & 2 deletions server/events/project_command_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ projects:
dir: .
workspace: myworkspace
`,
ExpErr: "must specify project name: more than one project defined in atlantis.yaml matched dir: \".\" workspace: \"myworkspace\"",
ExpErr: "must specify project name: more than one project defined in atlantis.yaml matched dir: '.' workspace: 'myworkspace'",
},
{
Description: "atlantis.yaml with project flag not matching",
Expand All @@ -399,7 +399,7 @@ version: 3
projects:
- dir: .
`,
ExpErr: "no project with name \"notconfigured\" is defined in atlantis.yaml",
ExpErr: "no project with name 'notconfigured' is defined in atlantis.yaml",
},
{
Description: "atlantis.yaml with project flag not matching but silenced",
Expand Down

0 comments on commit 26ec5b3

Please sign in to comment.