Пример #1
0
def test_component_initialization():
    """Test that component is initialized properly."""
    with pytest.raises(ValueError):
        Component(None)

    component = Component('test-component')
    assert component.component_id == 'test-component'
    assert not component.is_leader
Пример #2
0
def test_app_add():
    """Test adding a components to an App."""
    app = AppTest()
    component = Component('test-component')
    return_value = app.add(component)
    assert len(app.components) == 1
    assert app.components['test-component'] == component
    assert return_value == app
Пример #3
0
def test_component_app_property():
    """Test component's app property."""
    component = Component('test-component')
    assert component.app_id is None
    with pytest.raises(KeyError):
        assert not component.app

    app = AppTest()
    app.add(component)
    assert component.app == app
Пример #4
0
def test_component_diagnose():
    """Test running diagnostics on component."""
    component = Component('test-component')
    assert component.diagnose() == []
Пример #5
0
def test_component_disable():
    """Test running disable on component."""
    component = Component('test-component')
    assert component.disable() is None
Пример #6
0
def test_component_setup():
    """Test running setup on component."""
    component = Component('test-component')
    assert component.setup(old_version=1) is None