diff test/test_util.py @ 439:8e0c81870e5e treepkg-status

cleanup modules fix test_info testcases added testcases for remove_trailingslashes and expand_filename
author Bjoern Ricks <bricks@intevation.de>
date Fri, 06 Aug 2010 11:06:08 +0000
parents bfd1c6a155fa
children 454967511f5c
line wrap: on
line diff
--- a/test/test_util.py	Thu Aug 05 16:21:47 2010 +0000
+++ b/test/test_util.py	Fri Aug 06 11:06:08 2010 +0000
@@ -12,7 +12,9 @@
 
 from filesupport import FileTestMixin
 
-from treepkg.util import replace_in_file, listdir_abs, md5sum
+from treepkg.util import replace_in_file, listdir_abs, md5sum, \
+                         remove_trailing_slashes, expand_filename
+
 
 
 class TestReplaceInFile(unittest.TestCase, FileTestMixin):
@@ -82,3 +84,21 @@
     def test_md5sum(self):
         sum = md5sum(self.testfile)
         self.assertEquals("a12511153555c1f0f0a1eda200733a3f", sum)
+
+class TestRemoveTrailingSlashes(unittest.TestCase):
+
+    def test_remove_trailing_slashes(self):
+        dir_w_slash    = "/tmp/dir/"
+        dir_wo_slash = "/tmp/dir"
+
+        self.assertEquals(dir_wo_slash, remove_trailing_slashes(dir_w_slash))
+        self.assertEquals(dir_wo_slash, remove_trailing_slashes(dir_wo_slash))
+
+class TestExpandFilename(unittest.TestCase):
+
+    def test_expand_filenam(self):
+        os.environ['MY_TEST_VAR'] = "def"
+        path = "/abc/${MY_TEST_VAR}/"
+
+        self.assertEquals("/abc/def/", expand_filename(path))
+
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)