Improve contract tests to remove dependence on stubs and unnecessary system calls. Change-type: patch