Пример #1
0
def test_sector_name_level_recursive_unsaved():
    """
    Test that accessing the path of a sector raises an exception when its parent points at
    itself.
    """
    sector = SectorFactory()
    sector.parent = sector
    with pytest.raises(DataHubError):
        sector.name
Пример #2
0
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()
Пример #3
0
def test_sector_name_recursive_via_parent_unsaved():
    """
    Test that accessing the path of a sector raises an exception when it's part of a recursive
    hierarchy.
    """
    parent = SectorFactory()
    sector = SectorFactory(parent=parent)
    parent.parent = sector
    with pytest.raises(DataHubError):
        sector.name
Пример #4
0
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()