Commit 31e0c1d8 authored by okhin's avatar okhin 🚴

Adding tests for filters

parent cb6d3c7c
Pipeline #897 failed with stage
in 5 minutes and 30 seconds
......@@ -14,11 +14,11 @@ PUBLIC_DIR = 'wsgi/static'
DATABASES = {
'default': {
'NAME': os.environ.get('CI_BUILD_REF_NAME'),
'NAME': 'test',
'USER': 'memopol_test',
'PASSWORD': 'memopol_test',
'HOST': 'localhost',
'PORT': '5433',
'PORT': '5432',
'ENGINE': 'django.db.backends.postgresql_psycopg2',
}
}
......
[{"id":2,"url":"http://testserver/api/representatives/2/?format=json","slug":"olle-ludvigsson-1948-10-28","first_name":"Olle","last_name":"LUDVIGSSON","full_name":"Olle LUDVIGSSON","gender":2,"birth_place":"Hälsö","birth_date":"1948-10-28","photo":"http://www.europarl.europa.eu/mepphoto/96673.jpg","active":true,"cv":"","contacts":{"emails":[{"email":"olle.ludvigsson@europarl.europa.eu","kind":"official"}],"phones":[{"number":"+322 28 45442","kind":"office phone"},{"number":"+333 88 1 75442","kind":"office phone"}],"websites":[{"url":"http://www.sap.se/olle","kind":""},{"url":"http://twitter.com/olleludvigsson","kind":"twitter"},{"url":"https://www.facebook.com/olle.ludvigsson","kind":"facebook"},{"url":"http://www.europarl.europa.eu/meps/en/96673/_home.html","kind":"EP"}],"address":[{"country":{"id":1050,"url":"http://testserver/api/countries/1050/?format=json","name":"Belgium","code":"BE"},"city":"Brussels","street":"rue Wiertz / Wiertzstraat","number":"60","postcode":"1047","floor":"14G","office_number":"257","kind":"official"},{"country":{"id":1095,"url":"http://testserver/api/countries/1095/?format=json","name":"France","code":"FR"},"city":"Strasbourg","street":"Av. du Président Robert Schuman - CS 91024","number":"1","postcode":"67070","floor":"T07","office_number":"070","kind":"official"}]},"mandates":[{"id":9,"url":"http://testserver/api/mandates/9/?format=json","group":{"id":8,"url":"http://testserver/api/groups/8/?format=json","name":"Committee on Economic and Monetary Affairs","abbreviation":"ECON","kind":"committee"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"2014-07-01","end_date":"9999-12-31"},{"id":10,"url":"http://testserver/api/mandates/10/?format=json","group":{"id":9,"url":"http://testserver/api/groups/9/?format=json","name":"Committee on Industry, Research and Energy","abbreviation":"ITRE","kind":"committee"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Substitute","begin_date":"2014-07-08","end_date":"9999-12-31"},{"id":11,"url":"http://testserver/api/mandates/11/?format=json","group":{"id":8,"url":"http://testserver/api/groups/8/?format=json","name":"Committee on Economic and Monetary Affairs","abbreviation":"ECON","kind":"committee"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Substitute","begin_date":"2009-07-16","end_date":"2012-01-18"},{"id":12,"url":"http://testserver/api/mandates/12/?format=json","group":{"id":10,"url":"http://testserver/api/groups/10/?format=json","name":"Delegation to the EU-Serbia Stabilisation and Association Parliamentary Committee","abbreviation":"","kind":"delegation"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"2014-07-14","end_date":"9999-12-31"},{"id":13,"url":"http://testserver/api/mandates/13/?format=json","group":{"id":11,"url":"http://testserver/api/groups/11/?format=json","name":"Delegation for relations with Bosnia and Herzegovina, and Kosovo","abbreviation":"","kind":"delegation"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Substitute","begin_date":"2015-05-18","end_date":"9999-12-31"},{"id":14,"url":"http://testserver/api/mandates/14/?format=json","group":{"id":12,"url":"http://testserver/api/groups/12/?format=json","name":"Delegation for relations with Australia and New Zealand","abbreviation":"","kind":"delegation"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Substitute","begin_date":"2009-09-17","end_date":"2013-01-10"},{"id":15,"url":"http://testserver/api/mandates/15/?format=json","group":{"id":13,"url":"http://testserver/api/groups/13/?format=json","name":"Group of the Progressive Alliance of Socialists and Democrats in the European Parliament","abbreviation":"SD","kind":"group"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"2014-07-01","end_date":"9999-12-31"},{"id":16,"url":"http://testserver/api/mandates/16/?format=json","group":{"id":13,"url":"http://testserver/api/groups/13/?format=json","name":"Group of the Progressive Alliance of Socialists and Democrats in the European Parliament","abbreviation":"SD","kind":"group"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"2009-07-14","end_date":"2014-06-30"},{"id":17,"url":"http://testserver/api/mandates/17/?format=json","group":{"id":14,"url":"http://testserver/api/groups/14/?format=json","name":"Sweden","abbreviation":"SE","kind":"country"},"constituency":{"id":3,"url":"http://testserver/api/constituencies/3/?format=json","name":"Arbetarepartiet- Socialdemokraterna"},"role":"","begin_date":"2014-07-01","end_date":"9999-12-31"},{"id":18,"url":"http://testserver/api/mandates/18/?format=json","group":{"id":14,"url":"http://testserver/api/groups/14/?format=json","name":"Sweden","abbreviation":"SE","kind":"country"},"constituency":{"id":3,"url":"http://testserver/api/constituencies/3/?format=json","name":"Arbetarepartiet- Socialdemokraterna"},"role":"","begin_date":"2009-07-14","end_date":"2014-06-30"}]}]
\ No newline at end of file
......@@ -40,3 +40,14 @@ class RepresentativeManagerTest(test.TestCase):
- mandates.
"""
self.functional_test(6, '/api/representatives/?format=json')
# Test the filters
def test_representatives_api_mandates(self):
self.functional_test(1, '/api/representatives/'
+ '?active_mandates=INTA'
+ '&format=json')
def test_representatives_api_constituency(self):
self.functional_test(6, '/api/representatives/'
+ '?active_constituency=European%20Parliament'
+ '&format=json')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment