Sha256: 629663c6d9b79f2c46d7482864b266ef583051c8c82d2f31e24ebae7fe3eb636

Contents?: true

Size: 947 Bytes

Versions: 4

Compression:

Stored size: 947 Bytes

Contents

#!/usr/bin/env ruby

$:.unshift("../../lib") if __FILE__ =~ /\.rb$/

require 'puppettest'
require 'puppet/network/client/resource'

class TestDipperClient < Test::Unit::TestCase
    include PuppetTest::ServerTest

    def setup
        super
        @dipper = Puppet::Network::Client.dipper.new(:Path => tempfile)
    end

    # Make sure we can create a new file with 'restore'.
    def test_restore_to_new_file
        file = tempfile
        text = "asdf;lkajseofiqwekj"
        File.open(file, "w") { |f| f.puts text }
        md5 = nil
        assert_nothing_raised("Could not send file") do
            md5 = @dipper.backup(file)
        end

        newfile = tempfile
        assert_nothing_raised("could not restore to new path") do
            @dipper.restore(newfile, md5)
        end

        assert_equal(File.read(file), File.read(newfile), "did not restore correctly")
    end
end

# $Id: dipper.rb 2348 2007-03-24 21:16:20Z luke $

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
puppet-0.22.4 test/network/client/dipper.rb
puppet-0.23.0 test/network/client/dipper.rb
puppet-0.23.1 test/network/client/dipper.rb
puppet-0.23.2 test/network/client/dipper.rb