Fix tests for `api.py` and `pages.py`
This PR fixes the tests for views/api.py
and views/pages.py
. The api
module was fixed by converting strings to and from bytes objects, and the page
module was fixed by moving from the deprecated render_to_response
function to the current render
function.
Please review: @NUWAN.KUMARASIRI @TREFILEK @bjsousa