23 lines
		
	
	
		
			1005 B
		
	
	
	
		
			Python
		
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			1005 B
		
	
	
	
		
			Python
		
	
	
"""Define tests for the GeoNet NZ Volcano general setup."""
 | 
						|
from asynctest import CoroutineMock, patch
 | 
						|
 | 
						|
from homeassistant.components.geonetnz_volcano import DOMAIN, FEED
 | 
						|
 | 
						|
 | 
						|
async def test_component_unload_config_entry(hass, config_entry):
 | 
						|
    """Test that loading and unloading of a config entry works."""
 | 
						|
    config_entry.add_to_hass(hass)
 | 
						|
    with patch(
 | 
						|
        "aio_geojson_geonetnz_volcano.GeonetnzVolcanoFeedManager.update",
 | 
						|
        new_callable=CoroutineMock,
 | 
						|
    ) as mock_feed_manager_update:
 | 
						|
        # Load config entry.
 | 
						|
        assert await hass.config_entries.async_setup(config_entry.entry_id)
 | 
						|
        await hass.async_block_till_done()
 | 
						|
        assert mock_feed_manager_update.call_count == 1
 | 
						|
        assert hass.data[DOMAIN][FEED][config_entry.entry_id] is not None
 | 
						|
        # Unload config entry.
 | 
						|
        assert await hass.config_entries.async_unload(config_entry.entry_id)
 | 
						|
        await hass.async_block_till_done()
 | 
						|
        assert hass.data[DOMAIN][FEED].get(config_entry.entry_id) is None
 |