Completed
Push — main ( 25807a...2ed45a )
by Jochen
01:37
created

tests.http.test_parse_json_message   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A test_parse_json_message() 0 18 1
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