Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Helios Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Helios Server
Commits
578f8cdd
Commit
578f8cdd
authored
14 years ago
by
Ben Adida
Browse files
Options
Downloads
Patches
Plain Diff
fixed data for voter_id_hash legacy compatibility
parent
74b36d53
No related branches found
No related tags found
No related merge requests found
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
helios/crypto/electionalgs.py
+6
-1
6 additions, 1 deletion
helios/crypto/electionalgs.py
helios/fixtures/legacy-data.json
+1
-1
1 addition, 1 deletion
helios/fixtures/legacy-data.json
helios/tests.py
+12
-5
12 additions, 5 deletions
helios/tests.py
with
19 additions
and
7 deletions
helios/crypto/electionalgs.py
+
6
−
1
View file @
578f8cdd
...
@@ -480,6 +480,11 @@ class Voter(HeliosObject):
...
@@ -480,6 +480,11 @@ class Voter(HeliosObject):
@property
@property
def
voter_id_hash
(
self
):
def
voter_id_hash
(
self
):
if
self
.
voter_login_id
:
# for backwards compatibility with v3.0, and since it doesn't matter
# too much if we hash the email or the unique login ID here.
return
utils
.
hash_b64
(
self
.
voter_login_id
)
else
:
return
utils
.
hash_b64
(
self
.
voter_id
)
return
utils
.
hash_b64
(
self
.
voter_id
)
class
Trustee
(
HeliosObject
):
class
Trustee
(
HeliosObject
):
...
...
This diff is collapsed.
Click to expand it.
helios/fixtures/legacy-data.json
+
1
−
1
View file @
578f8cdd
This diff is collapsed.
Click to expand it.
helios/tests.py
+
12
−
5
View file @
578f8cdd
...
@@ -219,17 +219,24 @@ class CastVoteModelTests(TestCase):
...
@@ -219,17 +219,24 @@ class CastVoteModelTests(TestCase):
class
LegacyElectionBlackboxTests
(
TestCase
):
class
LegacyElectionBlackboxTests
(
TestCase
):
fixtures
=
[
'
legacy-data.json
'
]
fixtures
=
[
'
legacy-data.json
'
]
EXPECTED_OUTPUT_FILE
=
'
helios/fixtures/legacy-election-expected.json
'
EXPECTED_ELECTION_FILE
=
'
helios/fixtures/legacy-election-expected.json
'
EXPECTED_VOTERS_FILE
=
'
helios/fixtures/legacy-election-voters-expected.json
'
def
setUp
(
self
):
def
setUp
(
self
):
self
.
election
=
models
.
Election
.
objects
.
all
()[
0
]
self
.
election
=
models
.
Election
.
objects
.
all
()[
0
]
def
test_legacy_format
(
self
):
def
assertEqualsToFile
(
self
,
response
,
file_path
):
response
=
self
.
client
.
get
(
"
/helios/elections/%s
"
%
self
.
election
.
uuid
,
follow
=
False
)
expected
=
open
(
file_path
)
expected
=
open
(
self
.
EXPECTED_OUTPUT_FILE
)
self
.
assertEquals
(
response
.
content
,
expected
.
read
())
self
.
assertEquals
(
response
.
content
,
expected
.
read
())
expected
.
close
()
expected
.
close
()
def
test_election
(
self
):
response
=
self
.
client
.
get
(
"
/helios/elections/%s
"
%
self
.
election
.
uuid
,
follow
=
False
)
self
.
assertEqualsToFile
(
response
,
self
.
EXPECTED_ELECTION_FILE
)
def
test_voters_list
(
self
):
response
=
self
.
client
.
get
(
"
/helios/elections/%s/voters/
"
%
self
.
election
.
uuid
,
follow
=
False
)
self
.
assertEqualsToFile
(
response
,
self
.
EXPECTED_VOTERS_FILE
)
class
ElectionBlackboxTests
(
TestCase
):
class
ElectionBlackboxTests
(
TestCase
):
fixtures
=
[
'
users.json
'
,
'
election.json
'
]
fixtures
=
[
'
users.json
'
,
'
election.json
'
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment