summaryrefslogtreecommitdiffstats
path: root/tests/parse_es_requests.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-08-24 14:13:56 -0700
committerBryan Newbold <bnewbold@archive.org>2020-08-24 14:13:56 -0700
commit780ca2a819a6d1c931580c8e8e31657072971876 (patch)
treec963e141d8665a07a8a07cab8159b74a66aabe74 /tests/parse_es_requests.rs
parentf466739b09be1baffd13110b431ecd8057a40771 (diff)
downloades-public-proxy-780ca2a819a6d1c931580c8e8e31657072971876.tar.gz
es-public-proxy-780ca2a819a6d1c931580c8e8e31657072971876.zip
more progress and tests
Diffstat (limited to 'tests/parse_es_requests.rs')
-rw-r--r--tests/parse_es_requests.rs23
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/parse_es_requests.rs b/tests/parse_es_requests.rs
index 57be06a..a4950c0 100644
--- a/tests/parse_es_requests.rs
+++ b/tests/parse_es_requests.rs
@@ -1,7 +1,7 @@
use std::fs;
use std::ffi::OsStr;
-use es_public_proxy::SearchBody;
+use es_public_proxy::{ScrollBody, SearchBody};
mod common;
@@ -22,7 +22,7 @@ fn basic_parse() {
}
#[test]
-fn parse_all_requests() {
+fn parse_search_requests() {
let file_paths = fs::read_dir("tests/files").unwrap();
@@ -39,3 +39,22 @@ fn parse_all_requests() {
}
}
}
+
+#[test]
+fn parse_scroll_requests() {
+
+ let file_paths = fs::read_dir("tests/files/scroll").unwrap();
+
+ for path in file_paths {
+ let path = path.unwrap().path();
+ if path.extension() != Some(OsStr::new("txt")) {
+ continue
+ }
+ let request = common::load_request(&path);
+ if let Some(body) = request.body {
+ println!("parsing: {}", path.display());
+ println!("BODY: {}", body);
+ let _parsed: ScrollBody = serde_json::from_str(&body).unwrap();
+ }
+ }
+}