File: client_request.rb

package info (click to toggle)
puppet 2.6.2-5%2Bsqueeze9
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 13,728 kB
  • ctags: 8,726
  • sloc: ruby: 110,196; sh: 934; lisp: 263; xml: 122; sql: 103; makefile: 90; python: 84
file content (38 lines) | stat: -rwxr-xr-x 1,003 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../lib/puppettest'

require 'puppettest'

require 'puppet/network/client_request'

class TestClientRequest < Test::Unit::TestCase
  include PuppetTest

  def test_initialize
    req = nil
    assert_nothing_raised do
      req = Puppet::Network::ClientRequest.new("name", "ip", false)
    end

    assert_equal("name", req.name, "host name was not set correctly")
    assert_equal("ip", req.ip, "host ip was not set correctly")
    assert_equal(false, req.authenticated, "host auth was not set correctly")
    assert(! req.authenticated, "host was incorrectly considered authenticated")

    req.authenticated = true
    assert(req.authenticated, "host was not considered authenticated")

    assert_raise(ArgumentError) do
      req.call
    end

    req.handler = "yay"
    req.method = "foo"
    assert_equal("yay.foo", req.call, "call was not built correctly")

    assert_equal("name(ip)", req.to_s, "request string not correct")
  end
end