def test_addphase(config, dbsession, project, get_csrf_request_with_db): from autonomie.views.project import PhaseAddFormView from autonomie.models.project import Phase config.add_route('project/{id}', '/') req = get_csrf_request_with_db() req.context = project view = PhaseAddFormView(req) view.submit_success({'name': u'Phasé'}) dbsession.flush() phases = Phase.query().filter(Phase.project == project).all() assert (len(phases) == 2)
def test_addphase(config, dbsession, project, get_csrf_request_with_db): from autonomie.views.project import PhaseAddFormView from autonomie.models.project import Phase config.add_route('project/{id}', '/') req = get_csrf_request_with_db() req.context = project view = PhaseAddFormView(req) view.submit_success({'name': u'Phasé'}) dbsession.flush() phases = Phase.query().filter(Phase.project==project).all() assert(len(phases) == 2)
def get_all_phases(request): project_ids = [p.id for p in get_all_projects(request)] return Phase.query().filter(Phase.project_id.in_(project_ids)).all()
def phase(content): return Phase.query().first()