push_command.rs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. mod common;
  2. use common::*;
  3. const COLLECTION: &str = "Ingest";
  4. #[test]
  5. fn should_push_new_object_to_sonic() {
  6. let bucket = "push_simple";
  7. let dest = Dest::col_buc(COLLECTION, bucket);
  8. let ingest_channel = ingest_start();
  9. match ingest_channel.push(PushRequest::new(
  10. dest.obj("1"),
  11. "Sweet Teriyaki Beef Skewers",
  12. )) {
  13. Ok(()) => {}
  14. _ => unreachable!(),
  15. }
  16. flush_bucket(COLLECTION, bucket);
  17. }
  18. #[test]
  19. fn should_push_new_object_to_sonic_with_russian_locale() {
  20. let bucket = "push_locale";
  21. let dest = Dest::col_buc(COLLECTION, bucket);
  22. let ingest_channel = ingest_start();
  23. match ingest_channel.push(
  24. PushRequest::new(dest.obj("1"), "Открытый пирог с орехами и сгущенкой").lang(Lang::Rus),
  25. ) {
  26. Ok(()) => {}
  27. _ => unreachable!(),
  28. }
  29. flush_bucket(COLLECTION, bucket);
  30. }
  31. #[test]
  32. fn should_push_multiline_text() {
  33. let bucket = "push_multiline";
  34. let multiline_text = "
  35. Sweet
  36. Teriyaki
  37. Beef
  38. Skewers
  39. ";
  40. let dest = Dest::col_buc(COLLECTION, bucket);
  41. let ingest_channel = ingest_start();
  42. match ingest_channel.push(PushRequest::new(dest.obj("1"), multiline_text)) {
  43. Ok(()) => {}
  44. _ => unreachable!(),
  45. }
  46. flush_bucket(COLLECTION, bucket);
  47. }