Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.

Commit 230c788

Browse files
committed
add unittests for utils.is_json
1 parent 5efcfef commit 230c788

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

tests/test_utils.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,5 +388,21 @@ def getresponse(self):
388388
self.assertFalse(response)
389389

390390

391+
class TestIsJson(unittest.TestCase):
392+
393+
def test_is_json(self):
394+
from WmAgentScripts.utils import is_json
395+
396+
test_json = {
397+
"first": {"a": "A"},
398+
"second": "B"
399+
}
400+
401+
self.assertTrue(is_json(json.dumps(test_json)))
402+
403+
with self.assertRaises(TypeError):
404+
self.assertFalse(is_json(test_json))
405+
406+
391407
if __name__ == '__main__':
392408
unittest.main()

0 commit comments

Comments
 (0)