From d0f9d80674a63fb0d48a5e18273418446b0f8775 Mon Sep 17 00:00:00 2001 From: Daniel Sockwell Date: Tue, 28 Apr 2020 20:20:06 -0400 Subject: [PATCH] Add RedisMsg tests --- .gitattributes | 1 + src/response/redis/manager.rs:115:5 | 0 src/response/redis/msg.rs | 18 ++++---- src/response/redis/msg/err.rs | 8 +++- src/response/redis/msg/test.rs | 48 ++++++++++++++-------- src/response/redis/msg/test_input/001.resp | 7 ++++ src/response/redis/msg/test_input/002.resp | 7 ++++ src/response/redis/msg/test_input/003.resp | 7 ++++ src/response/redis/msg/test_input/004.resp | 7 ++++ src/response/redis/msg/test_input/005.resp | 7 ++++ src/response/redis/msg/test_input/006.resp | 7 ++++ src/response/redis/msg/test_output/001.txt | 1 + src/response/redis/msg/test_output/002.txt | 1 + src/response/redis/msg/test_output/003.txt | 1 + src/response/redis/msg/test_output/004.txt | 1 + src/response/redis/msg/test_output/005.txt | 1 + src/response/redis/msg/test_output/006.txt | 1 + 17 files changed, 92 insertions(+), 31 deletions(-) create mode 100644 .gitattributes delete mode 100644 src/response/redis/manager.rs:115:5 create mode 100644 src/response/redis/msg/test_input/001.resp create mode 100644 src/response/redis/msg/test_input/002.resp create mode 100644 src/response/redis/msg/test_input/003.resp create mode 100644 src/response/redis/msg/test_input/004.resp create mode 100644 src/response/redis/msg/test_input/005.resp create mode 100644 src/response/redis/msg/test_input/006.resp create mode 100644 src/response/redis/msg/test_output/001.txt create mode 100644 src/response/redis/msg/test_output/002.txt create mode 100644 src/response/redis/msg/test_output/003.txt create mode 100644 src/response/redis/msg/test_output/004.txt create mode 100644 src/response/redis/msg/test_output/005.txt create mode 100644 src/response/redis/msg/test_output/006.txt diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..707f33b --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.resp text eol=crlf diff --git a/src/response/redis/manager.rs:115:5 b/src/response/redis/manager.rs:115:5 deleted file mode 100644 index e69de29..0000000 diff --git a/src/response/redis/msg.rs b/src/response/redis/msg.rs index 8af186b..2365f9c 100644 --- a/src/response/redis/msg.rs +++ b/src/response/redis/msg.rs @@ -79,21 +79,17 @@ fn utf8_to_redis_data<'a>(s: &'a str) -> Result<(RedisData, &'a str), RedisParse e => Err(InvalidLineStart(e.to_string())), } } - -fn after_newline_at(s: &str, start: usize) -> RedisParser<&str> { - let s = s.get(start..).ok_or(Incomplete)?; - if s.len() < 2 { - Err(Incomplete)?; +fn skip_line(s: &str, len: usize) -> RedisParser<&str> { + let line = s.get(..len + 2).ok_or(Incomplete)?; + if !line.ends_with("\r\n") { + Err(InvalidLineEnd(len, s.to_string()))?; } - if !s.starts_with("\r\n") { - Err(InvalidLineEnd)?; - } - Ok(s.get("\r\n".len()..).ok_or(Incomplete)?) + Ok(s.get(len + "\r\n".len()..).ok_or(Incomplete)?) } fn parse_number_at<'a>(s: &'a str) -> RedisParser<(usize, &'a str)> { let len = s.chars().position(|c| !c.is_numeric()).ok_or(Incomplete)?; - Ok((s[..len].parse()?, after_newline_at(s, len)?)) + Ok((s[..len].parse()?, skip_line(s, len)?)) } /// Parse a Redis bulk string and return the content of that string and the unparsed remainder. @@ -102,7 +98,7 @@ fn parse_number_at<'a>(s: &'a str) -> RedisParser<(usize, &'a str)> { fn parse_redis_bulk_string<'a>(s: &'a str) -> RedisParser<(RedisData, &'a str)> { let (len, rest) = parse_number_at(s)?; let content = rest.get(..len).ok_or(Incomplete)?; - Ok((BulkString(content), after_newline_at(&rest, len)?)) + Ok((BulkString(content), skip_line(rest, len)?)) } fn parse_redis_int<'a>(s: &'a str) -> RedisParser<(RedisData, &'a str)> { diff --git a/src/response/redis/msg/err.rs b/src/response/redis/msg/err.rs index 9a3c9ee..95c19db 100644 --- a/src/response/redis/msg/err.rs +++ b/src/response/redis/msg/err.rs @@ -5,7 +5,7 @@ pub enum RedisParseErr { Incomplete, InvalidNumber(std::num::ParseIntError), InvalidLineStart(String), - InvalidLineEnd, + InvalidLineEnd(usize, String), IncorrectRedisType, MissingField, } @@ -28,7 +28,11 @@ impl fmt::Display for RedisParseErr { the type of the Redis line.", line_start_char ), - InvalidLineEnd => "A Redis line ended before expected line length".to_string(), + InvalidLineEnd(len, line) => format!( // TODO - FIXME + "A Redis line did not have the promised length of {}. \ + The line is: {}", + len, line + ), IncorrectRedisType => "Received a Redis type that is not supported in this context. \ Flodgatt expects each message from Redis to be a Redis array \ consisting of bulk strings or integers." diff --git a/src/response/redis/msg/test.rs b/src/response/redis/msg/test.rs index 2107caf..9233c31 100644 --- a/src/response/redis/msg/test.rs +++ b/src/response/redis/msg/test.rs @@ -1,4 +1,6 @@ use super::*; +use std::fs; +use std::path; #[test] fn parse_redis_subscribe() -> Result<(), RedisParseErr> { @@ -7,7 +9,7 @@ fn parse_redis_subscribe() -> Result<(), RedisParseErr> { let r_subscribe = match RedisParseOutput::try_from(input) { Ok(NonMsg(leftover)) => leftover, Ok(Msg(msg)) => panic!("unexpectedly got a msg: {:?}", msg), - Err(e) => panic!("Error in parsing subscribe command: {:?}", e), + Err(e) => panic!("Error in parsing subscribe command: {}", e), }; assert!(r_subscribe.is_empty()); @@ -21,11 +23,11 @@ fn parse_redis_detects_non_newline() -> Result<(), RedisParseErr> { match RedisParseOutput::try_from(input) { Ok(NonMsg(leftover)) => panic!( - "Parsed an invalid msg as a non-msg.\nInput `{}` parsed to NonMsg({:?})", + "Parsed an invalid msg as a non-msg.\nInput `{}` parsed to NonMsg({})", &input, leftover ), Ok(Msg(msg)) => panic!( - "Parsed an invalid msg as a msg.\nInput `{:?}` parsed to {:?}", + "Parsed an invalid msg as a msg.\nInput `{}` parsed to {:?}", &input, msg ), Err(_) => (), // should err @@ -45,7 +47,7 @@ fn parse_redis_msg() -> Result<(), RedisParseErr> { &input, leftover ), Ok(Msg(msg)) => msg, - Err(e) => panic!("Error in parsing subscribe command: {:?}", e), + Err(e) => panic!("Error in parsing subscribe command: {}", e), }; assert!(r_msg.leftover_input.is_empty()); @@ -55,21 +57,31 @@ fn parse_redis_msg() -> Result<(), RedisParseErr> { } #[test] -fn parse_long_redis_msg() -> Result<(), RedisParseErr> { - let input = ONE_MESSAGE_FOR_THE_USER_TIMLINE_FROM_REDIS; +fn parse_long_redis_msg() -> Result<(), Box> { + let pwd = path::Path::new(file!()).parent().expect("TEST"); - let r_msg = match RedisParseOutput::try_from(input) { - Ok(NonMsg(leftover)) => panic!( - "Parsed a msg as a non-msg.\nInput `{}` parsed to NonMsg({:?})", - &input, leftover - ), - Ok(Msg(msg)) => msg, - Err(e) => panic!("Error in parsing subscribe command: {:?}", e), - }; + let mut test_num = 1; + + while let (Ok(input), Ok(output)) = ( + fs::read_to_string(format!("{}/test_input/{:03}.resp", pwd.display(), test_num)), + fs::read_to_string(format!("{}/test_output/{:03}.txt", pwd.display(), test_num)), + ) { + println!("parsing `{:03}.resp`", test_num); + test_num += 1; + + let r_msg = match RedisParseOutput::try_from(input.as_str()) { + Ok(NonMsg(leftover)) => panic!( + "Parsed a msg as a non-msg.\nInput `{}` parsed to NonMsg({:?})", + &input, leftover + ), + Ok(Msg(msg)) => msg, + Err(e) => panic!("Error in parsing Redis input: {}", e), + }; + assert!(r_msg.leftover_input.is_empty()); + assert_eq!(r_msg.event_txt, output); + + assert_eq!(r_msg.timeline_txt, "timeline:public"); + } - assert!(r_msg.leftover_input.is_empty()); - assert_eq!(r_msg.timeline_txt, "timeline:1"); Ok(()) } - -const ONE_MESSAGE_FOR_THE_USER_TIMLINE_FROM_REDIS: &str = "*3\r\n$7\r\nmessage\r\n$10\r\ntimeline:1\r\n$3790\r\n{\"event\":\"update\",\"payload\":{\"id\":\"102775370117886890\",\"created_at\":\"2019-09-11T18:42:19.000Z\",\"in_reply_to_id\":null,\"in_reply_to_account_id\":null,\"sensitive\":false,\"spoiler_text\":\"\",\"visibility\":\"unlisted\",\"language\":\"en\",\"uri\":\"https://mastodon.host/users/federationbot/statuses/102775346916917099\",\"url\":\"https://mastodon.host/@federationbot/102775346916917099\",\"replies_count\":0,\"reblogs_count\":0,\"favourites_count\":0,\"favourited\":false,\"reblogged\":false,\"muted\":false,\"content\":\"

Trending tags:
#neverforget
#4styles
#newpipe
#uber
#mercredifiction

\",\"reblog\":null,\"account\":{\"id\":\"78\",\"username\":\"federationbot\",\"acct\":\"federationbot@mastodon.host\",\"display_name\":\"Federation Bot\",\"locked\":false,\"bot\":false,\"created_at\":\"2019-09-10T15:04:25.559Z\",\"note\":\"

Hello, I am mastodon.host official semi bot.

Follow me if you want to have some updates on the view of the fediverse from here ( I only post unlisted ).

I also randomly boost one of my followers toot every hour !

If you don\'t feel confortable with me following you, tell me: unfollow and I\'ll do it :)

If you want me to follow you, just tell me follow !

If you want automatic follow for new users on your instance and you are an instance admin, contact me !

Other commands are private :)

\",\"url\":\"https://mastodon.host/@federationbot\",\"avatar\":\"https://instance.codesections.com/system/accounts/avatars/000/000/078/original/d9e2be5398629cf8.jpeg?1568127863\",\"avatar_static\":\"https://instance.codesections.com/system/accounts/avatars/000/000/078/original/d9e2be5398629cf8.jpeg?1568127863\",\"header\":\"https://instance.codesections.com/headers/original/missing.png\",\"header_static\":\"https://instance.codesections.com/headers/original/missing.png\",\"followers_count\":16636,\"following_count\":179532,\"statuses_count\":50554,\"emojis\":[],\"fields\":[{\"name\":\"More stats\",\"value\":\"https://mastodon.host/stats.html\",\"verified_at\":null},{\"name\":\"More infos\",\"value\":\"https://mastodon.host/about/more\",\"verified_at\":null},{\"name\":\"Owner/Friend\",\"value\":\"@gled\",\"verified_at\":null}]},\"media_attachments\":[],\"mentions\":[],\"tags\":[{\"name\":\"4styles\",\"url\":\"https://instance.codesections.com/tags/4styles\"},{\"name\":\"neverforget\",\"url\":\"https://instance.codesections.com/tags/neverforget\"},{\"name\":\"mercredifiction\",\"url\":\"https://instance.codesections.com/tags/mercredifiction\"},{\"name\":\"uber\",\"url\":\"https://instance.codesections.com/tags/uber\"},{\"name\":\"newpipe\",\"url\":\"https://instance.codesections.com/tags/newpipe\"}],\"emojis\":[],\"card\":null,\"poll\":null},\"queued_at\":1568227693541}\r\n"; diff --git a/src/response/redis/msg/test_input/001.resp b/src/response/redis/msg/test_input/001.resp new file mode 100644 index 0000000..9ff7eac --- /dev/null +++ b/src/response/redis/msg/test_input/001.resp @@ -0,0 +1,7 @@ +*3 +$7 +message +$15 +timeline:public +$3790 +{"event":"update","payload":{"id":"102775370117886890","created_at":"2019-09-11T18:42:19.000Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"unlisted","language":"en","uri":"https://mastodon.host/users/federationbot/statuses/102775346916917099","url":"https://mastodon.host/@federationbot/102775346916917099","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"content":"

Trending tags:
#neverforget
#4styles
#newpipe
#uber
#mercredifiction

","reblog":null,"account":{"id":"78","username":"federationbot","acct":"federationbot@mastodon.host","display_name":"Federation Bot","locked":false,"bot":false,"created_at":"2019-09-10T15:04:25.559Z","note":"

Hello, I am mastodon.host official semi bot.

Follow me if you want to have some updates on the view of the fediverse from here ( I only post unlisted ).

I also randomly boost one of my followers toot every hour !

If you don't feel confortable with me following you, tell me: unfollow and I'll do it :)

If you want me to follow you, just tell me follow !

If you want automatic follow for new users on your instance and you are an instance admin, contact me !

Other commands are private :)

","url":"https://mastodon.host/@federationbot","avatar":"https://instance.codesections.com/system/accounts/avatars/000/000/078/original/d9e2be5398629cf8.jpeg?1568127863","avatar_static":"https://instance.codesections.com/system/accounts/avatars/000/000/078/original/d9e2be5398629cf8.jpeg?1568127863","header":"https://instance.codesections.com/headers/original/missing.png","header_static":"https://instance.codesections.com/headers/original/missing.png","followers_count":16636,"following_count":179532,"statuses_count":50554,"emojis":[],"fields":[{"name":"More stats","value":"https://mastodon.host/stats.html","verified_at":null},{"name":"More infos","value":"https://mastodon.host/about/more","verified_at":null},{"name":"Owner/Friend","value":"@gled","verified_at":null}]},"media_attachments":[],"mentions":[],"tags":[{"name":"4styles","url":"https://instance.codesections.com/tags/4styles"},{"name":"neverforget","url":"https://instance.codesections.com/tags/neverforget"},{"name":"mercredifiction","url":"https://instance.codesections.com/tags/mercredifiction"},{"name":"uber","url":"https://instance.codesections.com/tags/uber"},{"name":"newpipe","url":"https://instance.codesections.com/tags/newpipe"}],"emojis":[],"card":null,"poll":null},"queued_at":1568227693541} diff --git a/src/response/redis/msg/test_input/002.resp b/src/response/redis/msg/test_input/002.resp new file mode 100644 index 0000000..56f0d96 --- /dev/null +++ b/src/response/redis/msg/test_input/002.resp @@ -0,0 +1,7 @@ +*3 +$7 +message +$15 +timeline:public +$2872 +{"event":"update","payload":{"id":"104072549781970698","created_at":"2020-04-27T20:58:02.000Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"https://newsbots.eu/users/aljazeera_english/statuses/104072549673971025","url":"https://newsbots.eu/@aljazeera_english/104072549673971025","replies_count":0,"reblogs_count":0,"favourites_count":0,"content":"

**Far-right governor defies Rome, lifts Venice lockdown early**

\"Veneto's governor, Luca Zaia, of the far-rght League party, says keeping restrictions in place risks 'social conflict'.\"

https://www.aljazeera.com/news/2020/04/governor-defies-rome-lifts-venice-lockdown-early-200427171844336.html

#news #bot

","reblog":null,"account":{"id":"1852","username":"aljazeera_english","acct":"aljazeera_english@newsbots.eu","display_name":"Al Jazeera English","locked":false,"bot":true,"discoverable":true,"group":false,"created_at":"2020-03-20T22:08:35.417Z","note":"

Breaking news and ongoing coverage from around the world.

• unofficial •

","url":"https://newsbots.eu/@aljazeera_english","avatar":"https://instance.codesections.com/system/accounts/avatars/000/001/852/original/6377f39416193690.jpeg?1584742113","avatar_static":"https://instance.codesections.com/system/accounts/avatars/000/001/852/original/6377f39416193690.jpeg?1584742113","header":"https://instance.codesections.com/system/accounts/headers/000/001/852/original/f582c7deb0ec14ac.jpeg?1584742114","header_static":"https://instance.codesections.com/system/accounts/headers/000/001/852/original/f582c7deb0ec14ac.jpeg?1584742114","followers_count":915,"following_count":1,"statuses_count":26018,"last_status_at":"2020-04-27","emojis":[],"fields":[{"name":"📍","value":"Doha, Qatar","verified_at":null},{"name":"🔗","value":"https://www.aljazeera.com","verified_at":null}]},"media_attachments":[],"mentions":[],"tags":[{"name":"news","url":"https://instance.codesections.com/tags/news"},{"name":"bot","url":"https://instance.codesections.com/tags/bot"}],"emojis":[],"card":null,"poll":null}} diff --git a/src/response/redis/msg/test_input/003.resp b/src/response/redis/msg/test_input/003.resp new file mode 100644 index 0000000..90e6831 --- /dev/null +++ b/src/response/redis/msg/test_input/003.resp @@ -0,0 +1,7 @@ +*3 +$7 +message +$15 +timeline:public +$3018 +{"event":"update","payload":{"id":"104072557586605107","created_at":"2020-04-27T21:00:00.000Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"https://botsin.space/users/it_was_inevitable/statuses/104072557374505694","url":"https://botsin.space/@it_was_inevitable/104072557374505694","replies_count":0,"reblogs_count":0,"favourites_count":0,"content":"

I just wish to help somebody. I'm uneasy.

— Mörul Zedotmedtob, Cook

","reblog":null,"account":{"id":"2160","username":"it_was_inevitable","acct":"it_was_inevitable@botsin.space","display_name":"Sentient Dwarf Fortress","locked":false,"bot":true,"discoverable":true,"group":false,"created_at":"2020-03-24T02:44:05.588Z","note":"

It was inevitable.

Real quotes from Dwarf Fortress dwarves every 5 minutes.

Too fast? Try @it_was_inevitable_slow.

#dwarffortress

","url":"https://botsin.space/@it_was_inevitable","avatar":"https://instance.codesections.com/system/accounts/avatars/000/002/160/original/9d4fb963ee23aaef.gif?1585017843","avatar_static":"https://instance.codesections.com/system/accounts/avatars/000/002/160/static/9d4fb963ee23aaef.png?1585017843","header":"https://instance.codesections.com/system/accounts/headers/000/002/160/original/d52a62c64b18cac0.png?1585017845","header_static":"https://instance.codesections.com/system/accounts/headers/000/002/160/original/d52a62c64b18cac0.png?1585017845","followers_count":384,"following_count":4,"statuses_count":171387,"last_status_at":"2020-04-27","emojis":[],"fields":[{"name":"Overseer","value":"@ben","verified_at":null},{"name":"Game","value":"http://bay12games.com/dwarves/","verified_at":null},{"name":"DFHack","value":"https://dfhack.org/bay12","verified_at":null},{"name":"Code","value":"https://git.io/fNjyH","verified_at":null}]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}} diff --git a/src/response/redis/msg/test_input/004.resp b/src/response/redis/msg/test_input/004.resp new file mode 100644 index 0000000..ec178ea --- /dev/null +++ b/src/response/redis/msg/test_input/004.resp @@ -0,0 +1,7 @@ +*3 +$7 +message +$15 +timeline:public +$49 +{"event":"delete","payload":"104061222412800865"} diff --git a/src/response/redis/msg/test_input/005.resp b/src/response/redis/msg/test_input/005.resp new file mode 100644 index 0000000..52214be --- /dev/null +++ b/src/response/redis/msg/test_input/005.resp @@ -0,0 +1,7 @@ +*3 +$7 +message +$15 +timeline:public +$4199 +{"event":"update","payload":{"id":"104072561966487967","created_at":"2020-04-27T21:01:05.000Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":true,"spoiler_text":"","visibility":"public","language":"es","uri":"https://newsbots.eu/users/telesur_es/statuses/104072561638766292","url":"https://newsbots.eu/@telesur_es/104072561638766292","replies_count":0,"reblogs_count":0,"favourites_count":0,"content":"

Autoridades internacionales de la #FórmulaUno decidieron suspender el Gran Premio de #Francia, que se celebraría el próximo 28 de junio

Ante esta decisión, la primera parada del Campeonato del Mundo será el Gran Premio de Austria https://www.telesurtv.net/news/suspendido-gran-premio-francia-formula-uno-covid-20200427-0011.html 

","reblog":null,"account":{"id":"720","username":"telesur_es","acct":"telesur_es@newsbots.eu","display_name":"teleSUR TV (Extraoficial)","locked":false,"bot":true,"discoverable":false,"group":false,"created_at":"2020-03-13T11:08:17.249Z","note":"

Con más 40 corresponsales en el mundo, alzamos nuestra voz donde otros medios callan. teleSUR es la señal informativa de América Latina

","url":"https://newsbots.eu/@telesur_es","avatar":"https://instance.codesections.com/system/accounts/avatars/000/000/720/original/57b77baa5d424d0c.jpeg?1584097695","avatar_static":"https://instance.codesections.com/system/accounts/avatars/000/000/720/original/57b77baa5d424d0c.jpeg?1584097695","header":"https://instance.codesections.com/headers/original/missing.png","header_static":"https://instance.codesections.com/headers/original/missing.png","followers_count":898,"following_count":0,"statuses_count":40648,"last_status_at":"2020-04-27","emojis":[],"fields":[{"name":"Fuente","value":"https://twitter.com/telesurtv","verified_at":null},{"name":"En inglés","value":"@telesur_en","verified_at":null},{"name":"Operador","value":"@felix","verified_at":null},{"name":"Codigo","value":"https://yerbamate.dev/nutomic/tootbot","verified_at":null}]},"media_attachments":[{"id":"13283","type":"image","url":"https://instance.codesections.com/system/media_attachments/files/000/013/283/original/0d148b189319d632.jpeg?1588021269","preview_url":"https://instance.codesections.com/system/media_attachments/files/000/013/283/small/0d148b189319d632.jpeg?1588021269","remote_url":"https://newsbots.eu/system/media_attachments/files/000/199/561/original/8f1042130e797306.jpeg","text_url":null,"meta":{"original":{"width":600,"height":338,"size":"600x338","aspect":1.7751479289940828},"small":{"width":533,"height":300,"size":"533x300","aspect":1.7766666666666666}},"description":null,"blurhash":"U9Dcs{QU4mTGu2VFWAkpDinl%2%LxZ%Lxuxu"}],"mentions":[],"tags":[{"name":"FórmulaUno","url":"https://instance.codesections.com/tags/F%C3%B3rmulaUno"},{"name":"francia","url":"https://instance.codesections.com/tags/francia"}],"emojis":[],"card":null,"poll":null}} diff --git a/src/response/redis/msg/test_input/006.resp b/src/response/redis/msg/test_input/006.resp new file mode 100644 index 0000000..eba4a4a --- /dev/null +++ b/src/response/redis/msg/test_input/006.resp @@ -0,0 +1,7 @@ +*3 +$7 +message +$15 +timeline:public +$3669 +{"event":"update","payload":{"id":"104072567176319159","created_at":"2020-04-27T21:00:34.000Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"https://botsin.space/users/UnitooWebRadio/statuses/104072559646747168","url":"https://botsin.space/@UnitooWebRadio/104072559646747168","replies_count":0,"reblogs_count":0,"favourites_count":0,"content":"

🎶 #NowPlaying
War
by GoSoundtrack
Listeners: 0
https://radio.unitoo.it/public/liveradio

","reblog":null,"account":{"id":"2161","username":"UnitooWebRadio","acct":"UnitooWebRadio@botsin.space","display_name":"(BoT) Radio Unitoo","locked":false,"bot":true,"discoverable":true,"group":false,"created_at":"2020-03-24T02:48:10.344Z","note":"

https://www.unitoo.it/progetti/radio/
Follow #UnitooLiveRadio
Una WebRadio Italiana che trasmette musica RoyaltyFree e che tratta tematiche inerenti al mondo del Software Libero e Open Source, Adatta ad ascoltatori di qualsiasi genere / credo / età.

","url":"https://botsin.space/@UnitooWebRadio","avatar":"https://instance.codesections.com/system/accounts/avatars/000/002/161/original/c1949ebb71a0bf25.png?1585156010","avatar_static":"https://instance.codesections.com/system/accounts/avatars/000/002/161/original/c1949ebb71a0bf25.png?1585156010","header":"https://instance.codesections.com/headers/original/missing.png","header_static":"https://instance.codesections.com/headers/original/missing.png","followers_count":13,"following_count":3,"statuses_count":9460,"last_status_at":"2020-04-27","emojis":[],"fields":[{"name":"Liberapay","value":"https://liberapay.com/UnitooWebRadio","verified_at":null},{"name":"Web Player","value":"https://radio.unitoo.it/public/liveradio","verified_at":null},{"name":"MP3 Link","value":"https://radio.unitoo.it/radio/8000/radio.mp3","verified_at":null},{"name":"Site","value":"https://www.unitoo.it/progetti/radio/","verified_at":null}]},"media_attachments":[],"mentions":[],"tags":[{"name":"nowplaying","url":"https://instance.codesections.com/tags/nowplaying"}],"emojis":[],"card":null,"poll":null}} diff --git a/src/response/redis/msg/test_output/001.txt b/src/response/redis/msg/test_output/001.txt new file mode 100644 index 0000000..055b1cc --- /dev/null +++ b/src/response/redis/msg/test_output/001.txt @@ -0,0 +1 @@ +{"event":"update","payload":{"id":"102775370117886890","created_at":"2019-09-11T18:42:19.000Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"unlisted","language":"en","uri":"https://mastodon.host/users/federationbot/statuses/102775346916917099","url":"https://mastodon.host/@federationbot/102775346916917099","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"content":"

Trending tags:
#neverforget
#4styles
#newpipe
#uber
#mercredifiction

","reblog":null,"account":{"id":"78","username":"federationbot","acct":"federationbot@mastodon.host","display_name":"Federation Bot","locked":false,"bot":false,"created_at":"2019-09-10T15:04:25.559Z","note":"

Hello, I am mastodon.host official semi bot.

Follow me if you want to have some updates on the view of the fediverse from here ( I only post unlisted ).

I also randomly boost one of my followers toot every hour !

If you don't feel confortable with me following you, tell me: unfollow and I'll do it :)

If you want me to follow you, just tell me follow !

If you want automatic follow for new users on your instance and you are an instance admin, contact me !

Other commands are private :)

","url":"https://mastodon.host/@federationbot","avatar":"https://instance.codesections.com/system/accounts/avatars/000/000/078/original/d9e2be5398629cf8.jpeg?1568127863","avatar_static":"https://instance.codesections.com/system/accounts/avatars/000/000/078/original/d9e2be5398629cf8.jpeg?1568127863","header":"https://instance.codesections.com/headers/original/missing.png","header_static":"https://instance.codesections.com/headers/original/missing.png","followers_count":16636,"following_count":179532,"statuses_count":50554,"emojis":[],"fields":[{"name":"More stats","value":"https://mastodon.host/stats.html","verified_at":null},{"name":"More infos","value":"https://mastodon.host/about/more","verified_at":null},{"name":"Owner/Friend","value":"@gled","verified_at":null}]},"media_attachments":[],"mentions":[],"tags":[{"name":"4styles","url":"https://instance.codesections.com/tags/4styles"},{"name":"neverforget","url":"https://instance.codesections.com/tags/neverforget"},{"name":"mercredifiction","url":"https://instance.codesections.com/tags/mercredifiction"},{"name":"uber","url":"https://instance.codesections.com/tags/uber"},{"name":"newpipe","url":"https://instance.codesections.com/tags/newpipe"}],"emojis":[],"card":null,"poll":null},"queued_at":1568227693541} \ No newline at end of file diff --git a/src/response/redis/msg/test_output/002.txt b/src/response/redis/msg/test_output/002.txt new file mode 100644 index 0000000..9d2d196 --- /dev/null +++ b/src/response/redis/msg/test_output/002.txt @@ -0,0 +1 @@ +{"event":"update","payload":{"id":"104072549781970698","created_at":"2020-04-27T20:58:02.000Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"https://newsbots.eu/users/aljazeera_english/statuses/104072549673971025","url":"https://newsbots.eu/@aljazeera_english/104072549673971025","replies_count":0,"reblogs_count":0,"favourites_count":0,"content":"

**Far-right governor defies Rome, lifts Venice lockdown early**

\"Veneto's governor, Luca Zaia, of the far-rght League party, says keeping restrictions in place risks 'social conflict'.\"

https://www.aljazeera.com/news/2020/04/governor-defies-rome-lifts-venice-lockdown-early-200427171844336.html

#news #bot

","reblog":null,"account":{"id":"1852","username":"aljazeera_english","acct":"aljazeera_english@newsbots.eu","display_name":"Al Jazeera English","locked":false,"bot":true,"discoverable":true,"group":false,"created_at":"2020-03-20T22:08:35.417Z","note":"

Breaking news and ongoing coverage from around the world.

• unofficial •

","url":"https://newsbots.eu/@aljazeera_english","avatar":"https://instance.codesections.com/system/accounts/avatars/000/001/852/original/6377f39416193690.jpeg?1584742113","avatar_static":"https://instance.codesections.com/system/accounts/avatars/000/001/852/original/6377f39416193690.jpeg?1584742113","header":"https://instance.codesections.com/system/accounts/headers/000/001/852/original/f582c7deb0ec14ac.jpeg?1584742114","header_static":"https://instance.codesections.com/system/accounts/headers/000/001/852/original/f582c7deb0ec14ac.jpeg?1584742114","followers_count":915,"following_count":1,"statuses_count":26018,"last_status_at":"2020-04-27","emojis":[],"fields":[{"name":"📍","value":"Doha, Qatar","verified_at":null},{"name":"🔗","value":"https://www.aljazeera.com","verified_at":null}]},"media_attachments":[],"mentions":[],"tags":[{"name":"news","url":"https://instance.codesections.com/tags/news"},{"name":"bot","url":"https://instance.codesections.com/tags/bot"}],"emojis":[],"card":null,"poll":null}} \ No newline at end of file diff --git a/src/response/redis/msg/test_output/003.txt b/src/response/redis/msg/test_output/003.txt new file mode 100644 index 0000000..c7b013d --- /dev/null +++ b/src/response/redis/msg/test_output/003.txt @@ -0,0 +1 @@ +{"event":"update","payload":{"id":"104072557586605107","created_at":"2020-04-27T21:00:00.000Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"https://botsin.space/users/it_was_inevitable/statuses/104072557374505694","url":"https://botsin.space/@it_was_inevitable/104072557374505694","replies_count":0,"reblogs_count":0,"favourites_count":0,"content":"

I just wish to help somebody. I'm uneasy.

— Mörul Zedotmedtob, Cook

","reblog":null,"account":{"id":"2160","username":"it_was_inevitable","acct":"it_was_inevitable@botsin.space","display_name":"Sentient Dwarf Fortress","locked":false,"bot":true,"discoverable":true,"group":false,"created_at":"2020-03-24T02:44:05.588Z","note":"

It was inevitable.

Real quotes from Dwarf Fortress dwarves every 5 minutes.

Too fast? Try @it_was_inevitable_slow.

#dwarffortress

","url":"https://botsin.space/@it_was_inevitable","avatar":"https://instance.codesections.com/system/accounts/avatars/000/002/160/original/9d4fb963ee23aaef.gif?1585017843","avatar_static":"https://instance.codesections.com/system/accounts/avatars/000/002/160/static/9d4fb963ee23aaef.png?1585017843","header":"https://instance.codesections.com/system/accounts/headers/000/002/160/original/d52a62c64b18cac0.png?1585017845","header_static":"https://instance.codesections.com/system/accounts/headers/000/002/160/original/d52a62c64b18cac0.png?1585017845","followers_count":384,"following_count":4,"statuses_count":171387,"last_status_at":"2020-04-27","emojis":[],"fields":[{"name":"Overseer","value":"@ben","verified_at":null},{"name":"Game","value":"http://bay12games.com/dwarves/","verified_at":null},{"name":"DFHack","value":"https://dfhack.org/bay12","verified_at":null},{"name":"Code","value":"https://git.io/fNjyH","verified_at":null}]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}} \ No newline at end of file diff --git a/src/response/redis/msg/test_output/004.txt b/src/response/redis/msg/test_output/004.txt new file mode 100644 index 0000000..4d4e2de --- /dev/null +++ b/src/response/redis/msg/test_output/004.txt @@ -0,0 +1 @@ +{"event":"delete","payload":"104061222412800865"} \ No newline at end of file diff --git a/src/response/redis/msg/test_output/005.txt b/src/response/redis/msg/test_output/005.txt new file mode 100644 index 0000000..fd6ea7f --- /dev/null +++ b/src/response/redis/msg/test_output/005.txt @@ -0,0 +1 @@ +{"event":"update","payload":{"id":"104072561966487967","created_at":"2020-04-27T21:01:05.000Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":true,"spoiler_text":"","visibility":"public","language":"es","uri":"https://newsbots.eu/users/telesur_es/statuses/104072561638766292","url":"https://newsbots.eu/@telesur_es/104072561638766292","replies_count":0,"reblogs_count":0,"favourites_count":0,"content":"

Autoridades internacionales de la #FórmulaUno decidieron suspender el Gran Premio de #Francia, que se celebraría el próximo 28 de junio

Ante esta decisión, la primera parada del Campeonato del Mundo será el Gran Premio de Austria https://www.telesurtv.net/news/suspendido-gran-premio-francia-formula-uno-covid-20200427-0011.html 

","reblog":null,"account":{"id":"720","username":"telesur_es","acct":"telesur_es@newsbots.eu","display_name":"teleSUR TV (Extraoficial)","locked":false,"bot":true,"discoverable":false,"group":false,"created_at":"2020-03-13T11:08:17.249Z","note":"

Con más 40 corresponsales en el mundo, alzamos nuestra voz donde otros medios callan. teleSUR es la señal informativa de América Latina

","url":"https://newsbots.eu/@telesur_es","avatar":"https://instance.codesections.com/system/accounts/avatars/000/000/720/original/57b77baa5d424d0c.jpeg?1584097695","avatar_static":"https://instance.codesections.com/system/accounts/avatars/000/000/720/original/57b77baa5d424d0c.jpeg?1584097695","header":"https://instance.codesections.com/headers/original/missing.png","header_static":"https://instance.codesections.com/headers/original/missing.png","followers_count":898,"following_count":0,"statuses_count":40648,"last_status_at":"2020-04-27","emojis":[],"fields":[{"name":"Fuente","value":"https://twitter.com/telesurtv","verified_at":null},{"name":"En inglés","value":"@telesur_en","verified_at":null},{"name":"Operador","value":"@felix","verified_at":null},{"name":"Codigo","value":"https://yerbamate.dev/nutomic/tootbot","verified_at":null}]},"media_attachments":[{"id":"13283","type":"image","url":"https://instance.codesections.com/system/media_attachments/files/000/013/283/original/0d148b189319d632.jpeg?1588021269","preview_url":"https://instance.codesections.com/system/media_attachments/files/000/013/283/small/0d148b189319d632.jpeg?1588021269","remote_url":"https://newsbots.eu/system/media_attachments/files/000/199/561/original/8f1042130e797306.jpeg","text_url":null,"meta":{"original":{"width":600,"height":338,"size":"600x338","aspect":1.7751479289940828},"small":{"width":533,"height":300,"size":"533x300","aspect":1.7766666666666666}},"description":null,"blurhash":"U9Dcs{QU4mTGu2VFWAkpDinl%2%LxZ%Lxuxu"}],"mentions":[],"tags":[{"name":"FórmulaUno","url":"https://instance.codesections.com/tags/F%C3%B3rmulaUno"},{"name":"francia","url":"https://instance.codesections.com/tags/francia"}],"emojis":[],"card":null,"poll":null}} \ No newline at end of file diff --git a/src/response/redis/msg/test_output/006.txt b/src/response/redis/msg/test_output/006.txt new file mode 100644 index 0000000..b7ca8a9 --- /dev/null +++ b/src/response/redis/msg/test_output/006.txt @@ -0,0 +1 @@ +{"event":"update","payload":{"id":"104072567176319159","created_at":"2020-04-27T21:00:34.000Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"https://botsin.space/users/UnitooWebRadio/statuses/104072559646747168","url":"https://botsin.space/@UnitooWebRadio/104072559646747168","replies_count":0,"reblogs_count":0,"favourites_count":0,"content":"

🎶 #NowPlaying
War
by GoSoundtrack
Listeners: 0
https://radio.unitoo.it/public/liveradio

","reblog":null,"account":{"id":"2161","username":"UnitooWebRadio","acct":"UnitooWebRadio@botsin.space","display_name":"(BoT) Radio Unitoo","locked":false,"bot":true,"discoverable":true,"group":false,"created_at":"2020-03-24T02:48:10.344Z","note":"

https://www.unitoo.it/progetti/radio/
Follow #UnitooLiveRadio
Una WebRadio Italiana che trasmette musica RoyaltyFree e che tratta tematiche inerenti al mondo del Software Libero e Open Source, Adatta ad ascoltatori di qualsiasi genere / credo / età.

","url":"https://botsin.space/@UnitooWebRadio","avatar":"https://instance.codesections.com/system/accounts/avatars/000/002/161/original/c1949ebb71a0bf25.png?1585156010","avatar_static":"https://instance.codesections.com/system/accounts/avatars/000/002/161/original/c1949ebb71a0bf25.png?1585156010","header":"https://instance.codesections.com/headers/original/missing.png","header_static":"https://instance.codesections.com/headers/original/missing.png","followers_count":13,"following_count":3,"statuses_count":9460,"last_status_at":"2020-04-27","emojis":[],"fields":[{"name":"Liberapay","value":"https://liberapay.com/UnitooWebRadio","verified_at":null},{"name":"Web Player","value":"https://radio.unitoo.it/public/liveradio","verified_at":null},{"name":"MP3 Link","value":"https://radio.unitoo.it/radio/8000/radio.mp3","verified_at":null},{"name":"Site","value":"https://www.unitoo.it/progetti/radio/","verified_at":null}]},"media_attachments":[],"mentions":[],"tags":[{"name":"nowplaying","url":"https://instance.codesections.com/tags/nowplaying"}],"emojis":[],"card":null,"poll":null}} \ No newline at end of file