Fix sync test when localhost on port 80 is binded
Fix sync test when localhost on port 80 is binded

- When localhost:80 was binding the tests was trying to connect into it.
- To test you can simply run sudo python -m SimpleHTTPServer 80 which
  should show :

  1.0.0.127.in-addr.arpa - - [06/Aug/2013 14:10:42] code 501, message Unsupported method ('DELETE')
  1.0.0.127.in-addr.arpa - - [06/Aug/2013 14:10:42] "DELETE /a/c/o HTTP/1.1" 501 -

  (the test was passing since 501 would raise ClientException).
  mock delete_object in the fourth test to fix that
- Refactor the code to use mock.patch as well.

Closes-Bug: 1208802
Change-Id: I5ddd4ac3a97879f51cf5883fcfc0fe0f0adaeff6

bouncestorage/swift,zackmdavis/swift,dpgoetz/swift,clayg/swift,takeshineshiro/swift,redhat-openstack/swift,gold3bear/swift,matthewoliver/swift,larsbutler/swift,clayg/swift,redhat-openstack/swift,citrix-openstack-build/swift,sarvesh-ranjan/swift,tipabu/swift,daasbank/swift,matthewoliver/swift,psachin/swift,smerritt/swift,scality/ScalitySproxydSwift,Akanoa/swift,xiaoguoai/ec-dev-swift,smerritt/swift,Seagate/swift,anishnarang/gswift,dencaval/swift,nadeemsyed/swift,tipabu/swift,swiftstack/swift,bradleypj823/swift,citrix-openstack-build/swift,bradleypj823/swift,JioCloud/swift,IPVL/swift-kilo,IPVL/swift-kilo,smerritt/swift,mjzmjz/swift,rackerlabs/swift,nadeemsyed/swift,shibaniahegde/OpenStak_swift,rackerlabs/swift,nadeemsyed/swift,Akanoa/swift,NeCTAR-RC/swift,prashanthpai/swift,xiaoguoai/ec-dev-swift,psachin/swift,hurricanerix/swift,hurricanerix/swift,revoer/keystone-8.0.0,levythu/swift,nadeemsyed/swift,iostackproject/IO-Bandwidth-Differentiation,wenhuizhang/swift,thiagodasilva/swift,hbhdytf/mac2,openstack/swift,bkolli/swift,larsbutler/swift,thiagodasilva/swift,notmyname/swift,hbhdytf/mac,tipabu/swift,hurricanerix/swift,maginatics/swift,shibaniahegde/OpenStak_swift,openstack/swift,swiftstack/swift,smerritt/swift,aerwin3/swift,psachin/swift,notmyname/swift,AfonsoFGarcia/swift,hbhdytf/mac2,NeCTAR-RC/swift,levythu/swift,dpgoetz/swift,matthewoliver/swift,Khushbu27/Tutorial,eatbyte/Swift,citrix-openstack/build-swift,swiftstack/swift,hurricanerix/swift,williamthegrey/swift,redbo/swift,sarvesh-ranjan/swift,maginatics/swift,iostackproject/IO-Bandwidth-Differentiation,revoer/keystone-8.0.0,Khushbu27/Tutorial,takeshineshiro/swift,daasbank/swift,hbhdytf/mac,gold3bear/swift,eatbyte/Swift,psachin/swift,hbhdytf/mac2,mjzmjz/swift,zackmdavis/swift,Seagate/swift,notmyname/swift,openstack/swift,anishnarang/gswift,openstack/swift,williamthegrey/swift,bkolli/swift,aerwin3/swift,mjwtom/swift,citrix-openstack/build-swift,wenhuizhang/swift,Em-Pan/swift,redbo/swift,AfonsoFGarcia/swift,mjwtom/swift,clayg/swift,prashanthpai/swift,bouncestorage/swift,Em-Pan/swift,dencaval/swift,hbhdytf/mac2,clayg/swift,notmyname/swift,matthewoliver/swift,scality/ScalitySproxydSwift,tipabu/swift,JioCloud/swift