def test_outdoor_details_fail(self, caplog, api_mock): """Test outdoor outlet get_details response.""" self.mock_api.return_value = BAD_OUTDOOR_LIST outdoor_outlet = VeSyncOutdoorPlug(DEV_LIST_DETAIL, self.vesync_obj) outdoor_outlet.get_details() assert len(caplog.records) == 1 assert 'details' in caplog.text
def test_outdoor_outlet_no_details(self, caplog, api_mock): """Test outdoor outlet details return with no details and code=0""" bad_outdoor_details = {"code": 0, "deviceStatus": "on"} self.mock_api.return_value = (bad_outdoor_details, 200) outdoor_outlet = VeSyncOutdoorPlug(DEV_LIST_DETAIL, self.vesync_obj) outdoor_outlet.get_details() assert len(caplog.records) == 2
def test_outdoor_details(self, api_mock): """Tests retrieving outdoor outlet details.""" self.mock_api.return_value = CORRECT_OUTDOOR_DETAILS outdoor_outlet = VeSyncOutdoorPlug(DEV_LIST_DETAIL, self.vesync_obj) outdoor_outlet.get_details() dev_details = outdoor_outlet.details assert outdoor_outlet.device_status == 'on' assert isinstance(outdoor_outlet, VeSyncOutdoorPlug) assert dev_details['active_time'] == 1