Пример #1
0
def test_named():
    """Tests named HFOS base components"""

    a = pytest.TestComponent(uniquename="BERTRAM")
    pytest.clean_test_components()

    assert a.uniquename == "BERTRAM"
Пример #2
0
def test_config_uuid():
    """Tests if ConfigurableComponents configurations get an UUID assigned"""

    c = pytest.TestComponent()
    pytest.clean_test_components()

    assert type(c.config.uuid) == str
Пример #3
0
def test_uniquename():
    """Tests uniquename functionality of HFOS base components"""

    a = pytest.TestComponent()
    b = pytest.TestComponent()

    pytest.clean_test_components()
    assert a.uniquename != b.uniquename
Пример #4
0
def test_configschema():
    """Tests if ConfigurableComponents obtain a configuration schema"""

    c = pytest.TestComponent()
    pytest.clean_test_components()

    assert type(c.configschema) == dict
    assert 'schema' in c.configschema
    assert 'properties' in c.configschema['schema']
Пример #5
0
def test_configschema():
    """Tests if ConfigurableComponents obtain a configuration schema"""

    c = pytest.TestComponent("FOO")
    pytest.clean_test_components()

    assert type(c.configschema) == dict
    assert "schema" in c.configschema
    assert "properties" in c.configschema["schema"]
Пример #6
0
def test_uniquename():
    """Tests uniquename functionality of Isomer base components"""

    a = pytest.TestComponent("FOO")
    b = pytest.TestComponent("FOO")

    pytest.clean_test_components()
    assert a.uniquename != b.uniquename
    assert a.uniquename in pytest.TestComponent.names
Пример #7
0
def test_maintenance_log():
    log = logger.LiveLog
    logger.live = True

    maint = Maintenance()
    maint.register(m)

    pytest.clean_test_components()

    assert "Performing maintenance check" in str(log)
Пример #8
0
def test_unique_warning():
    log = logger.LiveLog
    logger.live = True

    c = pytest.TestComponent(uniquename='FOO')
    d = pytest.TestComponent(uniquename='FOO')

    pytest.clean_test_components()

    assert "Unique component added twice: " in str(log)
Пример #9
0
def test_write_none_config():
    log = logger.LiveLog
    logger.live = True

    c = pytest.TestComponent()
    c.config = None
    c._write_config()

    pytest.clean_test_components()

    assert "Unable to write non existing configuration" in str(log)
Пример #10
0
def test_unique_warning():
    """Test for uniqueness of generated components"""

    log = logger.LiveLog
    logger.live = True

    c = pytest.TestComponent("FOO")
    d = pytest.TestComponent("FOO")

    pytest.clean_test_components()

    assert "Unique component added twice: " in str(log)
Пример #11
0
def test_component_log():
    """Tests if a component logs correctly"""

    c = pytest.TestComponent()
    unique = str(uuid4())

    log = logger.LiveLog
    logger.live = True

    c.log(unique)
    pytest.clean_test_components()

    assert unique in str(log)