diff options
author | Markus Roberts <Markus@reality.com> | 2010-07-09 18:12:17 -0700 |
---|---|---|
committer | Markus Roberts <Markus@reality.com> | 2010-07-09 18:12:17 -0700 |
commit | 3180b9d9b2c844dade1d361326600f7001ec66dd (patch) | |
tree | 98fe7c5ac7eb942aac9c39f019a17b0b3f5a57f4 /test/network/authconfig.rb | |
parent | 543225970225de5697734bfaf0a6eee996802c04 (diff) | |
download | puppet-3180b9d9b2c844dade1d361326600f7001ec66dd.tar.gz puppet-3180b9d9b2c844dade1d361326600f7001ec66dd.tar.xz puppet-3180b9d9b2c844dade1d361326600f7001ec66dd.zip |
Code smell: Two space indentation
Replaced 106806 occurances of ^( +)(.*$) with
The ruby community almost universally (i.e. everyone but Luke, Markus, and the other eleven people
who learned ruby in the 1900s) uses two-space indentation.
3 Examples:
The code:
end
# Tell getopt which arguments are valid
def test_get_getopt_args
element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new
assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args")
becomes:
end
# Tell getopt which arguments are valid
def test_get_getopt_args
element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new
assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args")
The code:
assert_equal(str, val)
assert_instance_of(Float, result)
end
# Now test it with a passed object
becomes:
assert_equal(str, val)
assert_instance_of(Float, result)
end
# Now test it with a passed object
The code:
end
assert_nothing_raised do
klass[:Yay] = "boo"
klass["Cool"] = :yayness
end
becomes:
end
assert_nothing_raised do
klass[:Yay] = "boo"
klass["Cool"] = :yayness
end
Diffstat (limited to 'test/network/authconfig.rb')
-rwxr-xr-x | test/network/authconfig.rb | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/test/network/authconfig.rb b/test/network/authconfig.rb index 18445bc8e..f53238d0b 100755 --- a/test/network/authconfig.rb +++ b/test/network/authconfig.rb @@ -7,63 +7,63 @@ require 'puppettest' require 'puppet/network/authconfig' class TestAuthConfig < Test::Unit::TestCase - include PuppetTest + include PuppetTest - def request(call, client, ip) - r = Puppet::Network::ClientRequest.new(client, ip, false) - h, m = call.split(".") - r.handler = h - r.method = m - r - end + def request(call, client, ip) + r = Puppet::Network::ClientRequest.new(client, ip, false) + h, m = call.split(".") + r.handler = h + r.method = m + r + end - def test_parsingconfigfile - file = tempfile - assert(Puppet[:authconfig], "No config path") + def test_parsingconfigfile + file = tempfile + assert(Puppet[:authconfig], "No config path") - Puppet[:authconfig] = file + Puppet[:authconfig] = file - File.open(file, "w") { |f| - f.puts "[pelementserver.describe] - allow *.madstop.com - deny 10.10.1.1 + File.open(file, "w") { |f| + f.puts "[pelementserver.describe] + allow *.madstop.com + deny 10.10.1.1 [fileserver] - allow *.madstop.com - deny 10.10.1.1 + allow *.madstop.com + deny 10.10.1.1 [fileserver.list] - allow 10.10.1.1 + allow 10.10.1.1 " - } - - config = nil - assert_nothing_raised { - config = Puppet::Network::AuthConfig.new(file) - } - - assert_nothing_raised { - assert(config.allowed?(request("pelementserver.describe", "culain.madstop.com", "1.1.1.1")), "Did not allow host") - assert(! config.allowed?(request("pelementserver.describe", "culain.madstop.com", "10.10.1.1")), "Allowed host") - assert(config.allowed?(request("fileserver.yay", "culain.madstop.com", "10.1.1.1")), "Did not allow host to fs") - assert(! config.allowed?(request("fileserver.yay", "culain.madstop.com", "10.10.1.1")), "Allowed host to fs") - assert(config.allowed?(request("fileserver.list", "culain.madstop.com", "10.10.1.1")), "Did not allow host to fs.list") - } - end - - def test_singleton - auth = nil - assert_nothing_raised { auth = Puppet::Network::AuthConfig.main } - assert(auth, "did not get main authconfig") - - other = nil - assert_nothing_raised { other = Puppet::Network::AuthConfig.main } - - assert_equal( - auth.object_id, other.object_id, + } + + config = nil + assert_nothing_raised { + config = Puppet::Network::AuthConfig.new(file) + } + + assert_nothing_raised { + assert(config.allowed?(request("pelementserver.describe", "culain.madstop.com", "1.1.1.1")), "Did not allow host") + assert(! config.allowed?(request("pelementserver.describe", "culain.madstop.com", "10.10.1.1")), "Allowed host") + assert(config.allowed?(request("fileserver.yay", "culain.madstop.com", "10.1.1.1")), "Did not allow host to fs") + assert(! config.allowed?(request("fileserver.yay", "culain.madstop.com", "10.10.1.1")), "Allowed host to fs") + assert(config.allowed?(request("fileserver.list", "culain.madstop.com", "10.10.1.1")), "Did not allow host to fs.list") + } + end + + def test_singleton + auth = nil + assert_nothing_raised { auth = Puppet::Network::AuthConfig.main } + assert(auth, "did not get main authconfig") + + other = nil + assert_nothing_raised { other = Puppet::Network::AuthConfig.main } + + assert_equal( + auth.object_id, other.object_id, - "did not get same authconfig from class") - end + "did not get same authconfig from class") + end end |