Kibou is a federated social networking server.
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.

activitypub_controller.rs 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. use activity;
  2. use activitypub::activity::create_internal_activity;
  3. use activitypub::controller as controller;
  4. use actor;
  5. use database;
  6. use tests::utils::create_local_test_actor;
  7. use tests::utils::delete_test_actor;
  8. use tests::utils::valid_remote_dummy_create_activity;
  9. #[test]
  10. fn err_actor_exists()
  11. {
  12. let test_actor_uri = String::from("https://example.tld/actors/希");
  13. let test_actor_exists = controller::actor_exists(&test_actor_uri);
  14. assert_eq!(test_actor_exists, false);
  15. }
  16. #[test]
  17. fn actor_exists()
  18. {
  19. let test_actor: actor::Actor = create_local_test_actor("b9f4e4bc-828e-403a-bdf9-66b618ebac60");
  20. let test_actor_exists = controller::actor_exists(&test_actor.actor_uri);
  21. delete_test_actor(test_actor);
  22. assert_eq!(test_actor_exists, true);
  23. }
  24. #[test]
  25. fn err_object_exists()
  26. {
  27. let test_object_id = String::from("https://remote.tld/objects/bfdde7c2-9267-445c-bb0c-3196a8854284");
  28. let test_object_exists = controller::object_exists(&test_object_id);
  29. assert_eq!(test_object_exists, false);
  30. }
  31. #[test]
  32. fn object_exists()
  33. {
  34. let database = database::establish_connection();
  35. let test_object_id = String::from("https://remote.tld/objects/ad8127cd-bbf5-4910-bdca-bad648fa0901");
  36. let test_actor = String::from("https://remote.tld/ben");
  37. activity::insert_activity(&database, create_internal_activity(valid_remote_dummy_create_activity(test_object_id.clone(), None), test_actor));
  38. let test_object_exists = controller::object_exists(&test_object_id.clone());
  39. activity::delete_ap_object_by_id(&database, test_object_id);
  40. assert_eq!(test_object_exists, true);
  41. }