abstract some methods in contents service tests

should allow re-use for ContentsManager subclasses

closes #7190

I don't have a ContentsManager to verify this against, so I'd like to hear from @ssanderson on this one, and we can iron out details.
I was using the explicit os operation to catch bugs that can be symmetrical on in/out, such as encoding issues.