Skip to content
Extraits de code Groupes Projets

Comparer les révisions

Les modifications sont affichées comme si la révision source était fusionnée avec la révision cible. En savoir plus sur la comparaison des révisions.

Source

Sélectionner le projet cible
No results found

Cible

Sélectionner le projet cible
  • la-quadrature-du-net/memopol/memopol
  • lnclt/political_memory
  • arthur/political_memory
  • agrausem/political_memory
  • periode/memopol
  • Anthony/memopol
  • Porkepix/memopol
  • jaster/memopol
  • luxcem/memopol
  • TAlone/memopol
10 résultats
Afficher les modifications
Affichage de
avec 369 ajouts et 0 suppression
{
"id": 1,
"dossier": "http://testserver/api/dossiers/1/",
"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/",
"votes": [
{
"proposal": "http://testserver/api/proposals/1/",
"representative": "http://testserver/api/representatives/1/",
"position": "abstain"
},
{
"proposal": "http://testserver/api/proposals/1/",
"representative": "http://testserver/api/representatives/2/",
"position": "abstain"
}
]
}
\ No newline at end of file
{
"status_code": 200
}
\ No newline at end of file
[
{
"id": 1,
"dossier": "http://testserver/api/dossiers/1/",
"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/"
},
{
"id": 2,
"dossier": "http://testserver/api/dossiers/1/",
"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/"
},
{
"id": 3,
"dossier": "http://testserver/api/dossiers/2/",
"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/"
},
{
"id": 4,
"dossier": "http://testserver/api/dossiers/2/",
"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/"
},
{
"id": 5,
"dossier": "http://testserver/api/dossiers/2/",
"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/"
},
{
"id": 6,
"dossier": "http://testserver/api/dossiers/2/",
"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/"
}
]
\ No newline at end of file
{
"status_code": 200
}
\ No newline at end of file
{
"proposal": "http://testserver/api/proposals/1/",
"representative": "http://testserver/api/representatives/2/",
"position": "abstain"
}
\ No newline at end of file
{
"status_code": 200
}
\ No newline at end of file
[
{
"proposal": "http://testserver/api/proposals/1/",
"representative": "http://testserver/api/representatives/1/",
"position": "abstain"
},
{
"proposal": "http://testserver/api/proposals/1/",
"representative": "http://testserver/api/representatives/2/",
"position": "abstain"
},
{
"proposal": "http://testserver/api/proposals/2/",
"representative": "http://testserver/api/representatives/1/",
"position": "for"
},
{
"proposal": "http://testserver/api/proposals/2/",
"representative": "http://testserver/api/representatives/2/",
"position": "for"
},
{
"proposal": "http://testserver/api/proposals/3/",
"representative": "http://testserver/api/representatives/1/",
"position": "against"
},
{
"proposal": "http://testserver/api/proposals/3/",
"representative": "http://testserver/api/representatives/2/",
"position": "against"
},
{
"proposal": "http://testserver/api/proposals/4/",
"representative": "http://testserver/api/representatives/1/",
"position": "for"
},
{
"proposal": "http://testserver/api/proposals/4/",
"representative": "http://testserver/api/representatives/2/",
"position": "against"
},
{
"proposal": "http://testserver/api/proposals/5/",
"representative": "http://testserver/api/representatives/1/",
"position": "abstain"
},
{
"proposal": "http://testserver/api/proposals/5/",
"representative": "http://testserver/api/representatives/2/",
"position": "against"
},
{
"proposal": "http://testserver/api/proposals/6/",
"representative": "http://testserver/api/representatives/1/",
"position": "for"
}
]
\ No newline at end of file
{
"status_code": 200
}
\ No newline at end of file
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
SECRET_KEY = 'notsecret'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'test.db'),
}
}
INSTALLED_APPS = (
'django.contrib.staticfiles',
'rest_framework',
'representatives',
'representatives_votes',
)
DEBUG = True
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
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'simple': {
'format': '%(levelname)s[%(module)s]: %(message)s'
},
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'simple'
},
},
'loggers': {
'django': {
'handlers': ['console'],
'level': 'INFO'
},
'representatives': {
'handlers': ['console'],
'level': 'DEBUG'
},
'representatives_votes': {
'handlers': ['console'],
'level': 'DEBUG'
},
},
}
from django import test
from responsediff.response import Response
class RepresentativeManagerTest(test.TestCase):
fixtures = ['representatives_votes_test.json']
def functional_test(self, queries, url):
client = test.client.Client()
client.get(url)
with self.assertNumQueries(queries):
result = client.get(
url,
HTTP_ACCEPT='application/json; indent=4',
)
Response.for_test(self).assertNoDiff(result)
def test_dossier(self):
# One for dossier
# One for proposals
# One for documents
self.functional_test(3, '/api/dossiers/1/')
def test_dossiers(self):
self.functional_test(1, '/api/dossiers/')
def test_proposal(self):
# One for proposal and dossier + 1 for votes
self.functional_test(2, '/api/proposals/1/')
def test_proposals(self):
self.functional_test(1, '/api/proposals/')
def test_vote(self):
self.functional_test(1, '/api/votes/1/')
def test_votes(self):
self.functional_test(1, '/api/votes/')
from django.conf.urls import include, url
from rest_framework import routers
from representatives_votes.api import (
DossierViewSet,
ProposalViewSet,
VoteViewSet,
)
from representatives.api import (
ChamberViewSet,
ConstituencyViewSet,
CountryViewSet,
GroupViewSet,
MandateViewSet,
RepresentativeViewSet,
)
router = routers.DefaultRouter()
router.register('countries', CountryViewSet, 'api-country')
router.register('chambers', ChamberViewSet, 'api-chamber')
router.register('constituencies', ConstituencyViewSet, 'api-constituency')
router.register('groups', GroupViewSet, 'api-group')
router.register('mandates', MandateViewSet, 'api-mandate')
router.register('representatives', RepresentativeViewSet, 'api-representative')
router.register('dossiers', DossierViewSet, 'api-dossier')
router.register('proposals', ProposalViewSet, 'api-proposal')
router.register('votes', VoteViewSet, 'api-vote')
urlpatterns = [
url('api/', include(router.urls)),
]
[tox]
envlist = py27,qa,docs
[testenv]
setenv =
CI=True
DJANGO_DEBUG=True
DJANGO_SETTINGS_MODULE=memopol.settings
passenv = *
usedevelop = true
commands =
pip install -U pip
pip install -U setuptools
pip install -Ue {toxinidir}[testing]
{toxinidir}/src/memopol/bin/install_client_deps.sh
cp {toxinidir}/src/memopol/tests/local_settings.py {toxinidir}/src/memopol/local_settings.py
py.test src/
codecov
bash -c 'createdb -U memopol_test -p 5433 $CI_BUILD_REF_NAME'
memopol migrate
bash -c 'cat src/representatives/contrib/francedata/tests/representatives_input.json | francedata_import_representatives'
bash -c 'cat src/representatives/contrib/parltrack/tests/representatives_fixture.json | parltrack_import_representatives'
bash -c 'cat src/representatives_votes/contrib/francedata/tests/dossiers_input.json | francedata_import_dossiers'
bash -c 'cat src/representatives_votes/contrib/francedata/tests/scrutins_input.json | francedata_import_scrutins'
bash -c 'cat src/representatives_votes/contrib/francedata/tests/votes_input.json | francedata_import_votes'
bash -c 'cat src/representatives_votes/contrib/parltrack/tests/dossiers_fixture.json | parltrack_import_dossiers'
bash -c 'cat src/representatives_votes/contrib/parltrack/tests/votes_fixture.json | parltrack_import_votes'
bash -c 'dropdb -U memopol_test -p 5433 $CI_BUILD_REF_NAME'
whitelist_externals =
psql
cp
createdb
dropdb
bash
[testenv:qa]
skipsdist=True
changedir = {toxinidir}
basepython = python2.7
passenv = *
commands =
pip install -U pip
pip install -U setuptools
pip install -Ue {toxinidir}[testing]
flake8 src --exclude '*/migrations,docs,static' --ignore E128
[testenv:docs]
skipsdist=True
changedir = {toxinidir}/docs
deps =
sphinx
commands =
make html
whitelist_externals =
make