Sha256: 0bb1b3ecc6d893eaeacbabf3b0f23772a35ff329b4b311191ca06638c59e67a5

Contents?: true

Size: 1.99 KB

Versions: 44

Compression:

Stored size: 1.99 KB

Contents

Shindo.tests('Fog::Rackspace::Queues | messages_tests', ['rackspace']) do
  service = Fog::Rackspace::Queues.new

  queue_name = 'fog' + Time.now.to_i.to_s
  client_id = service.client_id
  message_id = nil

  service.create_queue(queue_name)

  begin
    tests('success') do
      tests("#list_message(#{client_id}, #{queue_name}, {:echo => true}) => No Content").returns(204) do
        service.list_messages(client_id, queue_name, {:echo => true}).status
      end

      tests("#create_message(#{client_id}, #{queue_name}, '{ :blah => 'blah' }', 300)").succeeds do
        response = service.create_message(client_id, queue_name, { :blah => 'blah' }, 300)
        message_id = response.body['resources'][0].split('/').last
      end

      tests("#list_message(#{client_id}, #{queue_name}, {:echo => true}) => With Content").formats(LIST_MESSAGES_FORMAT) do
        service.list_messages(client_id, queue_name, {:echo => true}).body
      end

      tests("#get_message(#{client_id}, #{queue_name}, #{message_id})").formats(MESSAGE_FORMAT) do
        service.get_message(client_id, queue_name, message_id).body
      end

      tests("#delete_message(#{queue_name}, #{message_id}, { :claim_id => '10' })").raises(Fog::Rackspace::Queues::ServiceError) do
        #API team should be changing this
        pending
        service.delete_message(queue_name, message_id, { :claim_id => '10' })
      end

      tests("#delete_message(#{queue_name}, #{message_id})").succeeds do
        service.delete_message(queue_name, message_id)
      end
    end

     tests('failure') do
       tests("#create_message('') => Invalid Create Critera").raises(Fog::Rackspace::Queues::BadRequest) do
         service.create_message(client_id, queue_name, '', 0)
       end

       tests("#get_message('queue_name', 'nonexistentmessage') => Does not exist").raises(Fog::Rackspace::Queues::NotFound) do
         service.get_message(client_id, queue_name, 'nonexistentmessage')
       end

     end
  ensure
    service.delete_queue(queue_name)
  end

end

Version data entries

44 entries across 42 versions & 7 rubygems

Version Path
fog-rackspace-0.1.6 tests/rackspace/requests/queues/messages_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-rackspace-0.1.5/tests/rackspace/requests/queues/messages_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-rackspace-0.1.5/tests/rackspace/requests/queues/messages_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-rackspace-0.1.5/tests/rackspace/requests/queues/messages_tests.rb
fog-rackspace-0.1.5 tests/rackspace/requests/queues/messages_tests.rb
fog-rackspace-0.1.4 tests/rackspace/requests/queues/messages_tests.rb
fog-rackspace-0.1.3 tests/rackspace/requests/queues/messages_tests.rb
fog-rackspace-0.1.2 tests/rackspace/requests/queues/messages_tests.rb
fog-rackspace-0.1.1 tests/rackspace/requests/queues/messages_tests.rb
fog-rackspace-0.1.0 tests/rackspace/requests/queues/messages_tests.rb
fog-1.37.0 tests/rackspace/requests/queues/messages_tests.rb
fog-1.36.0 tests/rackspace/requests/queues/messages_tests.rb
fog-1.35.0 tests/rackspace/requests/queues/messages_tests.rb
fog-2.0.0.pre.0 tests/rackspace/requests/queues/messages_tests.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/tests/rackspace/requests/queues/messages_tests.rb
fog-1.34.0 tests/rackspace/requests/queues/messages_tests.rb
fog-1.33.0 tests/rackspace/requests/queues/messages_tests.rb
fog-1.32.0 tests/rackspace/requests/queues/messages_tests.rb
fog-1.31.0 tests/rackspace/requests/queues/messages_tests.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/tests/rackspace/requests/queues/messages_tests.rb