tests/rackspace/cdn_tests.rb in fog-maestrodev-1.14.0.20130806165225 vs tests/rackspace/cdn_tests.rb in fog-maestrodev-1.15.0.20130829165835
- old
+ new
@@ -94,9 +94,23 @@
returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-cdn-endpoint\.com/) != nil }
end
end
+ tests('reauthentication') do
+ pending if Fog.mocking?
+
+ tests('should reauth with valid credentials') do
+ @service = Fog::CDN::Rackspace.new :rackspace_region => :ord
+ returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
+ @service.instance_variable_set("@auth_token", "bad-token")
+ returns(true) { [200, 204].include? @service.get_containers.status }
+ end
+ tests('should terminate with incorrect credentials') do
+ raises(Excon::Errors::Unauthorized) { Fog::CDN::Rackspace.new :rackspace_api_key => 'bad_key' }
+ end
+ end
+
pending if Fog.mocking?
def container_meta_attributes
@cdn.head_container(@directory.key).headers
end