hwrt/view.py: refactoring; added test