def test_add_symbol(hass):
    """Test check for existing symbols."""
    coordinator = YahooSymbolUpdateCoordinator([], hass, DEFAULT_SCAN_INTERVAL)

    with patch(f"{YSUC}.async_request_refresh"):
        assert coordinator.add_symbol(TEST_SYMBOL) is True
        assert TEST_SYMBOL in coordinator.get_symbols()
Beispiel #2
0
async def test_add_symbol(hass):
    """Add symbol for load."""
    mock_coordinator = YahooSymbolUpdateCoordinator([], hass,
                                                    DEFAULT_SCAN_INTERVAL)

    with patch(
            "homeassistant.helpers.event.async_call_later") as mock_call_later:
        assert mock_coordinator.add_symbol(TEST_SYMBOL) is True
        assert TEST_SYMBOL in mock_coordinator.get_symbols()
        assert len(mock_call_later.mock_calls) == 1
Beispiel #3
0
async def test_add_symbol_existing(hass):
    """Test check for existing symbols."""
    mock_coordinator = YahooSymbolUpdateCoordinator([TEST_SYMBOL], hass,
                                                    DEFAULT_SCAN_INTERVAL)
    assert mock_coordinator.add_symbol(TEST_SYMBOL) is False