예제 #1
0
def test_update():
    parent = Parent()
    parent.save()

    assert parent.id != None
    assert Parent.objects.count() == 4

    # Update
    child = Child()
    child.save()

    assert child.parent_id is None
    child.parent_id = parent.id
    child.save()

    assert Child.objects.count() == 22
    assert child.parent_id == parent.id
예제 #2
0
def test_save():
    parent = Parent()
    parent.save()

    assert parent.id is not None
    assert Parent.objects.count() == 3