def test_ws_details_fail(self, caplog, api_mock): """Test WS get_details with Code>0""" self.mock_api.return_value = BAD_LIST vswitch15a = VeSyncWallSwitch(DEV_LIST_DETAIL, self.vesync_obj) vswitch15a.get_details() assert len(caplog.records) == 2 assert 'details' in caplog.text
def test_ws_details(self, api_mock): """Test WS get_details() """ self.mock_api.return_value = CORRECT_WS_DETAILS wswitch = VeSyncWallSwitch(DEV_LIST_DETAIL, self.vesync_obj) wswitch.get_details() dev_details = wswitch.details assert wswitch.device_status == 'on' assert type(dev_details) == dict assert dev_details['active_time'] == 1 assert wswitch.connection_status == 'online'