-
Notifications
You must be signed in to change notification settings - Fork 1
/
arch_test.py
50 lines (42 loc) · 1.58 KB
/
arch_test.py
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
48
49
50
import unittest
from arch import *
class MenuTest(unittest.TestCase):
def test_menu_attributes(self):
menu = InstallationGuide()
self.assertEqual("Installation Guide", menu.title)
submenus = menu.submenus
self.assertEqual(5, len(submenus))
self.assertEqual(4, submenus[3].number)
self.assertListEqual([4], submenus[3].hierarchy)
class ChoicesTest(unittest.TestCase):
def test_simple(self):
choice = Choice({
'1': 'One',
'f': ' respecc'
}, '1')
self.assertListEqual(['1', 'f'], choice.choices)
self.assertListEqual(['One', ' respecc'], choice.descriptions)
self.assertTrue('One' in choice.descriptions_formatted[0])
self.assertEqual('1', choice.default)
def test_with_return(self):
choice = ChoiceWithReturn({
'1': 'One',
'f': ' respecc'
}, 'r')
self.assertListEqual(['1', 'f', 'r'], choice.choices)
self.assertListEqual(['One', ' respecc', 'Return'], choice.descriptions)
self.assertTrue('One' in choice.descriptions_formatted[0])
self.assertEqual('r', choice.default)
def test_menu(self):
choice = MenuChoice(InstallationGuide())
self.assertListEqual(['1', '2', '3', '4', '5', 'r'], choice.choices)
self.assertListEqual([
'Pre-installation',
'Installation',
'Configure the system',
'Reboot',
'Post-installation',
'Return'
], choice.descriptions)
if __name__ == '__main__':
unittest.main()