def testValidateMode(self): # ensure that if mode is not set, exception is thrown config = snap.config.Config() with self.assertRaises(snap.exceptions.ArgError) as context: config.verify_integrity() self.assertEqual(context.exception.message, 'Must specify backup or restore') pass
def testValidateRestoreSnapFile(self): # ensure that if snapfile is not set, error is thrown snap.config.options.mode = snap.config.ConfigOptions.RESTORE snap.config.options.snapfile = None config = snap.config.Config() with self.assertRaises(snap.exceptions.ArgError) as context: config.verify_integrity() self.assertEqual(context.exception.message, 'Must specify snapfile') pass
def testValidateOutputFormat(self): # ensure that if outputformat is not specified, exception is thrown snap.config.options.mode = snap.config.ConfigOptions.BACKUP snap.config.options.outputformat = None config = snap.config.Config() with self.assertRaises(snap.exceptions.ArgError) as context: config.verify_integrity() self.assertEqual(context.exception.message, 'Must specify valid output format') pass