def test_sector_save_recursive_via_parent(): """ Test that it's not possible to save a sector when it's part of a recursive hierarchy. """ parent = SectorFactory() sector = SectorFactory(parent=parent) parent.parent = sector with pytest.raises(InvalidMove): parent.save()
def test_sector_save_recursive(): """Test that it's not possible to save a sector with its parent pointing at itself.""" sector = SectorFactory() sector.parent = sector with pytest.raises(InvalidMove): sector.save()