def test_json(): """Test the JSON output capability of the error bundler.""" # Use the StringIO as an output buffer. bundle = ErrorBundle() # No color since no output bundle.set_tier(4) bundle.set_tier(3) bundle.error((), "error", "description") bundle.warning((), "warning", "description") bundle.notice((), "notice", "description") results = json.loads(bundle.render_json()) eq_(len(results["messages"]), 3) assert not results["success"] eq_(results["ending_tier"], 4)