ttest_parser.py - tomb - the crypto undertaker
HTML git clone git://parazyd.org/tomb.git
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
ttest_parser.py (1982B)
---
1 from tomblib.parser import *
2
3 class TestWrong:
4 def test_short(self):
5 '''short format is not supported anymore'''
6 assert parse_line('[!] foo') is None
7 def test_colors(self):
8 '''parsing while using colors should fail'''
9 parse = parse_line('\033[32mundertaker [W] url protocol not recognized: nonscheme')
10 assert parse is None
11 def test_no_spaces_in_programname(self):
12 parse = parse_line('tomb open [W] url protocol not recognized: nonscheme')
13 assert parse is None
14
15 class TestFound:
16 def test_simple(self):
17 parse = parse_line('[m][found] scheme:///and/path')
18 assert parse is not None
19 assert parse['type'] == 'found'
20 assert parse['content'] == 'scheme:///and/path'
21 assert 'scheme' in parse
22 assert parse['scheme'] == 'scheme'
23 assert 'path' in parse
24 assert parse['path'] == '/and/path'
25
26 class TestGeneric:
27 def test_simple(self):
28 parse = parse_line('undertaker [W] url protocol not recognized: nonscheme')
29 assert parse is not None
30 assert parse['type'] == 'warning'
31 assert parse['content'] == 'url protocol not recognized: nonscheme'
32
33 def test_debug(self):
34 parse = parse_line('undertaker [D] url protocol not recognized: nonscheme')
35 assert parse is not None
36 assert parse['type'] == 'debug'
37 assert parse['content'] == 'url protocol not recognized: nonscheme'
38
39 def test_success(self):
40 parse = parse_line('undertaker (*) url protocol not recognized: nonscheme')
41 assert parse is not None
42 assert parse['type'] == 'success'
43 assert parse['content'] == 'url protocol not recognized: nonscheme'
44
45 def test_dash(self):
46 parse = parse_line('tomb-open [W] url protocol not recognized: nonscheme')
47 assert parse is not None
48 assert parse['type'] == 'warning'
49 assert parse['content'] == 'url protocol not recognized: nonscheme'
50
51
52