def test_add_field(self): """Check Database.add_field()""" db = MemoryDatabase(Job) numfields = len(db._fields) db.add_field(MySQLField('test_field', 'TEXT')) self.assertEqual(len(db._fields), numfields + 1) self.assertEqual(db._fields[-1].name, 'test_field')
def setup_webservice(archive='30d', expire='90d'): tmpdir = tempfile.mkdtemp() incoming = os.path.join(tmpdir, 'incoming') preprocessing = os.path.join(tmpdir, 'preprocessing') failed = os.path.join(tmpdir, 'failed') os.mkdir(incoming) os.mkdir(preprocessing) os.mkdir(failed) db = MemoryDatabase(MyJob) db.add_field(MySQLField('testfield', 'TEXT')) conf = Config(StringIO(basic_config \ % (incoming, preprocessing, failed, archive, expire))) web = WebService(conf, db) db._create_tables() return db, conf, web, tmpdir