def setUp(self): """Setup test fixture for each model test method.""" try: new_attrs = {} new_attrs.update(self.attrs) new_attrs.update(self.do_get_dependencies()) self.obj = self.klass(**new_attrs) DBSession.add(self.obj) DBSession.flush() return self.obj except: DBSession.rollback() raise
def process(sid, params): podone = DBSession.query( model.podModel).filter_by(podName=params['podName']).first() if podone: raise APIError(1, 'podName: ' + params['podName'] + '已存在') newPod = model.podModel(podName=params['podName'], sourceHttpUrl=params['sourceHttpUrl'], specSourceHttpUrl=params['specSourceHttpUrl'], mirrorSSHUrl=params['mirrorSSHUrl'], mirrorHttpUrl=params['mirrorHttpUrl'], noReplaceSource=params['noReplaceSource']) DBSession.add(newPod) DBSession.flush() #podspecs = DBSession.query(model.podspec).filter_by(pid=55).all() return (newPod, 'success.')