Esempio n. 1
0
 def test_main_cf_exp(self, mock_entry, mock_error):
     config = os.path.join(os.path.dirname(__file__), 'sa.ini')
     mock_entry.side_effect = SaChannelUpdateError("xxx")
     sys.argv = ['__main__', '-c', config]
     main()
     self.assertTrue(mock_entry.called)
     self.assertTrue(mock_error.called)
Esempio n. 2
0
 def test_main_no_cf(self):
     default_cfg = '/etc/sachannelupdate/sachannelupdate.ini'
     sys.argv = ['__main__', '-c', default_cfg]
     with self.assertRaises(SaChannelUpdateConfigError) as cma:
         main()
         self.assertEqual(
             cma.exception.message,
             'The configuration file: %s does not exist' % default_cfg)
Esempio n. 3
0
 def test_main_no_cf(self):
     default_cfg = '/etc/sachannelupdate/sachannelupdate.ini'
     sys.argv = ['__main__', '-c', default_cfg]
     with self.assertRaises(SaChannelUpdateConfigError) as cma:
         main()
         self.assertEqual(
             cma.exception.message,
             'The configuration file: %s does not exist' % default_cfg
         )
Esempio n. 4
0
 def test_main_cf_exp(self, mock_entry, mock_error):
     config = os.path.join(
         os.path.dirname(__file__),
         'sa.ini'
     )
     mock_entry.side_effect = SaChannelUpdateError("xxx")
     sys.argv = ['__main__', '-c', config]
     main()
     self.assertTrue(mock_entry.called)
     self.assertTrue(mock_error.called)
Esempio n. 5
0
 def test_main_cf(self, mock_entry):
     config = os.path.join(os.path.dirname(__file__), 'sa.ini')
     sys.argv = ['__main__', '-c', config]
     main()
     self.assertTrue(mock_entry.called)
Esempio n. 6
0
 def test_main_cf(self, mock_entry):
     config = os.path.join(os.path.dirname(__file__), 'sa.ini')
     sys.argv = ['__main__', '-c', config]
     main()
     self.assertTrue(mock_entry.called)