Adding unit tests

resolves https://github.com/owncloud/apps/issues/1933 some cases are not testable in current architecture (per conversation with icewind)

depends on https://github.com/owncloud/core/pull/11322
See #1943 for the fix for having to pass the handles yourself