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
5bbd7d59
Commit
5bbd7d59
authored
Aug 22, 2013
by
Ben Adida
Browse files
Options
Downloads
Patches
Plain Diff
fixed all but one tests
parent
f276637d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
helios/tests.py
+36
-15
36 additions, 15 deletions
helios/tests.py
with
36 additions
and
15 deletions
helios/tests.py
+
36
−
15
View file @
5bbd7d59
...
...
@@ -395,6 +395,22 @@ class ElectionBlackboxTests(WebTest):
self
.
election
=
models
.
Election
.
objects
.
all
()[
0
]
self
.
user
=
auth_models
.
User
.
objects
.
get
(
user_id
=
'
ben@adida.net
'
,
user_type
=
'
google
'
)
def
assertContains
(
self
,
response
,
text
):
if
hasattr
(
response
,
'
status_code
'
):
assert
response
.
status_code
==
200
# return super(django_webtest.WebTest, self).assertContains(response, text)
else
:
assert
response
.
status_int
==
200
if
hasattr
(
response
,
"
testbody
"
):
assert
text
in
response
.
testbody
,
"
missing text %s
"
%
text
else
:
if
hasattr
(
response
,
"
body
"
):
assert
text
in
response
.
body
,
"
missing text %s
"
%
text
else
:
assert
text
in
response
.
content
,
"
missing text %s
"
%
text
def
setup_login
(
self
):
# set up the session
session
=
self
.
client
.
session
...
...
@@ -402,7 +418,9 @@ class ElectionBlackboxTests(WebTest):
session
.
save
()
# set up the app, too
self
.
app
.
cookies
[
'
sessionid
'
]
=
self
.
client
.
cookies
.
get
(
'
sessionid
'
).
value
# this does not appear to work, boohoo
session
=
self
.
app
.
session
session
[
'
user
'
]
=
{
'
type
'
:
self
.
user
.
user_type
,
'
user_id
'
:
self
.
user
.
user_id
}
def
clear_login
(
self
):
session
=
self
.
client
.
session
...
...
@@ -732,7 +750,7 @@ class ElectionBlackboxTests(WebTest):
# create the election
self
.
client
.
get
(
"
/
"
)
self
.
setup_login
()
response
=
self
.
app
.
post
(
"
/helios/elections/new
"
,
{
response
=
self
.
client
.
post
(
"
/helios/elections/new
"
,
{
"
short_name
"
:
"
test-eligibility
"
,
"
name
"
:
"
Test Eligibility
"
,
"
description
"
:
"
An election test for voter eligibility
"
,
...
...
@@ -741,22 +759,25 @@ class ElectionBlackboxTests(WebTest):
"
use_advanced_audit_features
"
:
"
1
"
,
"
private_p
"
:
"
0
"
})
election_id
=
re
.
match
(
"
(.*)/elections/(.*)/view
"
,
response
.
l
ocation
).
group
(
2
)
election_id
=
re
.
match
(
"
(.*)/elections/(.*)/view
"
,
response
[
'
L
ocation
'
]
).
group
(
2
)
# get the eligibility page
eligibility_page
=
self
.
app
.
get
(
"
/helios/elections/%s/voters/list
"
%
election_id
)
elig_form
=
eligibility_page
.
form
elig_form
[
'
eligibility
'
]
=
'
openreg
'
elig_page
=
elig_form
.
submit
().
follow
()
# update eligiblity
response
=
self
.
client
.
post
(
"
/helios/elections/%s/voters/eligibility
"
%
election_id
,
{
"
csrf_token
"
:
self
.
client
.
session
[
'
csrf_token
'
],
"
eligibility
"
:
"
openreg
"
})
self
.
assertContains
(
elig_page
,
"
Anyone can vote
"
)
self
.
clear_login
()
response
=
self
.
client
.
get
(
"
/helios/elections/%s/voters/list
"
%
election_id
)
self
.
assertContains
(
response
,
"
Anyone can vote
"
)
elig_form
=
elig_page
.
form
elig_form
[
'
eligibility
'
]
=
'
closedreg
'
elig_page
=
elig_form
.
submit
().
follow
()
self
.
setup_login
()
response
=
self
.
client
.
post
(
"
/helios/elections/%s/voters/eligibility
"
%
election_id
,
{
"
csrf_token
"
:
self
.
client
.
session
[
'
csrf_token
'
],
"
eligibility
"
:
"
closedreg
"
})
self
.
assertContains
(
elig_page
,
"
Only the voters listed here
"
)
self
.
clear_login
()
response
=
self
.
client
.
get
(
"
/helios/elections/%s/voters/list
"
%
election_id
)
self
.
assertContains
(
response
,
"
Only the voters listed here
"
)
def
test_do_complete_election_with_trustees
(
self
):
"""
...
...
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