Commit 1d16abcb authored by robin Tissot's avatar robin Tissot Committed by Robin

Dossier detail tests

parent 4b369d1a
...@@ -22038,8 +22038,10 @@ ...@@ -22038,8 +22038,10 @@
"updated": "2015-12-27T17:40:18.700Z", "updated": "2015-12-27T17:40:18.700Z",
"reference": "2010/2935(RSP)", "reference": "2010/2935(RSP)",
"title": "Resolution on the Anti-Counterfeiting Trade Agreement (ACTA)", "title": "Resolution on the Anti-Counterfeiting Trade Agreement (ACTA)",
"text": "", "text": "6.20 Common commercial policy in general\n6.20.01 Agreements and relations in the context of the World Trade Organization (WTO)\n7.30.30.10 Action against counterfeiting",
"created": "2015-12-27T17:40:18.700Z" "created": "2015-12-27T17:40:18.700Z",
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2010/2935(RSP)",
"fingerprint": "30ca011fd2991db0e6de50aef0d76e83530003a6"
}, },
"model": "representatives_votes.dossier", "model": "representatives_votes.dossier",
"pk": 28147 "pk": 28147
......
<div class="page-header">
<h2>LQDN's opinion</h2>
</div>
<p>6.20 Common commercial policy in general
6.20.01 Agreements and relations in the context of the World Trade Organization (WTO)
7.30.30.10 Action against counterfeiting</p>
<div class="panel-group" id="accordion-proposals" role="tablist" aria-multiselectable="true">
<table class="table table-hover text-center">
<colgroup>
<col class="col-md-2">
</colgroup>
<thead>
<tr>
<th class="text-center"></th>
<th class="text-center">B7-0617/2010</th>
<th class="text-center">B7-0617/2010</th>
<th class="text-center">B7-0617/2010</th>
</tr>
</thead>
<tbody>
<tr class="small">
<td>Date</td>
<td>Nov. 24, 2010</td>
<td>Nov. 24, 2010</td>
<td>Nov. 24, 2010</td>
</tr>
<tr>
<th>Lqdn's recommendation</th>
<td><span class="glyphicon glyphicon-ok"></span></td>
<td><span class="glyphicon glyphicon-ok"></span></td>
<td><span class="glyphicon glyphicon-ok"></span></td>
</tr>
<tr>
<th>Zigmantas BALČYTIS</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
</tr>
<tr>
<th>Vilija BLINKEVIČIŪTĖ</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
</tr>
<tr>
<th>Elmar BROK</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
</tr>
<tr>
<th>Cristian-Silviu BUŞOI</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
</tr>
<tr>
<th>David CASA</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
</tr>
<tr>
<th>Jean-Marie CAVADA</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
</tr>
<tr>
<th>Nikolaos CHOUNTIS</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
</tr>
<tr>
<th>Michael CRAMER</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
</tr>
<tr>
<th>Michel DANTIN</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
</tr>
<tr>
<th>Tamás DEUTSCH</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
</tr>
<tr>
<th>Viorica DĂNCILĂ</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
</tr>
<tr>
<th>Bas EICKHOUT</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
</tr>
<tr>
<th>Ismail ERTUG</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
</tr>
<tr>
<th>José Manuel FERNANDES</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
</tr>
<tr>
<th>Monika FLAŠÍKOVÁ BEŇOVÁ</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
</tr>
<tr>
<th>Ashley FOX</th>
<td>
<span class="glyphicon glyphicon-ok text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
</tr>
<tr>
<th>Eider GARDIAZABAL RUBIAL</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
</tr>
<tr>
<th>Kinga GÁL</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
</tr>
<tr>
<th>Ildikó GÁLL-PELCZ</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
</tr>
<tr>
<th>Marian HARKIN</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
</tr>
<tr>
<th>Mary HONEYBALL</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
</tr>
<tr>
<th>Iliana IOTOVA</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
</tr>
<tr>
<th>Liisa JAAKONSAARI</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
</tr>
<tr>
<th>Yannick JADOT</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
</tr>
<tr>
<th>Eva JOLY</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
</tr>
<tr>
<th>Jarosław KALINOWSKI</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
</tr>
<tr>
<th>Andrey KOVATCHEV</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
</tr>
<tr>
<th>Olle LUDVIGSSON</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
</tr>
<tr>
<th>Sirpa PIETIKÄINEN</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
</tr>
<tr>
<th>Frédérique RIES</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
</tr>
<tr>
<th>Birgit SIPPEL</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
</tr>
<tr>
<th>Charles TANNOCK</th>
<td>
<span class="glyphicon glyphicon-ok text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
</tr>
<tr>
<th>Ramon TREMOSA i BALCELLS</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
</tr>
<tr>
<th>Vladimir URUTCHEV</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
</tr>
<tr>
<th>Ivo VAJGL</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
</tr>
<tr>
<th>Cecilia WIKSTRÖM</th>
<td>
<span class="glyphicon glyphicon-ok glyphicon-ok text-success"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
<td>
<span class="glyphicon glyphicon-ok glyphicon-remove text-danger"></span>
</td>
</tr>
</tbody>
</table>
</div>
from django.test import TestCase
from .base import UrlGetTestMixin
class DossierDetailTest(UrlGetTestMixin, TestCase):
fixtures = ['smaller_sample.json']
url = '/votes/dossier/28147/'
def test_num_queries(self):
"""
1) fetch the dossier
2) fetch the proposals
3) fetch the representatives
4) prefetch the votes
"""
# Ensure one-time cached queries occur before the actual test
self.client.get(self.url)
with self.assertNumQueries(4):
self.client.get(self.url)
def test_title_display(self):
self.assertHtmlInResult("<h1 class='text-center'>Dossier Resolution on the Anti-Counterfeiting Trade Agreement (ACTA)</h1>")
def test_date_display(self):
self.assertHtmlInResult("<p class='lead text-center'>Last updated Dec. 27, 2015</p>")
def test_description_display(self):
resp = self.client.get(self.url)
with open("t.html", 'w+') as f:
f.write(resp.content)
self.assertExpectedHtmlInResult()
def test_votes_display(self):
self.assertExpectedHtmlInResult()
# -*- coding: utf8 -*- # -*- coding: utf-8 -*-
from django.test import TestCase from django.test import TestCase
from .base import UrlGetTestMixin from .base import UrlGetTestMixin
......
...@@ -4,7 +4,11 @@ ...@@ -4,7 +4,11 @@
<div class="panel-group" id="accordion-proposals" role="tablist" aria-multiselectable="true"> <div class="panel-group" id="accordion-proposals" role="tablist" aria-multiselectable="true">
<table class="table table-hover text-center "> <table class="table table-hover text-center">
<colgroup>
{# justifies first col all at once #}
<col class="col-md-2">
</colgroup>
<thead> <thead>
<tr> <tr>
...@@ -42,7 +46,7 @@ ...@@ -42,7 +46,7 @@
</tr> </tr>
{% comment %} {% comment %}
<!-- TODO: regroup by main_mandate but might be very query heavy --> <!-- TODO: regroup by representative.main_mandate but might be very query heavy -->
<tr> <tr>
<th> <th>
<a class="btn btn-sm btn-default" role="button" data-toggle="collapse" href="#collapse-PartyChose" aria-expanded="false" aria-controls="collapse-PartyChose">Party chose <span class="caret"></span></a> <a class="btn btn-sm btn-default" role="button" data-toggle="collapse" href="#collapse-PartyChose" aria-expanded="false" aria-controls="collapse-PartyChose">Party chose <span class="caret"></span></a>
...@@ -52,8 +56,7 @@ ...@@ -52,8 +56,7 @@
{% for representative in representatives %} {% for representative in representatives %}
<tr> <tr>
<th>{{ representative.full_name }} <th>{{ representative.full_name }}</th>
</th>
{% for proposal in proposals %} {% for proposal in proposals %}
{# Note: the manager has been fed with only the relevant data #} {# Note: the manager has been fed with only the relevant data #}
{# so representative.votes.all only contains votes from the relevant proposals #} {# so representative.votes.all only contains votes from the relevant proposals #}
......
...@@ -9,22 +9,22 @@ ...@@ -9,22 +9,22 @@
<p class="lead text-center">{% trans "Last updated" %} {{ dossier.updated|naturalday }}</p> <p class="lead text-center">{% trans "Last updated" %} {{ dossier.updated|naturalday }}</p>
{% if dossier.text %}
<div class="page-header"> <div class="page-header">
<h2>{% trans "LQDN's opinion" %}</h2> <h2>{% trans "LQDN's opinion" %}</h2>
</div> </div>
<p>{{ dossier.text }}</p> <p>{{ dossier.text }}</p>
{% endif %}
{% comment %} {% if dossier.link %}
<!-- TODO -->
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="pull-right"> <div class="pull-right">
<a class="btn btn-default">See Press Releases</a> <a class="btn btn-default" href="{{ dossier.link }}">{% trans "See details" %}</a>
</div> </div>
</div> </div>
</div> </div>
{% endcomment %} {% endif %}
{% comment %} {% comment %}
<!-- TODO --> <!-- TODO -->
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
</div> </div>
{% endcomment %} {% endcomment %}