[#1216] Correct the logic in resource_delete

resource_delete, as it stands, is broken. This fixes the logic and adds tests
for resource_delete. Fixes #1216.
Don't modify the list that's being iterated
Merge pull request #1216 from okfn/1216-fix-resource-delete

resource_delete does not work