test_standalone.py 1.34 KB
Newer Older
Maxime Perrotin's avatar
Maxime Perrotin committed
1
2
3
4
5
6
7
8
#!/usr/bin/env python

import sys

sys.path.insert(0, '../..')
from asn1_value_editor import standalone_editor as editor
editor.logger.setLevel(editor.logging.DEBUG)

9
'''
Maxime Perrotin's avatar
Maxime Perrotin committed
10
Use py.test-2.7 to run these tests, and make sure you have installed pytest-qt
11
12
13
pip install --user pytest-qt
'''

14
def test_true(qtbot):
Maxime Perrotin's avatar
Maxime Perrotin committed
15
    ''' Test with a single boolean type '''
Maxime Perrotin's avatar
Maxime Perrotin committed
16
    expected = 'TRUE'
17
    typename = "Ahah"
Maxime Perrotin's avatar
Maxime Perrotin committed
18
    s = editor.SingleValueEditor('data/dv2.asn',
19
20
21
22
23
24
25
26
27
28
29
30
31
32
                                 paramsAndTypes={'param': typename})
    widget = s.setupEdit(typename, defValue=expected)['editor']
    widget.getVariable(dest=widget.asn1Instance)
    result = widget.asn1Instance.GSER()
    print result
    assert result == expected

def test_false(qtbot):
    ''' Test with a single boolean type '''
    expected = 'FALSE'
    typename = "Ahah"
    s = editor.SingleValueEditor('data/dv2.asn',
                                 paramsAndTypes={'param': typename})
    widget = s.setupEdit(typename, defValue=expected)['editor']
Maxime Perrotin's avatar
Maxime Perrotin committed
33
34
35
36
    widget.getVariable(dest=widget.asn1Instance)
    result = widget.asn1Instance.GSER()
    print result
    assert result == expected
Maxime Perrotin's avatar
Maxime Perrotin committed
37
38
39
40
41
42
43


def test_2():
    ''' Test '''
    assert True

if __name__ == '__main__':
Maxime Perrotin's avatar
Maxime Perrotin committed
44
45
46
    print('You must run py.test-2.7 to execute this test script')
    print('Make sure you have pytest-qt (pip install --user pytest-qt)')
    sys.exit(1)