separates the download_url_to_tempfileobj function into two parts

Splits the real download procedure from the download_url_to_tempfileobj and put it into a new function. this makes the download_url_to_tempfileobj clearer and more modular.


Test of download.py:
test_download_url_to_tempfileobj (__main__.TestDownload) ... 
	Server process started.
	Server process id: 2779
	Serving on port: 35991
	Server process 2779 terminated.
ok

----------------------------------------------------------------------
Ran 1 test in 0.115s

OK


Test of updater.py:
The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role1
The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role2
test__init__exceptions (__main__.TestUpdater_init_) ... The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role1
The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role2
ok
test_1__load_metadata_from_file (__main__.TestUpdater) ... ok
test_1__rebuild_key_and_role_db (__main__.TestUpdater) ... ok
test_1__update_fileinfo (__main__.TestUpdater) ... ok
test_2__delete_metadata (__main__.TestUpdater) ... ok
test_2__ensure_all_targets_allowed (__main__.TestUpdater) ... ok
test_2__ensure_not_expired (__main__.TestUpdater) ... ok
test_2__fileinfo_has_changed (__main__.TestUpdater) ... ok
test_2__import_delegations (__main__.TestUpdater) ... ok
test_2__move_current_to_previous (__main__.TestUpdater) ... ok
test_3__targets_of_role (__main__.TestUpdater) ... ok
test_3__update_metadata (__main__.TestUpdater) ... The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role1
The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role2
The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role1
The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role2
The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role1
The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role2
ok
test_3__update_metadata_if_changed (__main__.TestUpdater) ... The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role1
The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role2
The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role1
The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role2
The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role1
The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role2
ok
test_4__refresh_targets_metadata (__main__.TestUpdater) ... The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role1
The keyid of the delegated role must be loaded.
There are 2 target paths for delegated_role2
The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role1
The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role2
ok
test_4_refresh (__main__.TestUpdater) ... The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role1
The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role2
The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role1
The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role2
ok
test_5_all_targets (__main__.TestUpdater) ... ok
test_5_targets_of_role (__main__.TestUpdater) ... ok
test_6_download_target (__main__.TestUpdater) ... ok
test_6_target (__main__.TestUpdater) ... ok
test_7_updated_targets (__main__.TestUpdater) ... The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role1
The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role2
ok
test_8_remove_obsolete_targets (__main__.TestUpdater) ... The keyid of the delegated role must be loaded.
There are 1 target paths for delegated_role1
The keyid of the delegated role must be loaded.
There are 0 target paths for delegated_role2
ok

----------------------------------------------------------------------
Ran 21 tests in 1.037s

OK