Refactor and fix logic in recording api

Refactored and fixed recording api logic.
Implemented a shelve object so changes can persist more reliably and
elminate the need for server teardown code.
API tests now use pytest fixtures to create a baseline for
tests instead of xunit style setup and teardown methods.
Refactored and fixed logic of test_server.py tests.