Skip to content

Commit

Permalink
Improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanprjcts committed Mar 18, 2020
1 parent 692e14a commit 5384b1c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
language: python
python:
- "3.5"
- "3.6"
env:
- TOX_ENV=py27
- TOX_ENV=py34
- TOX_ENV=py35
- TOX_ENV=py36
install:
- pip install tox
- pip install codecov
Expand Down
15 changes: 11 additions & 4 deletions tests/test_json_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ def test_encode_json_data_array_of_dictionaries(self):
r = JSONRenderer()
body, content_type = r.encode_params(data)
self.assertEqual(content_type, "application/json")
self.assertEqual(b'[{"param1": "value 1", "param2": "value 2", "param3": "value 3"}, '
b'{"param1": "value 1"}]', body)
self.assertIn(b'[{"', body)
self.assertIn(b'"param1": "value 1"', body)
self.assertIn(b'"param2": "value 2"', body)
self.assertIn(b'"param3": "value 3"', body)
self.assertIn(b', {"param1": "value 1"}]', body)

def test_encode_json_data_array_of_2dictionaries(self):
data = [
Expand All @@ -90,5 +93,9 @@ def test_encode_json_data_array_of_2dictionaries(self):
r = JSONRenderer()
body, content_type = r.encode_params(data)
self.assertEqual(content_type, "application/json")
self.assertEqual(b'[{"param1": "value 1", "param2": "value 2"}, '
b'{"param3": "value 3", "param4": "value 4"}]', body)
self.assertIn(b'[{"', body)
self.assertIn(b'"}]', body)
self.assertIn(b'"param1": "value 1"', body)
self.assertIn(b'"param2": "value 2"', body)
self.assertIn(b'"param3": "value 3"', body)
self.assertIn(b'"param4": "value 4"', body)
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27, py34, py35
envlist = py27, py35, py36

[testenv]
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
Expand Down

0 comments on commit 5384b1c

Please sign in to comment.