Fixed tests. Starting to add endpoint tests too.
Tests ready for staging.