summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_completion.py14
-rw-r--r--test/test_logger.py8
-rw-r--r--test/test_windows.py8
3 files changed, 19 insertions, 11 deletions
diff --git a/test/test_completion.py b/test/test_completion.py
index 4c5bc400..620b5658 100644
--- a/test/test_completion.py
+++ b/test/test_completion.py
@@ -15,13 +15,19 @@ config.config = ConfigShim()
from poezio.windows import Input
+class SubInput(Input):
+ def resize(self, *args, **kwargs):
+ pass
+ def rewrite_text(self, *args, **kwargs):
+ pass
+ def refresh(self, *args, **kwargs):
+ pass
+
+
@pytest.fixture(scope="function")
def input_obj():
- obj = Input()
+ obj = SubInput()
obj.reset_completion()
- obj.resize = lambda: None
- obj.rewrite_text = lambda: None
- obj.refresh = lambda: None
return obj
@pytest.fixture(scope="module")
diff --git a/test/test_logger.py b/test/test_logger.py
index f1851d60..09ba720e 100644
--- a/test/test_logger.py
+++ b/test/test_logger.py
@@ -7,13 +7,13 @@ from poezio.common import get_utc_time, get_local_time
def test_parse_message():
line = 'MR 20170909T09:09:09Z 000 <nick>  body'
- assert vars(parse_log_line(line)) == vars(LogMessage('2017', '09', '09', '09', '09', '09', '0', 'nick', 'body'))
+ assert vars(parse_log_line(line, 'user@domain')) == vars(LogMessage('2017', '09', '09', '09', '09', '09', '0', 'nick', 'body'))
line = '<>'
- assert parse_log_line(line) is None
+ assert parse_log_line(line, 'user@domain') is None
line = 'MR 20170908T07:05:04Z 003 <nick>  '
- assert vars(parse_log_line(line)) == vars(LogMessage('2017', '09', '08', '07', '05', '04', '003', 'nick', ''))
+ assert vars(parse_log_line(line, 'user@domain')) == vars(LogMessage('2017', '09', '08', '07', '05', '04', '003', 'nick', ''))
def test_log_and_parse_messages():
@@ -27,7 +27,7 @@ def test_log_and_parse_messages():
msg2_utc = get_utc_time(msg2['date'])
assert built_msg2 == 'MR %s 001 <toto>  coucou\n coucou\n' % (msg2_utc.strftime('%Y%m%dT%H:%M:%SZ'))
- assert parse_log_lines((built_msg1 + built_msg2).split('\n')) == [
+ assert parse_log_lines((built_msg1 + built_msg2).split('\n'), 'user@domain') == [
{'time': msg1['date'], 'history': True, 'txt': '\x195,-1}coucou', 'nickname': 'toto'},
{'time': msg2['date'], 'history': True, 'txt': '\x195,-1}coucou\ncoucou', 'nickname': 'toto'},
]
diff --git a/test/test_windows.py b/test/test_windows.py
index cb7c86b7..af1b9d4a 100644
--- a/test/test_windows.py
+++ b/test/test_windows.py
@@ -9,11 +9,13 @@ config.config = ConfigShim()
from poezio.windows import Input, HistoryInput, MessageInput
+class SubInput(Input):
+ def rewrite_text(self, *args, **kwargs):
+ return None
+
@pytest.fixture
def input():
- input = Input()
- input.rewrite_text = lambda: None
- return input
+ return SubInput()
class TestInput(object):