Fixed parser tests
This commit is contained in:
parent
1c50451187
commit
f3648d568c
@ -1,4 +1,3 @@
|
||||
from src import trader
|
||||
from src import config
|
||||
from src import data
|
||||
from datetime import datetime
|
||||
@ -10,7 +9,7 @@ def test_message_from():
|
||||
data.compile_regex(conf)
|
||||
text = '2021/03/08 23:24:52 17931875 bb3 [INFO Client 1492] @From NyhaiPuki: Hi, I would like to buy your level 21 23% Vaal Impurity of Lightning ' \
|
||||
'listed for 18 chaos in Ritual (stash tab "$"; position: left 22, top 5)'
|
||||
message = trader.parse_log(text)
|
||||
message = data.Message.from_text(text)
|
||||
assert message.user == 'NyhaiPuki'
|
||||
assert message.message == 'Hi, I would like to buy your level 21 23% Vaal Impurity of Lightning ' \
|
||||
'listed for 18 chaos in Ritual (stash tab "$"; position: left 22, top 5)'
|
||||
@ -30,7 +29,7 @@ def test_message_to():
|
||||
conf = config.read_config(r'config.yaml')
|
||||
data.compile_regex(conf)
|
||||
text_to = '2021/01/24 23:11:23 17039703 bb2 [INFO Client 10144] @To EraseAndDelete: Thank you & good luck!'
|
||||
message = trader.parse_log(text_to)
|
||||
message = data.Message.from_text(text_to)
|
||||
assert message.user == 'EraseAndDelete'
|
||||
assert message.message == 'Thank you & good luck!'
|
||||
assert message.date == datetime(2021, 1, 24, 23, 11, 23)
|
||||
@ -44,7 +43,7 @@ def test_message_global():
|
||||
conf = config.read_config(r'config.yaml')
|
||||
data.compile_regex(conf)
|
||||
text_global = '2021/02/10 19:01:56 2720500 bb2 [INFO Client 3464] #HarvestScarab: so by the time it was finally juiced you couldnt do it'
|
||||
message = trader.parse_log(text_global)
|
||||
message = data.Message.from_text(text_global)
|
||||
assert message.user == 'HarvestScarab'
|
||||
assert message.message == 'so by the time it was finally juiced you couldnt do it'
|
||||
assert message.date == datetime(2021, 2, 10, 19, 1, 56)
|
||||
|
Loading…
x
Reference in New Issue
Block a user