Removes todo from tests

Removes todo from tests in test_upload.py because these tests
should pass once this patch is finished.
Adds edge case to _distribute_homeless_shares

Adds exception to _distribute_homeless_shares that caused
tests to hang indefinitely.
Refactors _get_next_allocation

Refactors _get_next_allocation so that peer_selector.get_tasks()
is only called once instead of during every allocation since
the operation is relatively expensive. Write servers are queried
for existing shares after the readonly servers, and then tasks
are calculated.