Patches for resolving macros and custom variables

This pull request has contains the following:

* Fix several issues where None is returned instead of empty string when unable to resolve macros or custom variables


* Refactor unit tests in a seperate class test_model.TestMacroResolving
* Add significant amount of tests