def test_cohorts_edit_add_user(factories, pyramid_request): user = factories.User(username='******') cohort = models.FeatureCohort(name='FractalCohort') pyramid_request.db.add(user) pyramid_request.db.add(cohort) pyramid_request.db.flush() pyramid_request.matchdict['id'] = cohort.id pyramid_request.params['add'] = user.username views.cohorts_edit_add(pyramid_request) assert len(cohort.members) == 1 assert cohort.members[0].username == user.username
def test_cohorts_edit_add_user_strips_spaces(factories, pyramid_request): user = factories.User(username='******', authority='foo.org') cohort = models.FeatureCohort(name='FractalCohort') pyramid_request.db.add(cohort) pyramid_request.db.flush() pyramid_request.matchdict['id'] = cohort.id pyramid_request.params['add'] = ' benoit ' pyramid_request.params['authority'] = ' %s ' % user.authority views.cohorts_edit_add(pyramid_request) assert len(cohort.members) == 1 assert cohort.members[0].username == user.username
def test_cohorts_edit_add_user_strips_spaces(factories, pyramid_request): user = factories.User(username='******', authority='foo.org') cohort = models.FeatureCohort(name='FractalCohort') pyramid_request.db.add(user) pyramid_request.db.add(cohort) pyramid_request.db.flush() pyramid_request.matchdict['id'] = cohort.id pyramid_request.params['add'] = ' benoit ' pyramid_request.params['authority'] = ' %s ' % user.authority views.cohorts_edit_add(pyramid_request) assert len(cohort.members) == 1 assert cohort.members[0].username == user.username
def test_cohorts_edit_add_user(pyramid_request): user = models.User(username='******', password='******', email='*****@*****.**') cohort = models.FeatureCohort(name='FractalCohort') pyramid_request.db.add(user) pyramid_request.db.add(cohort) pyramid_request.db.flush() pyramid_request.matchdict['id'] = cohort.id pyramid_request.params['add'] = user.username views.cohorts_edit_add(pyramid_request) assert len(cohort.members) == 1 assert cohort.members[0].username == user.username
def test_cohorts_edit_add_user(): req = DummyRequest(db=db.Session) user = models.User(username='******', password='******', email='*****@*****.**') cohort = models.FeatureCohort(name='FractalCohort') db.Session.add(user) db.Session.add(cohort) db.Session.flush() req.matchdict['id'] = cohort.id req.params['add'] = user.username views.cohorts_edit_add(req) assert len(cohort.members) == 1 assert cohort.members[0].username == user.username