diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-11-08 05:22:24 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-11-08 05:22:24 +0000 |
| commit | 744ded30a02883dd8ce5fbf2b847f10acb226d6e (patch) | |
| tree | d962b7b21f3a5d20dafd8e7f862c23a2449c2c9b /test/lib | |
| parent | dc4d98091a5566be289830839f1d6eb39367b42c (diff) | |
| download | puppet-744ded30a02883dd8ce5fbf2b847f10acb226d6e.tar.gz puppet-744ded30a02883dd8ce5fbf2b847f10acb226d6e.tar.xz puppet-744ded30a02883dd8ce5fbf2b847f10acb226d6e.zip | |
Merging the code over from the oscar branch. I will now be doing all development in the trunk again, except for larger changes, which will still get their own branch. This is a merge of the changes from revision 1826 to revision 1834.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1835 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/lib')
| -rwxr-xr-x | test/lib/puppettest.rb | 23 | ||||
| -rw-r--r-- | test/lib/puppettest/certificates.rb | 61 | ||||
| -rw-r--r-- | test/lib/puppettest/parsertesting.rb | 2 |
3 files changed, 74 insertions, 12 deletions
diff --git a/test/lib/puppettest.rb b/test/lib/puppettest.rb index 07e3e084e..05d59a3a7 100755 --- a/test/lib/puppettest.rb +++ b/test/lib/puppettest.rb @@ -109,23 +109,16 @@ module PuppetTest Puppet::Log.close Puppet::Log.newdestination tempfile() Puppet[:httplog] = tempfile() - else + else + if textmate? + Puppet[:color] = false + end Puppet::Log.newdestination :console Puppet::Log.level = :debug #$VERBOSE = 1 Puppet.info @method_name Puppet[:trace] = true end - #if $0 =~ /.+\.rb/ or Puppet[:debug] - # Puppet::Log.newdestination :console - # Puppet::Log.level = :debug - # #$VERBOSE = 1 - # Puppet.info @method_name - #else - # Puppet::Log.close - # Puppet::Log.newdestination tempfile() - # Puppet[:httplog] = tempfile() - #end Puppet[:ignoreschedules] = true end @@ -142,6 +135,14 @@ module PuppetTest @@tmpfiles << f return f end + + def textmate? + if ENV["TM_FILENAME"] + return true + else + return false + end + end def tstdir dir = tempfile() diff --git a/test/lib/puppettest/certificates.rb b/test/lib/puppettest/certificates.rb new file mode 100644 index 000000000..ff19b95b3 --- /dev/null +++ b/test/lib/puppettest/certificates.rb @@ -0,0 +1,61 @@ +# Certificate-related helper methods. + +require 'puppettest' + +module PuppetTest::Certificates + include PuppetTest + + def mkPassFile() + keyfile = File.join(@dir, "tmpkeyfile") + @@tmpfiles << keyfile + unless FileTest.exists?(@dir) + system("mkdir -p %s" % @dir) + end + File.open(keyfile, "w", 0600) { |f| + f.print "as;dklj23rlkjzdflij23wr" + } + + return keyfile + end + + def mkCA + ca = nil + assert_nothing_raised { + ca = Puppet::SSLCertificates::CA.new() + } + + return ca + end + + def mkStore(ca) + store = OpenSSL::X509::Store.new + store.purpose = OpenSSL::X509::PURPOSE_SSL_CLIENT + store.flags = OpenSSL::X509::V_FLAG_CRL_CHECK + store.add_cert(ca.cert) + store.add_crl(ca.crl) + store + end + + def mkcert(hostname) + cert = nil + assert_nothing_raised { + cert = Puppet::SSLCertificates::Certificate.new(:name => hostname) + cert.mkcsr + } + + return cert + end + + def mksignedcert(ca = nil, hostname = nil) + ca ||= mkCA() + hostname ||= "ttltest.example.com" + + cert = nil + assert_nothing_raised { + cert, cacert = ca.sign(mkcert(hostname).mkcsr) + } + return cert + end +end + +# $Id$ diff --git a/test/lib/puppettest/parsertesting.rb b/test/lib/puppettest/parsertesting.rb index 1a6b5b12a..c7d4ec961 100644 --- a/test/lib/puppettest/parsertesting.rb +++ b/test/lib/puppettest/parsertesting.rb @@ -12,7 +12,7 @@ module PuppetTest::ParserTesting end def mkinterp(args = {}) - args[:Code] ||= "" + args[:Code] ||= "" unless args.include?(:Manifest) args[:Local] ||= true Puppet::Parser::Interpreter.new(args) end |
