Browse Source

fixed pt.1

pbs
andy 5 years ago
parent
commit
e6af44841a
  1. 5
      src/login/character.rs

5
src/login/character.rs

@ -532,7 +532,7 @@ mod test {
id: 3, id: 3,
username: "hi3".to_string(), username: "hi3".to_string(),
password: bcrypt::hash("qwer", 5).unwrap(), password: bcrypt::hash("qwer", 5).unwrap(),
guildcard: Some(3u32),
guildcard: Some(3),
team_id: None, team_id: None,
banned: false, banned: false,
muted_until: SystemTime::now(), muted_until: SystemTime::now(),
@ -543,6 +543,7 @@ mod test {
let mut server = CharacterServerState::new(TestData.clone()); let mut server = CharacterServerState::new(TestData.clone());
server.clients.insert(ClientId(1), fake_user.clone()); server.clients.insert(ClientId(1), fake_user.clone());
let mut send = server.handle(ClientId(1), &RecvCharacterPacket::SetFlag(SetFlag {flags: 1})).unwrap().collect::<Vec<_>>(); let mut send = server.handle(ClientId(1), &RecvCharacterPacket::SetFlag(SetFlag {flags: 1})).unwrap().collect::<Vec<_>>();
assert!(TestData.get_user_by_id(3).unwrap().flags == 1);
send = server.handle(ClientId(1), &RecvCharacterPacket::CharacterPreview(CharacterPreview {slot: 1, character: character::SelectScreenCharacter { send = server.handle(ClientId(1), &RecvCharacterPacket::CharacterPreview(CharacterPreview {slot: 1, character: character::SelectScreenCharacter {
exp: 0, exp: 0,
level: 0, level: 0,
@ -572,7 +573,7 @@ mod test {
} })).unwrap().collect::<Vec<_>>(); } })).unwrap().collect::<Vec<_>>();
assert!(send.len() == 2); assert!(send.len() == 2);
let chars = TestData.get_characters_by_user(&fake_user.user.clone().unwrap());
let chars = TestData.get_characters_by_user(&fake_user.user.unwrap());
assert!(chars[1].unwrap().character.name == [9, 69, 116, 101, 115, 116, 32, 110, 97, 109, 101, 0, 0, 0, 0, 0]); assert!(chars[1].unwrap().character.name == [9, 69, 116, 101, 115, 116, 32, 110, 97, 109, 101, 0, 0, 0, 0, 0]);
assert!(chars[0].is_none()); assert!(chars[0].is_none());
} }

Loading…
Cancel
Save