adding API tests

We're adding API tests and fix the view so that the tests pass
as expected