Commit | Line | Data |
---|---|---|
b31bd4ef | 1 | # coding: utf-8 |
155a7c62 CR |
2 | |
3 | from django.test import TestCase | |
4 | ||
b31bd4ef EMS |
5 | class PageLoadTest(TestCase): |
6 | ||
7 | fixtures = ['tests.yaml'] | |
8 | ||
9 | def check_status_200(self, path, data={}): | |
10 | response = self.client.get(path, data) | |
11 | self.assertEqual(response.status_code, 200) | |
12 | ||
13 | def test_accueil(self): | |
14 | self.check_status_200('/') | |
15 | self.check_status_200('/region/1/') | |
16 | self.check_status_200('/discipline/1/') | |
17 | self.check_status_200('/discipline/1/region/1/') | |
18 | ||
19 | def test_recherche(self): | |
20 | self.check_status_200('/recherche/', dict(q='francophonie')) | |
21 | self.check_status_200('/region/1/recherche/', dict(q=u'université')) | |
22 | self.check_status_200('/discipline/1/recherche/', dict(q='ours noir')) | |
23 | self.check_status_200('/discipline/1/region/1/recherche/', dict(q='orientations -australie')) | |
24 | ||
25 | def test_ressources(self): | |
26 | self.check_status_200('/ressources/') | |
fdcf5874 EMS |
27 | self.check_status_200('/ressources/', { |
28 | 'q': "recherche textuelle", | |
29 | 'auteur': 'Un auteur', | |
30 | 'titre': 'Un titre', | |
31 | 'sujet': 'Un sujet', | |
32 | 'publisher': "Jean l'éditeur", | |
33 | 'discipline': 1, | |
34 | 'region': 1 | |
35 | }) | |
b31bd4ef EMS |
36 | |
37 | def test_ressource(self): | |
38 | self.check_status_200('/ressources/1/') | |
39 | ||
40 | def test_agenda(self): | |
41 | self.check_status_200('/agenda/') | |
fdcf5874 EMS |
42 | self.check_status_200('/agenda/', { |
43 | 'q': 'foo', | |
44 | 'titre': 'bar', | |
45 | 'type': 'Colloque', | |
46 | 'date_min': '18/01/2001', | |
47 | 'date_max': '20/01/2001', | |
48 | 'discipline': 1, | |
49 | 'region': 1 | |
50 | }) | |
b31bd4ef EMS |
51 | self.check_status_200('/agenda/evenements/utilisation/') |
52 | self.check_status_200('/agenda/evenements/creer/') | |
53 | ||
54 | def test_evenement(self): | |
55 | self.check_status_200('/agenda/evenements/1/') | |
48859cb6 | 56 | |
b31bd4ef EMS |
57 | def test_actualites(self): |
58 | self.check_status_200('/actualites/') | |
fdcf5874 EMS |
59 | self.check_status_200('/actualites/', { |
60 | 'q': 'mots-clés', | |
61 | 'date_min': '01/01/2011', | |
62 | 'date_max': '31/12/2011', | |
63 | 'discipline': 1, | |
64 | 'region': 1 | |
65 | }) | |
011804bb EMS |
66 | self.check_status_200('/rss/actualites/') |
67 | ||
68 | def test_actualite(self): | |
69 | self.check_status_200('/actualites/1/') | |
70 | self.check_status_200('/actualites/2/') | |
71 | ||
72 | def test_appels(self): | |
73 | self.check_status_200('/appels/') | |
fdcf5874 EMS |
74 | self.check_status_200('/appels/', { |
75 | 'q': 'mots-clés', | |
76 | 'date_min': '01/01/2011', | |
77 | 'date_max': '31/12/2011', | |
78 | 'discipline': 1, | |
79 | 'region': 1 | |
80 | }) | |
011804bb | 81 | self.check_status_200('/rss/appels/') |
b31bd4ef EMS |
82 | |
83 | def test_chercheurs(self): | |
84 | self.check_status_200('/chercheurs/') | |
fdcf5874 EMS |
85 | self.check_status_200('/chercheurs/', { |
86 | 'q': 'texte texte', | |
87 | 'nom_chercheur': 'Ted Kennedy', | |
88 | 'domaine': 1, | |
fdcf5874 EMS |
89 | 'statut': 'expert', |
90 | 'discipline': 1, | |
693c606b | 91 | 'pays': 1, |
fdcf5874 EMS |
92 | 'region': 1, |
93 | 'nord_sud': 'Nord', | |
94 | 'activites_francophonie': 'instance_auf', | |
95 | 'genre': 'm' | |
96 | }) | |
7020ea3d EMS |
97 | self.check_status_200('/chercheurs/', dict(tri='nom')) |
98 | self.check_status_200('/chercheurs/', dict(tri='nom_desc')) | |
99 | self.check_status_200('/chercheurs/', dict(tri='etablissement')) | |
100 | self.check_status_200('/chercheurs/', dict(tri='etablissement_desc')) | |
101 | self.check_status_200('/chercheurs/', dict(tri='pays')) | |
102 | self.check_status_200('/chercheurs/', dict(tri='pays_desc')) | |
b31bd4ef EMS |
103 | |
104 | def test_sites(self): | |
105 | self.check_status_200('/sites/') | |
fdcf5874 EMS |
106 | self.check_status_200('/sites/', { |
107 | 'q': 'recherche', | |
108 | 'discipline': 1, | |
693c606b | 109 | 'pays': 1, |
fdcf5874 EMS |
110 | 'region': 1 |
111 | }) | |
b31bd4ef EMS |
112 | |
113 | def test_sites_auf(self): | |
114 | self.check_status_200('/sites-auf/') | |
155a7c62 | 115 | |
b31bd4ef EMS |
116 | def test_contact(self): |
117 | self.check_status_200('/nous-contacter/') | |
155a7c62 | 118 | |
b31bd4ef EMS |
119 | def test_legal(self): |
120 | self.check_status_200('/legal/') | |
155a7c62 | 121 | |
b31bd4ef EMS |
122 | def test_a_propos(self): |
123 | self.check_status_200('/a-propos/') | |
2af3293d EMS |
124 | |
125 | def test_aide(self): | |
126 | self.check_status_200('/aide/') | |
7ed3ee8f EMS |
127 | |
128 | def test_rss(self): | |
129 | for brique in ['chercheurs', 'ressources', 'actualites', 'appels', 'agenda', 'sites']: | |
130 | self.check_status_200('/rss/ressources/') | |
131 | self.check_status_200('/rss/ressources/', {'q': 'test'}) |