Refactor and re-enable unittest to prepare for some speed optimisations

Preparing to make CCM fast enough for https://github.com/quattor/ncm-query/pull/5, came to the conclusion that CCM needed to run all unittests first.
The `!defined` check is fine, if that is the result when `_getConfig` fails. Otherwise,

```perl
if (!$cfg) {
```
is the same but it'll swallow more error codes.