Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
TAlone
memopol
Commits
2ce4e910
Commit
2ce4e910
authored
Aug 07, 2016
by
jer-pages
Browse files
Test for score multiplier
parent
42871fd2
Changes
1
Hide whitespace changes
Inline
Side-by-side
representatives_recommendations/tests/test_scores.py
0 → 100644
View file @
2ce4e910
from
django
import
test
from
datetime
import
datetime
from
representatives_votes.models
import
Proposal
,
Dossier
,
Vote
from
representatives.models
import
Representative
,
Group
from
representatives_recommendations.models
import
Recommendation
class
TestScores
(
test
.
TestCase
):
def
test_group_scores
(
self
):
prop
=
Proposal
.
objects
.
create
(
dossier
=
Dossier
.
objects
.
create
(
title
=
self
.
id
(),
reference
=
self
.
id
()
),
title
=
self
.
id
(),
datetime
=
datetime
.
now
(),
total_abstain
=
1
,
total_against
=
2
,
total_for
=
3
)
prop
.
recommendation
=
Recommendation
.
objects
.
create
(
proposal
=
prop
,
recommendation
=
"for"
,
weight
=
10
)
mep0
=
Representative
.
objects
.
create
(
slug
=
"mep0"
,
full_name
=
"mep0"
)
mep1
=
Representative
.
objects
.
create
(
slug
=
"mep1"
,
full_name
=
"mep1"
)
mep2
=
Representative
.
objects
.
create
(
slug
=
"mep2"
,
full_name
=
"mep2"
)
group
=
Group
.
objects
.
create
(
name
=
"group"
,
kind
=
"group"
)
mep0
.
mandates
.
create
(
group
=
group
,
link
=
"http://"
)
mep1
.
mandates
.
create
(
group
=
group
,
link
=
"http://"
)
mep2
.
mandates
.
create
(
group
=
group
,
link
=
"http://"
)
mep0
.
votes
.
create
(
proposal
=
prop
,
position
=
"for"
)
mep1
.
votes
.
create
(
proposal
=
prop
,
position
=
"for"
)
mep2
.
votes
.
create
(
proposal
=
prop
,
position
=
"against"
)
self
.
assertEqual
(
mep0
.
score
.
score
,
10
)
self
.
assertEqual
(
mep1
.
score
.
score
,
10
)
self
.
assertEqual
(
mep2
.
score
.
score
,
-
15
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment