Added unit tests for hwdoc commands

Django management commands in hwdoc did not have unit tests. This commit
adds some preliminary ones using the dummy backend. This process
identified errors in some commands which were fixed. Mostly erroneous
sys.exit calls and non raising of CommandErrors