Skip to content

Commit a0cfff9

Browse files
committed
Add a string with a plaintext ballot for testing.
1 parent 5ea92ac commit a0cfff9

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

test/electionguard/test_encrypt.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,20 @@ TEST_CASE("Encrypt full PlaintextBallot with WriteIn and Overvote with Encryptio
270270
auto mediator = make_unique<EncryptionMediator>(*internal, *context, *device);
271271

272272
// Act
273-
auto plaintextBallot =
274-
BallotGenerator::getSimpleBallotFromFile(TEST_BALLOT_WITH_WRITEIN_SELECTED);
273+
string plaintextBallot_json = string("{\"object_id\": \"03a29d15-667c-4ac8-afd7-549f19b8e4eb\","
274+
"\"style_id\": \"jefferson-county-ballot-style\", \"contests\": [ {\"object_id\":"
275+
"\"justice-supreme-court\", \"sequence_order\": 0, \"ballot_selections\": [{"
276+
"\"object_id\": \"john-adams-selection\", \"sequence_order\": 0, \"vote\": 1,"
277+
"\"is_placeholder_selection\": false, \"extended_data\": null}, {\"object_id\""
278+
": \"benjamin-franklin-selection\", \"sequence_order\": 1, \"vote\": 1,"
279+
"\"is_placeholder_selection\": false, \"extended_data\": null}, {\"object_id\":"
280+
" \"write-in-selection\", \"sequence_order\": 3, \"vote\": 1, \"is_placeholder_selection\""
281+
": false, \"write_in\": \"Susan B. Anthony\"}], \"extended_data\": null}]}");
282+
// TODO - Once the relevant plaintext ballot file is in the environment then
283+
// uncomment the below and stop using the hard coded string.
284+
//auto plaintextBallot =
285+
// BallotGenerator::getSimpleBallotFromFile(TEST_BALLOT_WITH_WRITEIN_SELECTED);
286+
auto plaintextBallot = PlaintextBallot::fromJson(plaintextBallot_json);
275287
auto ciphertext = mediator->encrypt(*plaintextBallot);
276288

277289
// Assert

0 commit comments

Comments
 (0)