Skip to content
Extraits de code Groupes Projets
Valider 13ad2808 rédigé par Jamesie Pic's avatar Jamesie Pic
Parcourir les fichiers

Tested API

parent 28e591c7
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!13Api pagination
......@@ -7,9 +7,9 @@ python:
before_install:
- pip install codecov
install:
- pip install $DJANGO pep8 flake8 pytest-django pytest-cov codecov
- pip install $DJANGO pep8 flake8 pytest-django pytest-cov codecov django-responsediff
- pip install https://github.com/political-memory/django-representatives/archive/parltrack.tar.gz#egg=django-representatives
- pip install -e .
- pip install -e .[api]
script:
- django-admin migrate
- flake8 representatives_votes/ --exclude migrations --ignore E128
......
Ce diff est replié.
[{"id":1,"fingerprint":"9e2cccdc5f6d22afd008af8b5b55dc193c27c5d6","title":"Agenda for change: the future of EU development policy","reference":"2012/2002(INI)","text":"","link":"http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2012/2002(INI)","url":"http://testserver/api/dossiers/1/?format=json"},{"id":2,"fingerprint":"e6856e0880e701c1022f23d595cc37a9a1cdcca8","title":"2016 general budget: all sections","reference":"2015/2132(BUD)","text":"","link":"http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2015/2132(BUD)","url":"http://testserver/api/dossiers/2/?format=json"}]
\ No newline at end of file
[{"id":1,"fingerprint":"6c1fb67feac3ab2ea567b37aa7dfd0d578bc04b4","dossier":"9e2cccdc5f6d22afd008af8b5b55dc193c27c5d6","dossier_title":"Agenda for change: the future of EU development policy","dossier_reference":"2012/2002(INI)","title":"A7-0234/2012 - Charles Goerens - § 31","description":"","reference":"A7-0234/2012","datetime":"2012-10-23T16:31:10Z","kind":"§ 31","total_abstain":2,"total_against":0,"total_for":0,"url":"http://testserver/api/proposals/1/?format=json"},{"id":2,"fingerprint":"18df8a97581832a95f3bdfb8c14ba2b05abb91e9","dossier":"9e2cccdc5f6d22afd008af8b5b55dc193c27c5d6","dossier_title":"Agenda for change: the future of EU development policy","dossier_reference":"2012/2002(INI)","title":"A7-0234/2012 - Charles Goerens - Résolution","description":"","reference":"A7-0234/2012","datetime":"2012-10-23T16:34:32Z","kind":"Résolution","total_abstain":0,"total_against":0,"total_for":2,"url":"http://testserver/api/proposals/2/?format=json"},{"id":3,"fingerprint":"4e575a1bc17602d23d2f0acf8ee482ebe08de79c","dossier":"e6856e0880e701c1022f23d595cc37a9a1cdcca8","dossier_title":"2016 general budget: all sections","dossier_reference":"2015/2132(BUD)","title":"A8-0298/2015 - José Manuel Fernandes et Gérard Deprez - Am 4","description":"","reference":"A8-0298/2015","datetime":"2015-10-28T11:59:35Z","kind":"Am 4","total_abstain":0,"total_against":2,"total_for":0,"url":"http://testserver/api/proposals/3/?format=json"},{"id":4,"fingerprint":"fc786534e832d9af7e2cdcd0b0952d7d60bb4331","dossier":"e6856e0880e701c1022f23d595cc37a9a1cdcca8","dossier_title":"2016 general budget: all sections","dossier_reference":"2015/2132(BUD)","title":"A8-0298/2015 - José Manuel Fernandes et Gérard Deprez - Am 29","description":"","reference":"A8-0298/2015","datetime":"2015-10-28T12:00:12Z","kind":"Am 29","total_abstain":0,"total_against":1,"total_for":1,"url":"http://testserver/api/proposals/4/?format=json"},{"id":5,"fingerprint":"90c022cf70dc6ceff796b876d3e1b814620c8637","dossier":"e6856e0880e701c1022f23d595cc37a9a1cdcca8","dossier_title":"2016 general budget: all sections","dossier_reference":"2015/2132(BUD)","title":"A8-0298/2015 - José Manuel Fernandes et Gérard Deprez - Am 31","description":"","reference":"A8-0298/2015","datetime":"2015-10-28T12:00:42Z","kind":"Am 31","total_abstain":1,"total_against":1,"total_for":0,"url":"http://testserver/api/proposals/5/?format=json"},{"id":6,"fingerprint":"5b3aa46182803c11d70ccfec666234b9fe2f44a7","dossier":"e6856e0880e701c1022f23d595cc37a9a1cdcca8","dossier_title":"2016 general budget: all sections","dossier_reference":"2015/2132(BUD)","title":"A8-0298/2015 - José Manuel Fernandes et Gérard Deprez - Am 30","description":"","reference":"A8-0298/2015","datetime":"2015-10-28T12:01:09Z","kind":"Am 30","total_abstain":0,"total_against":0,"total_for":2,"url":"http://testserver/api/proposals/6/?format=json"}]
\ No newline at end of file
[{"id":1,"proposal":"6c1fb67feac3ab2ea567b37aa7dfd0d578bc04b4","representative":"314d0f4c25af31bfa2a6b286838367994b902615","representative_name":"","position":"abstain"},{"id":2,"proposal":"6c1fb67feac3ab2ea567b37aa7dfd0d578bc04b4","representative":"2a3c90346d40e9c540050534d832ceb3e0d25a49","representative_name":"","position":"abstain"},{"id":3,"proposal":"18df8a97581832a95f3bdfb8c14ba2b05abb91e9","representative":"314d0f4c25af31bfa2a6b286838367994b902615","representative_name":"","position":"for"},{"id":4,"proposal":"18df8a97581832a95f3bdfb8c14ba2b05abb91e9","representative":"2a3c90346d40e9c540050534d832ceb3e0d25a49","representative_name":"","position":"for"},{"id":5,"proposal":"4e575a1bc17602d23d2f0acf8ee482ebe08de79c","representative":"314d0f4c25af31bfa2a6b286838367994b902615","representative_name":"","position":"against"},{"id":6,"proposal":"4e575a1bc17602d23d2f0acf8ee482ebe08de79c","representative":"2a3c90346d40e9c540050534d832ceb3e0d25a49","representative_name":"","position":"against"},{"id":7,"proposal":"fc786534e832d9af7e2cdcd0b0952d7d60bb4331","representative":"2a3c90346d40e9c540050534d832ceb3e0d25a49","representative_name":"","position":"for"},{"id":8,"proposal":"fc786534e832d9af7e2cdcd0b0952d7d60bb4331","representative":"314d0f4c25af31bfa2a6b286838367994b902615","representative_name":"","position":"against"},{"id":9,"proposal":"90c022cf70dc6ceff796b876d3e1b814620c8637","representative":"2a3c90346d40e9c540050534d832ceb3e0d25a49","representative_name":"","position":"abstain"},{"id":10,"proposal":"90c022cf70dc6ceff796b876d3e1b814620c8637","representative":"314d0f4c25af31bfa2a6b286838367994b902615","representative_name":"","position":"against"},{"id":11,"proposal":"5b3aa46182803c11d70ccfec666234b9fe2f44a7","representative":"2a3c90346d40e9c540050534d832ceb3e0d25a49","representative_name":"","position":"for"}]
\ No newline at end of file
......@@ -12,6 +12,8 @@ DATABASES = {
}
INSTALLED_APPS = (
'django.contrib.staticfiles',
'rest_framework',
'representatives',
'representatives_votes',
)
......@@ -21,6 +23,7 @@ LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
ROOT_URLCONF = 'representatives_votes.tests.urls'
STATIC_URL = '/static/'
USE_I18N = True
USE_L10N = True
USE_TZ = True
......
from django import test
from responsediff.response import Response
class RepresentativeManagerTest(test.TestCase):
fixtures = ['representatives_votes_test.json']
def functional_test(self, queries, url):
with self.assertNumQueries(queries):
result = test.client.Client().get(url)
Response.for_test(self).assertNoDiff(result)
def test_dossiers(self):
self.functional_test(1, '/api/dossiers/?format=json')
def test_proposals(self):
self.functional_test(1, '/api/proposals/?format=json')
def test_votes(self):
self.functional_test(1, '/api/votes/?format=json')
urlpatterns = []
from django.conf.urls import include, url
from rest_framework import routers
from representatives_votes.api import (
DossierViewSet,
ProposalViewSet,
VoteViewSet,
)
router = routers.DefaultRouter()
router.register(r'dossiers', DossierViewSet)
router.register(r'proposals', ProposalViewSet)
router.register(r'votes', VoteViewSet)
urlpatterns = [
url(r'api/', include(router.urls)),
]
......@@ -12,11 +12,17 @@ setup(
license='GPLv3',
keywords='django government parliament votes',
install_requires=[
'django-representatives>=0.0.7',
'django-representatives>=0.0.13',
'py-dateutil',
'pytz',
'ijson',
],
extras_require={
'api': [
'django-filter',
'djangorestframework',
]
},
entry_points={
'console_scripts': [
'parltrack_import_dossiers = representatives_votes.contrib.parltrack.import_dossiers:main',
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter