def test_death(self): try: bacula_tools.die("Linux") assert "SystemExit not raised" except SystemExit: pass return
def test_death(self): try: bacula_tools.die('Linux') assert ('SystemExit not raised') except SystemExit: pass return
def value_check(self, table, field, value, suggest=False, asdict=False): '''Check the existence of a value in a column. If it exists, return the row as a dictionary, otherwise die with a suggestion of possible alternatives to search for.''' sql = "SELECT * FROM `%(table)s` where `%(field)s` = %%s" % locals() result = self.do_sql(sql, value, asdict) if result: return result if not suggest: return result return bacula_tools.die( 'No such value (%(value)s) in %(table)s' % locals(), '', self.suggest(table, field, value))
def value_check(self, table, field, value, suggest=False, asdict=False): '''Check the existence of a value in a column. If it exists, return the row as a dictionary, otherwise die with a suggestion of possible alternatives to search for.''' sql = "SELECT * FROM `%(table)s` where `%(field)s` = %%s" % locals() result = self.do_sql(sql, value, asdict) if result: return result if not suggest: return result return bacula_tools.die('No such value (%(value)s) in %(table)s' % locals(), '', self.suggest(table, field, value))