Small refactors and new test

I started doing https://github.com/bitpay/copay/issues/1113 and I realized changing the whole way settings are handled would be unsafe without a proper wallet import test. This PR adds that test (took me a long time to get it working, unfortunately)

ready for review
All right. Beware of automatic style fixing from your editor!