test: extract createSharedClass to helper file

Move the function `createSharedClass()`
  from test/rest.test.js
  to test/helpers/shared-objects-factory.js
so that it can be reused by multiple tests.
Swagger handles non-root location of REST API

When the swagger extension is configured with a custom basePath,
this basePath is now honored in the Swagger descriptors.

1. When `options.basePath` is not defined, `http://{host}/`
  is used instead.

2. When `options.basePath` starts with `/`, it is appended to the
  host URL, i.e. `http://{host}/{options.basePath}`.

3. When `option.basePath` is a http or https URL, then this value
  is passed to the descriptor without any modifications.