| 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.httpreceiver import Message |
||
| 11 | |||
| 12 | |||
| 13 | @pytest.mark.parametrize( |
||
| 14 | 'channels, text', |
||
| 15 | [ |
||
| 16 | (['#example' ], 'ohai, kthxbye!' ), |
||
| 17 | (['#partyline', '#idlers'], 'Nothing to see here, move along.'), |
||
| 18 | ], |
||
| 19 | ) |
||
| 20 | def test_from_json(channels, text): |
||
| 21 | data = { |
||
| 22 | 'channels': channels, |
||
| 23 | 'text': text, |
||
| 24 | } |
||
| 25 | json_data = json.dumps(data) |
||
| 26 | |||
| 27 | message = Message.from_json(json_data) |
||
| 28 | |||
| 29 | assert message.channels == frozenset(channels) |
||
| 30 | assert message.text == text |
||
| 31 |