def screener(): # Create the test db in RAM db = sqlite3.connect(":memory:") # Create a config object with default settings config = Config() config['DEBUG'] = True config['TESTING'] = True config['BLOCK_NAME_PATTERNS'] = { "V[0-9]{15}": "Telemarketer Caller ID", } config['BLOCK_NUMBER_PATTERNS'] = { "P": "Private number", } config['PERMIT_NAME_PATTERNS'] = { ".*DOE": "Anyone", } config['PERMIT_NUMBER_PATTERNS'] = { "987654": "Anyone", } # Create the blacklist to be tested screener = CallScreener(db, config) # Add a record to the blacklist screener._blacklist.add_caller(caller1) # Add a record to the whitelist screener._whitelist.add_caller(caller2) return screener
def config(): # Use a config object with defaults config = Config() config['DEBUG'] = True config['TESTING'] = True config['VOICE_MAIL_MESSAGE_FOLDER'] = gettempdir() return config
def modem(): # Create a config object with default settings config = Config() config['DEBUG'] = True config['TESTING'] = True config['VOICE_MAIL_MESSAGE_FOLDER'] = gettempdir() modem = Modem(config) yield modem modem.stop()
def modem(): # Create a config object with default settings config = Config() config['DEBUG'] = True config['TESTING'] = True config['VOICE_MAIL_MESSAGE_FOLDER'] = gettempdir() modem = Modem(config) modem.open_serial_port() yield modem modem.ring_indicator.close()