'Test state gets updated when sensor returns a new status.'

@requests_mock.Mocker()
def test_update_when_value_changed(self, mock_req):

    self.setup_api(MOCK_DATA_NEXT, mock_req)
    now = datetime(1970, month=1, day=1)
    with patch('homeassistant.util.dt.now', return_value=now):
        for name in self.sensor_dict:
            sensor = self.sensor_dict[name]['sensor']
            self.fake_delay(2)
            sensor.update()
            if (name == google_wifi.ATTR_LAST_RESTART):
                self.assertEqual('1969-12-30    00:00:00', sensor.state)
            elif (name == google_wifi.ATTR_UPTIME):
                self.assertEqual(2, sensor.state)
            elif (name == google_wifi.ATTR_STATUS):
                self.assertEqual('Offline', sensor.state)
            elif (name == google_wifi.ATTR_NEW_VERSION):
                self.assertEqual('Latest', sensor.state)
            elif (name == google_wifi.ATTR_LOCAL_IP):
                self.assertEqual(STATE_UNKNOWN, sensor.state)
            else:
                self.assertEqual('next', sensor.state)
