コード例 #1
0
ファイル: features_test.py プロジェクト: djcun95/h
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
コード例 #2
0
ファイル: features_test.py プロジェクト: mari-ja/h
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
コード例 #3
0
ファイル: features_test.py プロジェクト: ficolo/h
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
コード例 #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
コード例 #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
コード例 #6
0
ファイル: features_test.py プロジェクト: pombredanne/h
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
コード例 #7
0
ファイル: features_test.py プロジェクト: djcun95/h
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
コード例 #8
0
ファイル: features_test.py プロジェクト: ficolo/h
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
コード例 #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