comparison test/test_util.py @ 394:bfd1c6a155fa treepkg-status

added md5sum function
author Bjoern Ricks <bricks@intevation.de>
date Fri, 09 Jul 2010 12:42:42 +0000
parents e3ab8aca2b08
children 8e0c81870e5e
comparison
equal deleted inserted replaced
393:5fe26e7f6e2d 394:bfd1c6a155fa
10 import os 10 import os
11 import unittest 11 import unittest
12 12
13 from filesupport import FileTestMixin 13 from filesupport import FileTestMixin
14 14
15 from treepkg.util import replace_in_file, listdir_abs 15 from treepkg.util import replace_in_file, listdir_abs, md5sum
16 16
17 17
18 class TestReplaceInFile(unittest.TestCase, FileTestMixin): 18 class TestReplaceInFile(unittest.TestCase, FileTestMixin):
19 19
20 def runtest(self, orig_contents, expected_contents, pattern, replacement): 20 def runtest(self, orig_contents, expected_contents, pattern, replacement):
70 ("foo.dsc", ""), 70 ("foo.dsc", ""),
71 ("foo.diff.gz", ""),]) 71 ("foo.diff.gz", ""),])
72 self.assertEquals(sorted(listdir_abs(directory, '*.dsc')), 72 self.assertEquals(sorted(listdir_abs(directory, '*.dsc')),
73 [os.path.join(directory, "foo.dsc")]) 73 [os.path.join(directory, "foo.dsc")])
74 74
75 class TestMd5sum(unittest.TestCase, FileTestMixin):
76
77 content = "this is a test content"
78
79 def setUp(self):
80 self.testfile = self.create_temp_file("testmd5.txt", self.content)
81
82 def test_md5sum(self):
83 sum = md5sum(self.testfile)
84 self.assertEquals("a12511153555c1f0f0a1eda200733a3f", sum)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)