mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
793506349d
Used an old example, should have subclassed Minitest::Test
30 lines
808 B
Ruby
30 lines
808 B
Ruby
require "minitest/autorun"
|
|
require "fog"
|
|
|
|
# Note this is going to be part of fog-xml eventually
|
|
class TestFogXMLConnection < Minitest::Test
|
|
def setup
|
|
@connection = Fog::XML::Connection.new("http://localhost")
|
|
end
|
|
|
|
def teardown
|
|
Excon.stubs.clear
|
|
end
|
|
|
|
def test_respond_to_request
|
|
assert_respond_to @connection, :request
|
|
end
|
|
|
|
def test_request_with_parser
|
|
@parser = Fog::ToHashDocument.new
|
|
Excon.stub({}, { :status => 200, :body => "<xml></xml>" })
|
|
response = @connection.request(:parser => @parser, :mock => true)
|
|
assert_equal({ :xml => "" }, response.body)
|
|
end
|
|
|
|
def test_request_without_parser
|
|
Excon.stub({}, { :status => 200, :body => "<xml></xml>" })
|
|
response = @connection.request(:mock => true)
|
|
assert_equal("<xml></xml>", response.body)
|
|
end
|
|
end
|