Projet

Général

Profil

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

Benjamin Dauvergne, 15 janvier 2020 23:43

Télécharger (1,42 ko)

Voir les différences:

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

 tests/test_schema1.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
tests/test_schema1.py
91 91
    assert get_table(response) == [['String', 'a', 'b', 'c', 'Aucun(e)'], ['number of rows', '11', '2', '0', '1']]
92 92

  
93 93

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

  
110

  
94 111
def test_item_dimension(schema1, app, admin):
95 112
    login(app, admin)
96 113
    response = app.get('/').follow()
97
-