Attempted to fix api token unit tests.

Unit tests related to shiro have spontaneously started failing on some but not all of our Jenkins jobs. The tests pass locally, but it's possible that this different way of mocking the objects will avoid a possible race condition or accidental cross-test state sharing when running the tests on Jenkins nodes.
Merge pull request #565 from joesondow/try-to-fix-oddly-failing-api-token-tests

Attempted to fix api token unit tests.