Improved svc.SetCharm and unit.SetCharmURL, added more tests

This is an attempt to fix issues like http://pad.lv/1301996

Backported #1113 to 1.21, no other changes.