def test_complains_if_recipients_isnt_a_list_or_string(self): with a_temp_directory() as backup_dir: for recipients in (0, 1, {}, {1: 1}, False, True, lambda: 1): with self.assertRaisesRegexp( CommandError, "Recipients list needs to be a list of strings.+"): self.command.validate_options(backup_dir, recipients)
def test_complains_if_backup_dir_doesnt_exist(self): with a_temp_directory() as backup_dir: shutil.rmtree(backup_dir) with self.assertRaisesRegexp( CommandError, "Specified backup_dir \({0}\) doesn't exist".format( backup_dir)): self.command.validate_options(backup_dir, [])
def test_complains_if_recipients_isnt_a_list_or_string(self): with a_temp_directory() as backup_dir: for recipients in (0, 1, {}, {1: 1}, False, True, lambda: 1): with self.assertRaisesRegexp(CommandError, "Recipients list needs to be a list of strings.+"): self.command.validate_options(backup_dir, recipients)
def test_complains_if_no_recipients(self): with a_temp_directory() as backup_dir: with self.assertRaisesRegexp(CommandError, "No recipients list has been specified.+"): self.command.validate_options(backup_dir, None)
def test_complains_if_backup_dir_doesnt_exist(self): with a_temp_directory() as backup_dir: shutil.rmtree(backup_dir) with self.assertRaisesRegexp(CommandError, "Specified backup_dir \({0}\) doesn't exist".format(backup_dir)): self.command.validate_options(backup_dir, [])
def test_complains_if_no_recipients(self): with a_temp_directory() as backup_dir: with self.assertRaisesRegexp( CommandError, "No recipients list has been specified.+"): self.command.validate_options(backup_dir, None)