Adding tests for submit challenge route.

Also cleaning up some code in that route as a result of the tests.