fix typo in detach_subnets()
Add unit test for detach_subnets()
Merge pull request #1760 from martinthegeek/develop

fix typo in detach_subnets(). Fixes #1760.