Example #1
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 = views.cohorts_edit({}, pyramid_request)

    assert result['cohort'].id == cohort.id
    assert len(result['cohort'].members) == 0
Example #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 = views.cohorts_edit({}, pyramid_request)

    assert result['cohort'].id == cohort.id
    assert len(result['cohort'].members) == 0
Example #3
0
def test_cohorts_edit_with_no_users():
    req = DummyRequest(db=db.Session)
    cohort = models.FeatureCohort(name='FractalCohort')
    db.Session.add(cohort)
    db.Session.flush()

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

    assert result['cohort'].id == cohort.id
    assert len(result['cohort'].members) == 0
Example #4
0
def test_cohorts_edit_with_no_users():
    req = DummyRequest(db=db.Session)
    cohort = models.FeatureCohort(name='FractalCohort')
    db.Session.add(cohort)
    db.Session.flush()

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

    assert result['cohort'].id == cohort.id
    assert len(result['cohort'].members) == 0
Example #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 = views.cohorts_edit({}, pyramid_request)

    assert result['cohort'].id == cohort.id
    assert len(result['cohort'].members) == 2
Example #6
0
def test_cohorts_edit_with_users(factories, pyramid_request):
    cohort = models.FeatureCohort(name='FractalCohort')
    user1 = factories.User(username='******')
    user2 = factories.User(username='******')
    cohort.members.append(user1)
    cohort.members.append(user2)

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

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

    assert result['cohort'].id == cohort.id
    assert len(result['cohort'].members) == 2
Example #7
0
def test_cohorts_edit_with_users(pyramid_request):
    cohort = models.FeatureCohort(name='FractalCohort')
    user1 = models.User(username='******',
                        password='******',
                        email='*****@*****.**')
    user2 = models.User(username='******',
                        password='******',
                        email='*****@*****.**')
    cohort.members.append(user1)
    cohort.members.append(user2)

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

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

    assert result['cohort'].id == cohort.id
    assert len(result['cohort'].members) == 2
Example #8
0
def test_cohorts_edit_with_users():
    req = DummyRequest(db=db.Session)
    cohort = models.FeatureCohort(name='FractalCohort')
    user1 = models.User(username='******',
                        password='******',
                        email='*****@*****.**')
    user2 = models.User(username='******',
                        password='******',
                        email='*****@*****.**')
    cohort.members.append(user1)
    cohort.members.append(user2)

    db.Session.add(user1)
    db.Session.add(user2)
    db.Session.add(cohort)
    db.Session.flush()

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

    assert result['cohort'].id == cohort.id
    assert len(result['cohort'].members) == 2
Example #9
0
def test_cohorts_edit_with_users():
    req = DummyRequest(db=db.Session)
    cohort = models.FeatureCohort(name='FractalCohort')
    user1 = models.User(username='******',
                        password='******',
                        email='*****@*****.**')
    user2 = models.User(username='******',
                        password='******',
                        email='*****@*****.**')
    cohort.members.append(user1)
    cohort.members.append(user2)

    db.Session.add(user1)
    db.Session.add(user2)
    db.Session.add(cohort)
    db.Session.flush()

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

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