@@ -158,7 +158,7 @@ func TestBallot_Unmarshal(t *testing.T) {
158
158
159
159
err = b .Unmarshal (ballotWrongSelect , election )
160
160
require .EqualError (t , err , "could not unmarshal select answers: " +
161
- "question Q1 has too many selected answers" )
161
+ "failed to check number of answers: question Q1 has too many selected answers" )
162
162
163
163
// with not enough selected answers in select question
164
164
ballotWrongSelect = string ("select:" + encodedQuestionID (1 ) + ":1,0,0\n " +
@@ -170,7 +170,7 @@ func TestBallot_Unmarshal(t *testing.T) {
170
170
171
171
err = b .Unmarshal (ballotWrongSelect , election )
172
172
require .EqualError (t , err , "could not unmarshal select answers: " +
173
- "question Q1 has not enough selected answers" )
173
+ "failed to check number of answers: question Q1 has not enough selected answers" )
174
174
175
175
// with not enough answers in rank question
176
176
ballotWrongRank := string ("select:" + encodedQuestionID (1 ) + ":1,0,1\n " +
@@ -192,7 +192,7 @@ func TestBallot_Unmarshal(t *testing.T) {
192
192
193
193
err = b .Unmarshal (ballotWrongRank , election )
194
194
require .EqualError (t , err , "could not unmarshal rank answers: " +
195
- "could not parse rank value for Q.Q2 : strconv.ParseInt: parsing \" x\" : invalid syntax" )
195
+ "could not parse rank value for Q.Q2: strconv.ParseInt: parsing \" x\" : invalid syntax" )
196
196
197
197
// with too many selected answers in rank question
198
198
ballotWrongRank = string ("select:" + encodedQuestionID (1 ) + ":1,0,1\n " +
@@ -204,7 +204,7 @@ func TestBallot_Unmarshal(t *testing.T) {
204
204
205
205
err = b .Unmarshal (ballotWrongRank , election )
206
206
require .EqualError (t , err , "could not unmarshal rank answers: " +
207
- "invalid rank not in range [0, MaxN[" )
207
+ "invalid rank not in range [0, MaxN[: 3 " )
208
208
209
209
// with valid ranks but one is selected twice
210
210
ballotWrongRank = string ("select:" + encodedQuestionID (1 ) + ":1,0,1\n " +
@@ -216,7 +216,7 @@ func TestBallot_Unmarshal(t *testing.T) {
216
216
217
217
err = b .Unmarshal (ballotWrongRank , election )
218
218
require .EqualError (t , err , "could not unmarshal rank answers: " +
219
- "question Q2 has too many selected answers" )
219
+ "failed to check number of answers: question Q2 has too many selected answers" )
220
220
221
221
// with not enough selected answers in rank question
222
222
ballotWrongRank = string ("select:" + encodedQuestionID (1 ) + ":1,0,1\n " +
@@ -227,7 +227,8 @@ func TestBallot_Unmarshal(t *testing.T) {
227
227
election .BallotSize = len (ballotWrongRank )
228
228
229
229
err = b .Unmarshal (ballotWrongRank , election )
230
- require .EqualError (t , err , "could not unmarshal rank answers: question" +
230
+ require .EqualError (t , err , "could not unmarshal rank answers: " +
231
+ "failed to check number of answers: question" +
231
232
" Q2 has not enough selected answers" )
232
233
233
234
// with not enough answers in text question
@@ -252,7 +253,7 @@ func TestBallot_Unmarshal(t *testing.T) {
252
253
253
254
err = b .Unmarshal (ballotWrongText , election )
254
255
require .EqualError (t , err , "could not unmarshal text answers: " +
255
- "could not decode text for Q. Q4: illegal base64 data at input byte 12" )
256
+ "could not decode text for Q.Q4: illegal base64 data at input byte 12" )
256
257
257
258
// with too many selected answers in text question
258
259
election .Configuration .Scaffold [0 ].Texts [0 ].MaxN = 1
@@ -266,7 +267,7 @@ func TestBallot_Unmarshal(t *testing.T) {
266
267
267
268
err = b .Unmarshal (ballotWrongText , election )
268
269
require .EqualError (t , err , "could not unmarshal text answers: " +
269
- "question Q4 has too many selected answers" )
270
+ "failed to check number of answers: question Q4 has too many selected answers" )
270
271
271
272
election .Configuration .Scaffold [0 ].Texts [0 ].MaxN = 2
272
273
@@ -280,7 +281,7 @@ func TestBallot_Unmarshal(t *testing.T) {
280
281
281
282
err = b .Unmarshal (ballotWrongText , election )
282
283
require .EqualError (t , err , "could not unmarshal text answers: " +
283
- "question Q4 has not enough selected answers" )
284
+ "failed to check number of answers: question Q4 has not enough selected answers" )
284
285
285
286
// with unknown question type
286
287
ballotWrongType := string ("wrong:" + encodedQuestionID (1 ) + ":" )
@@ -382,14 +383,6 @@ func TestSubject_IsValid(t *testing.T) {
382
383
valid := configuration .IsValid ()
383
384
require .True (t , valid )
384
385
385
- // with wrongly ID not in base64
386
- mainSubject .ID = "zzz"
387
-
388
- configuration .Scaffold = []Subject {* mainSubject }
389
-
390
- valid = configuration .IsValid ()
391
- require .False (t , valid )
392
-
393
386
// with double IDs
394
387
395
388
mainSubject .ID = ID (base64 .StdEncoding .EncodeToString ([]byte ("S1" )))
0 commit comments