Fix a gross duplication of context code in objects tests

Because of the way we dual-inherit classes to get the local
and remote testing of objects, laziness caused us to duplicate
the code to get a context object all over the place. This
patch cleans that up.

Change-Id: I9b65968781afbecd0db72073299c019f8cc10241
Merge "Fix a gross duplication of context code in objects tests"