2021-12-24 17:15:51 +03:00
|
|
|
|
mod common;
|
|
|
|
|
use common::*;
|
|
|
|
|
|
|
|
|
|
const COLLECTION: &str = "Ingest";
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn should_push_new_object_to_sonic() {
|
2021-12-24 23:43:47 +03:00
|
|
|
|
let bucket = "push_simple";
|
2021-12-24 17:15:51 +03:00
|
|
|
|
|
2022-07-18 14:07:12 +03:00
|
|
|
|
let dest = Dest::col_buc(COLLECTION, bucket);
|
|
|
|
|
|
2021-12-24 23:43:47 +03:00
|
|
|
|
let ingest_channel = ingest_start();
|
2022-07-18 14:07:12 +03:00
|
|
|
|
match ingest_channel.push(PushRequest::new(
|
|
|
|
|
dest.obj("1"),
|
|
|
|
|
"Sweet Teriyaki Beef Skewers",
|
|
|
|
|
)) {
|
|
|
|
|
Ok(()) => {}
|
|
|
|
|
_ => unreachable!(),
|
2021-12-24 17:15:51 +03:00
|
|
|
|
}
|
|
|
|
|
|
2021-12-24 23:43:47 +03:00
|
|
|
|
flush_bucket(COLLECTION, bucket);
|
2021-12-24 17:15:51 +03:00
|
|
|
|
}
|
2021-12-24 17:26:28 +03:00
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn should_push_new_object_to_sonic_with_russian_locale() {
|
2021-12-24 23:43:47 +03:00
|
|
|
|
let bucket = "push_locale";
|
2021-12-24 17:26:28 +03:00
|
|
|
|
|
2022-07-18 14:07:12 +03:00
|
|
|
|
let dest = Dest::col_buc(COLLECTION, bucket);
|
|
|
|
|
|
2021-12-24 23:43:47 +03:00
|
|
|
|
let ingest_channel = ingest_start();
|
2022-07-18 14:07:12 +03:00
|
|
|
|
match ingest_channel.push(
|
|
|
|
|
PushRequest::new(dest.obj("1"), "Открытый пирог с орехами и сгущенкой").lang(Lang::Rus),
|
2021-12-24 17:26:28 +03:00
|
|
|
|
) {
|
2022-07-18 14:07:12 +03:00
|
|
|
|
Ok(()) => {}
|
|
|
|
|
_ => unreachable!(),
|
2021-12-24 17:26:28 +03:00
|
|
|
|
}
|
|
|
|
|
|
2021-12-24 23:43:47 +03:00
|
|
|
|
flush_bucket(COLLECTION, bucket);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn should_push_multiline_text() {
|
|
|
|
|
let bucket = "push_multiline";
|
|
|
|
|
let multiline_text = "
|
|
|
|
|
Sweet
|
|
|
|
|
Teriyaki
|
|
|
|
|
Beef
|
|
|
|
|
Skewers
|
|
|
|
|
";
|
|
|
|
|
|
2022-07-18 14:07:12 +03:00
|
|
|
|
let dest = Dest::col_buc(COLLECTION, bucket);
|
|
|
|
|
|
2021-12-24 23:43:47 +03:00
|
|
|
|
let ingest_channel = ingest_start();
|
2022-07-18 14:07:12 +03:00
|
|
|
|
match ingest_channel.push(PushRequest::new(dest.obj("1"), multiline_text)) {
|
|
|
|
|
Ok(()) => {}
|
|
|
|
|
_ => unreachable!(),
|
2021-12-24 23:43:47 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
flush_bucket(COLLECTION, bucket);
|
2021-12-24 17:26:28 +03:00
|
|
|
|
}
|