An update will be applied December 9th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

Commit ad876a3e authored by Ben Boeckel's avatar Ben Boeckel
Browse files

tests: add deserialization test for UserBasic

parent d5f4216b
"username": "ben.boeckel",
"web_url": "",
"name": "Ben Boeckel",
"state": "active",
"avatar_url": "",
"id": 13
......@@ -15,3 +15,6 @@ mod types;
pub use error::Error;
pub use gitlab::Gitlab;
pub use types::*;
mod test;
extern crate serde;
use self::serde::Deserialize;
extern crate serde_json;
use self::serde_json::from_reader;
use super::types::*;
use std::fs::File;
fn read_test_file<T: Deserialize>(name: &str) -> T {
let fin = File::open(format!(concat!(env!("CARGO_MANIFEST_DIR"), "/data/{}.json"), name)).unwrap();
from_reader::<File, T>(fin).unwrap()
fn test_read_user_basic() {
let user_basic: UserBasic = read_test_file("user_basic");
assert_eq!(user_basic.username, "ben.boeckel");
assert_eq!(, "Ben Boeckel");
assert_eq!(, UserId::new(13));
assert_eq!(user_basic.state, UserState::Active);
assert_eq!(user_basic.avatar_url, "");
assert_eq!(user_basic.web_url, "");
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment