An unofficial collection of APIs used in FreeJam games and mods
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #[cfg(feature = "cardlife")]
  2. use libfj::cardlife;
  3. #[cfg(feature = "cardlife")]
  4. const EMAIL: &str = "";
  5. #[cfg(feature = "cardlife")]
  6. const PASSWORD: &str = "";
  7. #[cfg(feature = "cardlife")]
  8. #[test]
  9. fn live_api_init() -> Result<(), ()> {
  10. cardlife::LiveAPI::new();
  11. Ok(())
  12. }
  13. #[cfg(feature = "cardlife")]
  14. #[tokio::test]
  15. async fn live_api_init_auth() -> Result<(), ()> {
  16. let live = cardlife::LiveAPI::login_email(EMAIL, PASSWORD).await;
  17. assert!(live.is_err()); // invalid credentials
  18. Ok(())
  19. }
  20. #[cfg(feature = "cardlife")]
  21. #[tokio::test]
  22. async fn live_api_authenticate() -> Result<(), ()> {
  23. let mut live = cardlife::LiveAPI::new();
  24. let result = live.authenticate_email(EMAIL, PASSWORD).await;
  25. assert!(result.is_err()); // invalid credentials
  26. /*let auth_info = result.unwrap();
  27. assert_ne!(auth_info.token, "");
  28. assert_ne!(auth_info.display_name, "");
  29. assert_eq!(auth_info.email_address, EMAIL);
  30. assert_ne!(auth_info.public_id, "");
  31. println!("AuthenticationInfo.to_string() -> `{}`", auth_info.to_string());*/
  32. Ok(())
  33. }
  34. #[cfg(feature = "cardlife")]
  35. #[tokio::test]
  36. async fn live_api_lobbies() -> Result<(), ()> {
  37. //let live = cardlife::LiveAPI::login_email(EMAIL, PASSWORD).await.unwrap();
  38. let live = cardlife::LiveAPI::new();
  39. let result = live.lobbies().await;
  40. assert!(result.is_err());
  41. /*
  42. let lobby_info = result.unwrap();
  43. assert_ne!(lobby_info.games.len(), 0);
  44. for game in &lobby_info.games {
  45. println!("LiveGameInfo.to_string() -> `{}`", game.to_string());
  46. }*/
  47. Ok(())
  48. }