Skip to content

Commit 01864a9

Browse files
committed
add missing tests
1 parent 9bbb781 commit 01864a9

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/test_api_diff.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,29 @@ def test_ofmt_term(client):
4848
assert rv.status_code == 200
4949
assert rv.content_type.startswith('text/plain')
5050
assert rv.data == b"\x1b[32m+ 'b'\x1b[0m\n"
51+
52+
53+
def test_ofmt_html(client):
54+
rv = client.post('/api/v1/diff', json={
55+
'a': 'a',
56+
'b': 'b',
57+
'diff_opts': {'O': False},
58+
'ofmt': 'html',
59+
})
60+
61+
assert rv.status_code == 200
62+
assert rv.content_type.startswith('text/plain')
63+
assert rv.data == b'<div class="nDvD"><div>+ <div class="nDvN">&#x27;b&#x27;</div></div></div>'
64+
65+
66+
def test_ofmt_unsupported(client):
67+
rv = client.post('/api/v1/diff', json={
68+
'a': 'a',
69+
'b': 'b',
70+
'diff_opts': {'O': False},
71+
'ofmt': '__unsupported__',
72+
})
73+
74+
assert rv.status_code == 400
75+
assert rv.content_type.startswith('text/html')
76+
assert rv.data == b'Unsupported format __unsupported__'

0 commit comments

Comments
 (0)