예제 #1
0
def audit_tally_dummies(data_opened: str, tally_dummies: str):
    data_opened = _load_opened_data(data_opened)
    tally = _load_tally(tally_dummies)

    print("Auditing data_opened - tally with dummy votes...")
    print(
        "valid" if audit_tables_tally(tally, data_opened, False, True) else "not valid"
    )
예제 #2
0
def audit_tally_final(data_opened: str, tally_final: str):
    data_opened = _load_opened_data(data_opened)
    tally = _load_tally(tally_final)

    print("Auditing data_opened - final tally...")
    print(
        "valid" if audit_tables_tally(tally, data_opened, True, False) else "not valid"
    )
예제 #3
0
def audit_elections(
    data_opened: str,
    data_pre_election: str,
    data_tally: str,
    bb: str,
    tally_all: str,
    group_id: Optional[str] = typer.Argument(None),
):
    data_pre_election = _load_pre_election(data_pre_election)
    data_tally = _load_tally_data(data_tally)

    print("Auditing pre_election - data_tally...")
    with click_spinner.spinner():
        valid = audit_pre_election_tables(data_pre_election, data_tally)
    print("valid" if valid else "not valid!")

    del data_pre_election
    data_opened = _load_opened_data(data_opened)

    print("Auditing data_tally - data_opened...")
    with click_spinner.spinner():
        valid = audit_tables(data_opened, data_tally)

    print("valid" if valid else "not valid")

    del data_tally

    bb = _load_bb(bb)
    if group_id is not None:
        print(
            f"Filtering bulletin board is enabled, only votes for group {group_id} will be taken into account"
        )
        bb_filtered = {}
        for vote_id, bb_entry in bb.items():
            if bb_entry.group_id == group_id:
                bb_filtered[vote_id] = bb_entry

        bb = bb_filtered

    print("Auditing data_opened - bb...")
    with click_spinner.spinner():
        valid = audit_bb(bb, data_opened)
    print("valid" if valid else "not valid")

    del bb

    tally_all = _load_tally(tally_all)

    print("Auditing data_opened - tally with all votes...")
    with click_spinner.spinner():
        valid = audit_tables_tally(tally_all, data_opened)
    print("valid" if valid else "not valid")
예제 #4
0
def audit_tally_all(data_opened: str, tally_all: str):
    data_opened = _load_opened_data(data_opened)
    tally = _load_tally(tally_all)

    print("Auditing data_opened - tally with all votes...")
    print("valid" if audit_tables_tally(tally, data_opened) else "not valid")
예제 #5
0
def test_audit_opened_data_only_left_columns_opened(
        tally_results: TallyResults, opened_data_left_columns: AuditTables):
    assert audit_tables_tally(tally_results, opened_data_left_columns) is False
예제 #6
0
def test_audit_opened_data_invalid_tally_results(
        invalid_tally_results: TallyResults,
        opened_data_right_columns: AuditTables):
    assert audit_tables_tally(invalid_tally_results,
                              opened_data_right_columns) is False
예제 #7
0
def test_audit_opened_data(tally_results: TallyResults,
                           opened_data: AuditTables):
    assert audit_tables_tally(tally_results, opened_data) is True