summaryrefslogtreecommitdiffstats
path: root/test/lib/puppettest/fileparsing.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-10-17 21:53:40 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-10-17 21:53:40 +0000
commitada77773591f5e17ddcdb4af6c20ded3715ecda9 (patch)
tree224c19078469abe60d4212b81bc3d16913d69d62 /test/lib/puppettest/fileparsing.rb
parent95f2fe70bf63791fb691d539281f5cfbfd1fb664 (diff)
downloadpuppet-ada77773591f5e17ddcdb4af6c20ded3715ecda9.tar.gz
puppet-ada77773591f5e17ddcdb4af6c20ded3715ecda9.tar.xz
puppet-ada77773591f5e17ddcdb4af6c20ded3715ecda9.zip
sshkey now uses a provider
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1802 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/lib/puppettest/fileparsing.rb')
-rw-r--r--test/lib/puppettest/fileparsing.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/lib/puppettest/fileparsing.rb b/test/lib/puppettest/fileparsing.rb
new file mode 100644
index 000000000..004a0c3b5
--- /dev/null
+++ b/test/lib/puppettest/fileparsing.rb
@@ -0,0 +1,29 @@
+module PuppetTest::FileParsing
+ # Run an isomorphism test on our parsing process.
+ def fakedataparse(file)
+ @provider.path = file
+ instances = nil
+ assert_nothing_raised {
+ instances = @provider.retrieve
+ }
+
+ text = @provider.fileobj.read
+
+ yield if block_given?
+
+ dest = tempfile()
+ @provider.path = dest
+
+ # Now write it back out
+ assert_nothing_raised {
+ @provider.store(instances)
+ }
+
+ newtext = @provider.fileobj.read
+
+ # Don't worry about difference in whitespace
+ assert_equal(text.gsub(/\s+/, ' '), newtext.gsub(/\s+/, ' '))
+ end
+end
+
+# $Id$