This PR represents a lot of refactor work on the rest_adapter_test unit tests.

All of the tests which are passing have been modified to match their original passing conditions.  There is one failing test included (which I believe is legitimate), that uncovers an issue with sideloading data.

Summary of changes:
- added flagEquals / stateEquals assertion helpers
- added comments for test helpers
- removed teardown for tests (all tests remained green after doing so)
- cleaned up scoping for tests -- globals only used for configuration, locals used for test data
- relocated helper functions to top of test
- removed unnecessary var definitions
- created a consistent test format:
- test setup code is grouped together
- test assertion code is grouped together
- whitespace between setup and assertion code
- comments above each individual assertion and setup block
- each test should have a state and flag assertion after a model change state

The new flagEquals() assertions and stateEquals() assertions should probably be audited to ensure that the state of the records should actually be what the assertion says they are. While re-writing these tests, I personally disagree with some of the flags set for the given record states.