Total Complexity | 1 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | """ |
||
2 | :Copyright: 2007-2020 Jochen Kupperschmidt |
||
3 | :License: MIT, see LICENSE for details. |
||
4 | """ |
||
5 | |||
6 | import json |
||
7 | |||
8 | import pytest |
||
9 | |||
10 | from weitersager.http import parse_json_message |
||
11 | |||
12 | |||
13 | @pytest.mark.parametrize( |
||
14 | 'channel, text', |
||
15 | [ |
||
16 | ('#example', 'ohai, kthxbye!'), |
||
17 | ('#idlers', 'Nothing to see here, move along.'), |
||
18 | ], |
||
19 | ) |
||
20 | def test_parse_json_message(channel, text): |
||
21 | data = { |
||
22 | 'channel': channel, |
||
23 | 'text': text, |
||
24 | } |
||
25 | json_data = json.dumps(data) |
||
26 | |||
27 | message = parse_json_message(json_data) |
||
28 | |||
29 | assert message.channel == channel |
||
30 | assert message.text == text |
||
31 |