Skip to content

Commit

Permalink
enable ignored i/o tests in commonTest
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzHeinrich committed Sep 6, 2024
1 parent fbd78e0 commit 17913e9
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@ import com.github.michaelbull.result.Err
import com.github.michaelbull.result.unwrap
import electionguard.ballot.EncryptedBallot
import electionguard.ballot.makeContestData
import electionguard.core.*
import electionguard.core.ElGamalPublicKey
import electionguard.core.UInt256
import electionguard.core.productionGroup
import electionguard.core.testResourcesDir
import electionguard.encrypt.Encryptor
import electionguard.encrypt.submit
import electionguard.input.RandomBallotProvider
import electionguard.publish.readElectionRecord
import electionguard.util.ErrorMessages
import kotlin.test.Ignore
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNotNull

@Ignore // I/O is not supported in browser tests

class DecryptionWithNonceTest {
val input = "src/commonTest/data/workflow/allAvailableJson"
val input = "$testResourcesDir/workflow/allAvailableJson"
private val nballots = 20

/** test DecryptionWithPrimaryNonce: encrypt ballot, decrypt with master nonce, check match. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import kotlin.math.roundToInt
import kotlin.test.*

/** Test KeyCeremony Trustee generation and recovered decryption. */
@Ignore // I/O is not supported in browser tests

class EncryptDecryptBallotTest {
val group = productionGroup()
val configDir = "src/commonTest/data/startConfigJson"
val configDir = "$testResourcesDir/startConfigJson"
val outputDir = "testOut/RecoveredDecryptionTest"
val trusteeDir = "$outputDir/private_data"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ package electionguard.encrypt

import electionguard.ballot.EncryptedBallot
import electionguard.core.productionGroup
import electionguard.core.testResourcesDir
import electionguard.input.RandomBallotProvider
import electionguard.publish.makePublisher
import electionguard.publish.readElectionRecord
import electionguard.util.ErrorMessages
import kotlin.test.*

@Ignore // I/O is not supported in browser tests

class AddBallotSyncTest {
val group = productionGroup()
val inputProto = "src/commonTest/data/workflow/allAvailableProto"
val inputJson = "src/commonTest/data/workflow/allAvailableJson"
val inputProto = "$testResourcesDir/workflow/allAvailableProto"
val inputJson = "$testResourcesDir/workflow/allAvailableJson"
val outputDirTop = "testOut/encrypt/AddBallotSyncTest"

val nballots = 4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package electionguard.encrypt

import electionguard.ballot.EncryptedBallot
import electionguard.core.*
import electionguard.core.productionGroup
import electionguard.core.testResourcesDir
import electionguard.input.RandomBallotProvider
import electionguard.publish.makePublisher
import electionguard.publish.readElectionRecord
import electionguard.util.ErrorMessages
import kotlin.test.Ignore
import kotlin.test.Test
import kotlin.test.assertNotNull

@Ignore // I/O is not supported in browser tests

class AddEncryptedBallotJsonTest {
val input = "src/commonTest/data/workflow/allAvailableJson"
val input = "$testResourcesDir/workflow/allAvailableJson"
val outputDirJson = "testOut/encrypt/addEncryptedBallotJson"

val nballots = 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import electionguard.util.Stats
import electionguard.verifier.VerifyEncryptedBallots
import kotlin.test.*

@Ignore // I/O is not supported in browser tests

class AddEncryptedBallotTest {
val group = productionGroup()
val input = "src/commonTest/data/workflow/allAvailableJson"
val input = "$testResourcesDir/workflow/allAvailableJson"
val outputDir = "testOut/encrypt/addEncryptedBallot"

val nballots = 4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package electionguard.encrypt

import electionguard.ballot.EncryptedBallot
import electionguard.core.*
import electionguard.core.productionGroup
import electionguard.core.testResourcesDir
import electionguard.input.RandomBallotProvider
import electionguard.publish.makePublisher
import electionguard.publish.readElectionRecord
import electionguard.util.ErrorMessages
import kotlin.random.Random
import kotlin.test.Ignore
import kotlin.test.Test
import kotlin.test.assertNotNull

@Ignore // I/O is not supported in browser tests

class AddEncryptedUnorderedTest {
val group = productionGroup()
val input = "src/commonTest/data/workflow/allAvailableJson"
val input = "$testResourcesDir/workflow/allAvailableJson"
val outputDirProto = "testOut/encrypt/AddEncryptedUnorderedTest"

val nballots = 3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
package electionguard.encrypt

import electionguard.core.*
import electionguard.core.ElGamalPublicKey
import electionguard.core.UInt256
import electionguard.core.hashFunction
import electionguard.core.productionGroup
import electionguard.core.runTest
import electionguard.core.testResourcesDir
import electionguard.core.toElementModQ
import electionguard.publish.readElectionRecord
import electionguard.util.ErrorMessages
import kotlinx.coroutines.test.TestResult
import kotlin.test.Ignore
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotNull

@Ignore // I/O is not supported in browser tests

class EncryptTest {
val input = "src/commonTest/data/workflow/allAvailableJson"
val input = "$testResourcesDir/workflow/allAvailableJson"

// sanity check that encryption doesnt barf
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,26 @@ package electionguard.encrypt

import electionguard.ballot.Manifest
import electionguard.ballot.PlaintextBallot
import electionguard.core.*
import electionguard.core.ElGamalPublicKey
import electionguard.core.GroupContext
import electionguard.core.UInt256
import electionguard.core.getSystemTimeInMillis
import electionguard.core.hashFunction
import electionguard.core.productionGroup
import electionguard.core.testResourcesDir
import electionguard.core.toElementModQ
import electionguard.input.RandomBallotProvider
import electionguard.publish.readElectionRecord
import electionguard.util.ErrorMessages
import kotlin.math.roundToInt
import kotlin.test.Ignore
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotNull

/** Verify the embedded nonces in an Encrypted Ballot. */
@Ignore // I/O is not supported in browser tests

class EncryptionNonceTest {
val input = "src/commonTest/data/workflow/allAvailableJson"
val input = "$testResourcesDir/workflow/allAvailableJson"
val nballots = 11

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package electionguard.input

import electionguard.core.productionGroup
import electionguard.core.testResourcesDir
import electionguard.publish.readElectionRecord
import kotlin.test.Ignore
import kotlin.test.Test
import kotlin.test.assertFailsWith
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith


@Ignore // I/O is not supported in browser tests
class RandomBallotProviderTest {

@Test
fun testBadStyle() {
val inputDir = "src/commonTest/data/workflow/allAvailableJson"
val inputDir = "$testResourcesDir/workflow/allAvailableJson"

val group = productionGroup()
val electionRecord = readElectionRecord(group, inputDir)
Expand Down

0 comments on commit 17913e9

Please sign in to comment.