pub mod error;
pub mod keyboard;
pub mod matchit;
pub mod ndarray;
pub use error::*;
pub use matchit::*;
pub use ndarray::*;
use crate::{extract::Update, responses::Event, RequestBuilder};
use serde_json::{json, Value};
pub struct TestHardness {
pub update: Update,
}
impl TestHardness {
pub fn new(object: Vec<Event<Value>>) -> TestHardness {
TestHardness {
update: Update {
ts: None,
updates: Some(object),
failed: None,
},
}
}
pub fn dummy_request(&self) -> RequestBuilder {
RequestBuilder::new("my super hidden token", 10000)
}
pub fn dummy_message(message: &str) -> Event<Value> {
Event {
event_id: String::from("0"),
update_type: String::from("message_new"),
v: String::from("1.599"),
object: json!({
"client_info": {
"button_actions": [
"text",
"vkpay",
"open_app",
"location",
"open_link",
"open_photo",
"callback",
"intent_subscribe",
"intent_unsubscribe",
],
"carousel": true,
"inline_keyboard": true,
"keyboard": true,
"lang_id": 0,
},
"message": {
"attachments": [],
"conversation_message_id": 000000,
"date": 0000000,
"from_id": 00000000,
"fwd_messages": [],
"id": 0,
"important": false,
"is_hidden": false,
"is_unavailable": true,
"out": 0,
"peer_id": 0000000000,
"random_id": 0,
"text": message,
"version": 0000000,
},
}),
}
}
}