2012-02-06 06:49:30 -05:00
|
|
|
Fog.mock! if ENV['FOG_MOCK']
|
2012-01-05 18:29:13 -05:00
|
|
|
|
2012-01-19 18:19:03 -05:00
|
|
|
Shindo.tests("Storage[:aws] | directory", [:aws]) do
|
2012-01-05 18:29:13 -05:00
|
|
|
|
|
|
|
directory_attributes = {
|
|
|
|
:key => 'fogdirectorytests'
|
|
|
|
}
|
|
|
|
|
2012-01-19 18:19:03 -05:00
|
|
|
model_tests(Fog::Storage[:aws].directories, directory_attributes, Fog.mocking?) do
|
2012-01-05 18:29:13 -05:00
|
|
|
|
|
|
|
tests("#versioning=") do
|
|
|
|
tests("#versioning=(true)").succeeds do
|
|
|
|
@instance.versioning = true
|
|
|
|
end
|
|
|
|
|
|
|
|
tests("#versioning=(true) sets versioning to 'Enabled'").returns('Enabled') do
|
|
|
|
@instance.versioning = true
|
|
|
|
@instance.connection.get_bucket_versioning(@instance.key).body['VersioningConfiguration']['Status']
|
|
|
|
end
|
|
|
|
|
|
|
|
tests("#versioning=(false)").succeeds do
|
|
|
|
@instance.versioning = false
|
|
|
|
end
|
|
|
|
|
|
|
|
tests("#versioning=(false) sets versioning to 'Suspended'").returns('Suspended') do
|
|
|
|
@instance.versioning = false
|
|
|
|
@instance.connection.get_bucket_versioning(@instance.key).body['VersioningConfiguration']['Status']
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-01-26 10:06:40 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
model_tests(Fog::Storage[:aws].directories, directory_attributes, Fog.mocking?) do
|
|
|
|
|
2012-01-05 18:29:13 -05:00
|
|
|
tests("#versioning?") do
|
|
|
|
tests("#versioning? false if not enabled").returns(false) do
|
|
|
|
@instance.versioning?
|
|
|
|
end
|
|
|
|
|
|
|
|
tests("#versioning? true if enabled").returns(true) do
|
|
|
|
@instance.connection.put_bucket_versioning(@instance.key, 'Enabled')
|
|
|
|
@instance.versioning?
|
|
|
|
end
|
|
|
|
|
|
|
|
tests("#versioning? false if suspended").returns(false) do
|
|
|
|
@instance.connection.put_bucket_versioning(@instance.key, 'Suspended')
|
|
|
|
@instance.versioning?
|
|
|
|
end
|
|
|
|
end
|
2012-01-26 10:06:40 -05:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2012-01-05 18:29:13 -05:00
|
|
|
end
|