An unofficial collection of APIs used in FreeJam games and mods
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.3KB

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