1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[vcloud_director] Add tests for task model.

This commit is contained in:
Nick Osborn 2013-10-01 03:25:52 +01:00
parent ad60e4f547
commit 73f5cd76f2
2 changed files with 36 additions and 6 deletions

View file

@ -8,23 +8,24 @@ module Fog
identity :id
attribute :name
attribute :type
attribute :href
attribute :status
attribute :type
attribute :name
attribute :end_time, :aliases => :endTime, :type => :time
attribute :expiry_time, :aliases => :expiryTime, :type => :time
attribute :operation
attribute :operation_name, :aliases => :operationName
attribute :expiry_time, :aliases => :expiryTime, :type => :time
attribute :end_time, :aliases => :endTime, :type => :time
attribute :start_time, :aliases => :startTime, :type => :time
attribute :status
attribute :description, :aliases => :Description
attribute :error, :aliases => :Error
attribute :result, :aliases => :Result
attribute :progress, :aliases => :Progress, :type => :integer
# Since 5.1
attribute :operation_key, :aliases => :operationKey
attribute :cancel_requested, :aliases => :cancelRequested, :type => :boolean
attribute :service_namespace, :aliases => :serviceNamespace
attribute :details, :aliases => :Details
def ready?
status == 'success'

View file

@ -0,0 +1,29 @@
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
VCR.use_cassette(File.basename(__FILE__)) do
Shindo.tests('Compute::VcloudDirector | tasks', ['vclouddirector']) do
pending if Fog.mocking?
tasks = organization.tasks
pending if tasks.empty?
task = tasks.first
tests('Compute::VcloudDirector | task') do
tests('#href').returns(String) { task.href.class }
tests('#type').returns('application/vnd.vmware.vcloud.task+xml') { task.type }
tests('#id').returns(String) { task.id.class }
tests('#name').returns(String) { task.name.class }
tests('#status').returns(String) { task.status.class }
tests('#end_time').returns(Fog::Time) { task.end_time.class }
tests('#expiry_time').returns(Fog::Time) { task.expiry_time.class }
tests('#operation').returns(String) { task.operation.class }
tests('#operation_name').returns(String) { task.operation_name.class }
end
tests('Compute::VcloudDirector | task', ['get']) do
tests('#get_by_name').returns(task.name) { tasks.get_by_name(task.name).name }
tests('#get').returns(task.id) { tasks.get(task.id).id }
end
end
end