def create(): config = get_test_config() initdb(config['DB']['engine']) fixtures.load() conn = get_handle() xaction = Xaction() conn.add(xaction) conn.commit() typ1, typC = SampleType(name='patient'), SampleType(name='control') s1, s2 = Sample(sample_type=typ1), Sample(sample_type=typC) plate96_t = conn.query(ContainerType).filter(ContainerType.name=='Plate-96_well').one() plate = ContainerInst( name='my_plate', type=plate96_t ) conn.add(plate) conn.commit() well1 = conn.query(Container).filter(Container.type == plate96_t).filter(Container.name == 'A01').one() well2 = conn.query(Container).filter(Container.type == plate96_t).filter(Container.name == 'A02').one() p1 = Plating( plate=plate, well=well1, sample=s1, xaction=xaction ) p2 = Plating( plate=plate, well=well2, sample=s2, xaction=xaction ) conn.add( p1 ) conn.add( p2 ) conn.commit() return plate
def setUp(self): config = get_test_config() initdb(config['DB']['engine'])