mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
parse session request and fix mock for tests
This commit is contained in:
parent
7b8d8d52bc
commit
146d6e8b0c
2 changed files with 9 additions and 6 deletions
|
@ -2,6 +2,9 @@ module Fog
|
|||
module Dynect
|
||||
class DNS
|
||||
class Real
|
||||
|
||||
require 'fog/dns/parsers/dynect/session'
|
||||
|
||||
def session
|
||||
builder = Builder::XmlMarkup.new
|
||||
xml = builder.parameters do |root|
|
||||
|
@ -11,6 +14,7 @@ module Fog
|
|||
end
|
||||
|
||||
request(
|
||||
:parser => Fog::Parsers::Dynect::DNS::Session.new,
|
||||
:expects => 200,
|
||||
:method => "POST",
|
||||
:path => "/REST/Session/",
|
||||
|
@ -25,6 +29,8 @@ module Fog
|
|||
response = Excon::Response.new
|
||||
response.status = 200
|
||||
response.body = {
|
||||
'API-Version' => '2.3.1',
|
||||
'API-Token' => 'thetoken=='
|
||||
}
|
||||
response
|
||||
end
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
Shindo.tests('Dynect::dns | DNS requests', ['dynect', 'dns']) do
|
||||
tests( 'success') do
|
||||
test ('start api session') do
|
||||
|
||||
response = Dynect[:dns].session
|
||||
if response.status == 200
|
||||
@auth_token = response.body['token']
|
||||
end
|
||||
|
||||
response.status == 200
|
||||
returns(true) { response.body['API-Token'] =~ /.+=$/ && true }
|
||||
returns(true) { response.body['API-Version'] == "2.3.1" }
|
||||
returns(true) { response.status == 200 }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue