Пример #1
0
def test_skips_enabling_for_missing_url():
    logger = BaseLogger(MOCK_AGENT)
    assert logger.enableable is False
    assert logger.enabled is False
    assert logger.url is None
    logger.enable()
    assert logger.enabled is False
Пример #2
0
def test_skips_enabling_for_undefined_url():
    logger = BaseLogger(MOCK_AGENT, url=None)
    assert logger.enableable is False
    assert logger.enabled is False
    assert logger.url is None
    logger.enable()
    assert logger.enabled is False
Пример #3
0
def test_skips_enabling_for_invalid_urls():
    for invalid_url in MOCK_URLS_INVALID:
        logger = BaseLogger(MOCK_AGENT, url=invalid_url)
        assert logger.enableable is False
        assert logger.enabled is False
        assert logger.url is None
        logger.enable()
        assert logger.enabled is False
Пример #4
0
def test_performs_enabling_when_expected():
    logger = BaseLogger(MOCK_AGENT, url=DEMO_URL, enabled=False)
    assert logger.enableable is True
    assert logger.enabled is False
    assert logger.url == DEMO_URL
    logger.enable()
    assert logger.enabled is True

    logger = BaseLogger(MOCK_AGENT, queue=[], enabled=False)
    assert logger.enableable is True
    assert logger.enabled is False
    assert logger.url is None
    logger.enable().disable().enable()
    assert logger.enabled is True