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
    cohorts_edit_add(pyramid_request)

    assert len(cohort.members) == 1
    assert cohort.members[0].username == user.username
Exemplo n.º 2
0
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
    cohorts_edit_add(pyramid_request)

    assert len(cohort.members) == 1
    assert cohort.members[0].username == user.username