def test_cohorts_edit_with_no_users(pyramid_request):
    cohort = models.FeatureCohort(name="FractalCohort")
    pyramid_request.db.add(cohort)
    pyramid_request.db.flush()

    pyramid_request.matchdict["id"] = cohort.id
    result = cohorts_edit({}, pyramid_request)

    assert result["cohort"].id == cohort.id
    assert len(result["cohort"].members) == 0
Пример #2
0
def test_cohorts_edit_with_no_users(pyramid_request):
    cohort = models.FeatureCohort(name="FractalCohort")
    pyramid_request.db.add(cohort)
    pyramid_request.db.flush()

    pyramid_request.matchdict["id"] = cohort.id
    result = cohorts_edit({}, pyramid_request)

    assert result["cohort"].id == cohort.id
    assert len(result["cohort"].members) == 0
def test_cohorts_edit_with_users(factories, pyramid_request):
    cohort = models.FeatureCohort(name="FractalCohort")
    user1 = factories.User(username="******")
    user2 = factories.User(username="******", authority="foo.org")
    cohort.members.append(user1)
    cohort.members.append(user2)

    pyramid_request.db.add(cohort)
    pyramid_request.db.flush()

    pyramid_request.matchdict["id"] = cohort.id
    result = cohorts_edit({}, pyramid_request)

    assert result["cohort"].id == cohort.id
    assert len(result["cohort"].members) == 2
Пример #4
0
def test_cohorts_edit_with_users(factories, pyramid_request):
    cohort = models.FeatureCohort(name='FractalCohort')
    user1 = factories.User(username='******')
    user2 = factories.User(username='******', authority='foo.org')
    cohort.members.append(user1)
    cohort.members.append(user2)

    pyramid_request.db.add(cohort)
    pyramid_request.db.flush()

    pyramid_request.matchdict['id'] = cohort.id
    result = cohorts_edit({}, pyramid_request)

    assert result['cohort'].id == cohort.id
    assert len(result['cohort'].members) == 2
Пример #5
0
def test_cohorts_edit_with_users(factories, pyramid_request):
    cohort = models.FeatureCohort(name="FractalCohort")
    user1 = factories.User(username="******")
    user2 = factories.User(username="******", authority="foo.org")
    cohort.members.append(user1)
    cohort.members.append(user2)

    pyramid_request.db.add(cohort)
    pyramid_request.db.flush()

    pyramid_request.matchdict["id"] = cohort.id
    result = cohorts_edit({}, pyramid_request)

    assert result["cohort"].id == cohort.id
    assert len(result["cohort"].members) == 2