adding test for returning BadRequest upon error and updating views to return BadRequest upon error, refactoring view generation into views.py