コード例 #1
0
ファイル: installer_test.py プロジェクト: elwan/glazier
 def testAddChoiceValidate(self):
     choice = {
         'type':
         'toggle',
         'prompt':
         'Set system shell to PowerShell',
         'name':
         'core_ps_shell',
         'options': [{
             'tip': '',
             'value': False,
             'label': 'False'
         }, {
             'default': True,
             'tip': '',
             'value': True,
             'label': 'True'
         }]
     }
     a = installer.AddChoice(choice, None)
     a.Validate()
     # prompt (name, type)
     choice['name'] = True
     self.assertRaises(installer.ValidationError, a.Validate)
     # tip
     choice['name'] = 'core_ps_shell'
     choice['options'][0]['tip'] = True
     self.assertRaises(installer.ValidationError, a.Validate)
     # default
     choice['options'][0]['tip'] = ''
     choice['options'][0]['default'] = 3
     self.assertRaises(installer.ValidationError, a.Validate)
     # label
     choice['options'][0]['default'] = True
     choice['options'][0]['label'] = False
     self.assertRaises(installer.ValidationError, a.Validate)
     # value
     choice['options'][0]['label'] = 'False'
     choice['options'][0]['value'] = []
     self.assertRaises(installer.ValidationError, a.Validate)
     # options dict
     choice['options'][0] = False
     self.assertRaises(installer.ValidationError, a.Validate)
     # options list
     choice['options'] = False
     self.assertRaises(installer.ValidationError, a.Validate)
     del choice['name']
     self.assertRaises(installer.ValidationError, a.Validate)
     a = installer.AddChoice(False, None)
     self.assertRaises(installer.ValidationError, a.Validate)
コード例 #2
0
ファイル: installer_test.py プロジェクト: elwan/glazier
 def testAddChoice(self, build_info):
     choice = {
         'type':
         'toggle',
         'prompt':
         'Set system shell to PowerShell',
         'name':
         'core_ps_shell',
         'options': [{
             'tip': '',
             'value': False,
             'label': 'False'
         }, {
             'default': True,
             'tip': '',
             'value': True,
             'label': 'True'
         }]
     }
     a = installer.AddChoice(choice, build_info)
     a.Run()
     build_info.AddChooserOption.assert_called_with(choice)