Projet

Général

Profil

0001-tests-add-test-on-javascript-data-rendering.patch

Benjamin Dauvergne, 13 janvier 2020 15:15

Télécharger (1,69 ko)

Voir les différences:

Subject: [PATCH 1/3] tests: add test on javascript data rendering

 tests/test_schema1.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
tests/test_schema1.py
1 1
# -*- coding: utf-8 -*-
2 2

  
3
import json
4

  
3 5
from utils import login, get_table, get_ods_table, get_ods_document
4 6

  
5 7
from bijoe.visualization.ods import OFFICE_NS, TABLE_NS
8
from bijoe.visualization.utils import Visualization
6 9

  
7 10

  
8 11
def test_simple(schema1, app, admin):
......
87 90
    assert get_table(response) == [['String', 'a', 'b', 'c', 'Aucun(e)'], ['number of rows', '11', '2', '0', '1']]
88 91

  
89 92

  
93
def test_string_dimension_json_data(schema1, app, admin):
94
    # test conversion to Javascript declaration
95
    visu = Visualization.from_json({
96
        'warehouse': 'schema1',
97
        'cube': 'facts1',
98
        'representation': 'table',
99
        'measure': 'simple_count',
100
        'drilldown_x': 'string'
101
    })
102
    assert json.loads(json.dumps(visu.json_data())) == [
103
        {u'coords': [{u'value': u'a'}], u'measures': [{u'value': 11}]},
104
        {u'coords': [{u'value': u'b'}], u'measures': [{u'value': 2}]},
105
        {u'coords': [{u'value': u'c'}], u'measures': [{u'value': 3}]},
106
        {u'coords': [{u'value': u'Aucun(e)'}], u'measures': [{u'value': 1}]}
107
    ]
108

  
109

  
90 110
def test_item_dimension(schema1, app, admin):
91 111
    login(app, admin)
92 112
    response = app.get('/').follow()
93
-