test_home_navigation_pane.py 1.45 KB
Newer Older
Nicolas Joyard's avatar
Nicolas Joyard committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from .base import BaseTest


class NavigationPaneTest(BaseTest):
    url = '/'

    def test_queries(self):
        # First query to set session variables
        self.client.get(self.url)

        """
        Today mep
        - 1 for count reps with non null score
        - 1 for random mep
        - 1 for prefetch main mandate
        Latest votes
        - 1 for latest votes count setting
        - 1 for latest votes (proposal)
        - 1 for prefetching latest votes themes
        - 1 for prefetching latest votes dossier themes
        - 1 for prefetching latest votes dossier documents
        - 1 for prefetching latest votes dossier documents chambers
        Featured themes
        - 1 for featured themes
        """
        home_queries = 10

        with self.assertNumQueries(self.left_pane_queries + home_queries):
            self.client.get(self.url)

    def test_rep_search_chambers(self):
        self.selector_test('#form-rep #chamber-rep option')

    def test_rep_search_countries(self):
        self.selector_test('#form-rep #country option')

    def test_rep_search_parties(self):
        self.selector_test('#form-rep #party option')

    def test_rep_search_committee(self):
        self.selector_test('#form-rep #committee option')

    def test_rep_search_delegation(self):
        self.selector_test('#form-rep #delegation option')

    def test_dossier_search_chambers(self):
        self.selector_test('#form-dossier #chamber-dossier option')