rustsf 0.0.2

Rust Salesforce API Client
Documentation
use serde::{Deserialize, Serialize};

#[derive(Default, Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct LoginErrorResponse {
    pub message: String,
    pub error_code: String,
}

#[cfg(test)]
mod tests {
    use super::*;
    use serde_json::json;

    #[test]
    fn test_deserialize() {
        let json_str = json!({
            "message": "Record not found",
            "errorCode": "NOT_FOUND",
            "fields": ["Id"]
        })
        .to_string();

        let resp: LoginErrorResponse = serde_json::from_str(&json_str).unwrap();
        assert_eq!(resp.message, "Record not found");
        assert_eq!(resp.error_code, "NOT_FOUND");
    }

    #[test]
    fn test_default() {
        let resp = LoginErrorResponse::default();
        assert_eq!(resp.message, "");
        assert_eq!(resp.error_code, "");
    }
}