示例#1
0
def test_awesome_stuff(relation_detector):  # NOQA
    users = [User(name='Anders', age=12) for _ in range(1)]

    User.objects.insert(users)

    handin = Handin(score=1, users=users[0])
    handin.save()

    assert score() == 50
示例#2
0
def test_raising_exceptions_on_missing_subscriptions(relation_detector):  # NOQA
    users = [User(name='Anders', age=12) for _ in range(1)]

    inserted_users = User.objects.insert(users)

    handin = Handin(score=1, users=inserted_users)
    handin.save()

    with pytest.raises(RelationMissingError):
        with relation_detector(score_with_missing_relations):
            assert score_with_missing_relations() == 50
示例#3
0
def test_no_exceptions_raised_with_all_subscriptions(relation_detector):  # NOQA
    users = [User(name='Anders', age=12) for _ in range(1)]

    inserted_users = User.objects.insert(users)

    handin = Handin(score=1, users=inserted_users)
    handin.save()

    with relation_detector(score_with_sources):
        assert score_with_sources() == 50

    with relation_detector(score_with_relations):
        assert score_with_relations() == 50