From 9cc85b9a470109a968acd1a65e3a72e531f5dc4a Mon Sep 17 00:00:00 2001 From: dylan Date: Sat, 11 Jan 2025 18:39:46 +0100 Subject: [PATCH] Fix test that wasn't testing the correct thing --- cmd/web/handlers_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/web/handlers_test.go b/cmd/web/handlers_test.go index b830846..8089c5f 100644 --- a/cmd/web/handlers_test.go +++ b/cmd/web/handlers_test.go @@ -555,7 +555,8 @@ func TestCreateVotes_AlreadyVoted(t *testing.T) { On("Exists", mock.Anything, mock.Anything). Return(true, nil) - path := "/election/1/votes" + knownVotersElectionPath := "/election/1/votes" + unknownVotersElectionPath := "/election/2/votes" voterIdentity := "anything" tests := []struct { @@ -566,7 +567,7 @@ func TestCreateVotes_AlreadyVoted(t *testing.T) { }{ { name: "Invalid request for known voters election (already voted)", - urlPath: path, + urlPath: knownVotersElectionPath, body: api.CreateVotesRequest{ Choices: []struct { ChoiceText string `json:"choiceText"` @@ -581,7 +582,7 @@ func TestCreateVotes_AlreadyVoted(t *testing.T) { }, { name: "Invalid request for unknown voters election (already voted)", - urlPath: path, + urlPath: unknownVotersElectionPath, body: api.CreateVotesRequest{ Choices: []struct { ChoiceText string `json:"choiceText"`