Fix test that wasn't testing the correct thing

This commit is contained in:
2025-01-11 18:39:46 +01:00
parent 98421c8c06
commit 9cc85b9a47

View File

@ -555,7 +555,8 @@ func TestCreateVotes_AlreadyVoted(t *testing.T) {
On("Exists", mock.Anything, mock.Anything). On("Exists", mock.Anything, mock.Anything).
Return(true, nil) Return(true, nil)
path := "/election/1/votes" knownVotersElectionPath := "/election/1/votes"
unknownVotersElectionPath := "/election/2/votes"
voterIdentity := "anything" voterIdentity := "anything"
tests := []struct { tests := []struct {
@ -566,7 +567,7 @@ func TestCreateVotes_AlreadyVoted(t *testing.T) {
}{ }{
{ {
name: "Invalid request for known voters election (already voted)", name: "Invalid request for known voters election (already voted)",
urlPath: path, urlPath: knownVotersElectionPath,
body: api.CreateVotesRequest{ body: api.CreateVotesRequest{
Choices: []struct { Choices: []struct {
ChoiceText string `json:"choiceText"` ChoiceText string `json:"choiceText"`
@ -581,7 +582,7 @@ func TestCreateVotes_AlreadyVoted(t *testing.T) {
}, },
{ {
name: "Invalid request for unknown voters election (already voted)", name: "Invalid request for unknown voters election (already voted)",
urlPath: path, urlPath: unknownVotersElectionPath,
body: api.CreateVotesRequest{ body: api.CreateVotesRequest{
Choices: []struct { Choices: []struct {
ChoiceText string `json:"choiceText"` ChoiceText string `json:"choiceText"`