aboutsummaryrefslogtreecommitdiffstats
path: root/tests/utilities_tests.py
diff options
context:
space:
mode:
authorJesse Jaggars <jjaggars@redhat.com>2012-03-13 17:14:29 -0500
committerJesse Jaggars <jjaggars@redhat.com>2012-03-13 17:14:29 -0500
commit20e9d49b29a63614ee173d7773113aa610252936 (patch)
tree628cc8a35561dffdd4ca43c9a652a82e702ada42 /tests/utilities_tests.py
parent3570f8e00be445000975b256d2a1e6b622dc81c5 (diff)
downloadsos-20e9d49b29a63614ee173d7773113aa610252936.tar.gz
Squashed commit of the following:
commit 1c2cf82a424125decda210a557755e8467bf0b2b Author: Jesse Jaggars <jjaggars@redhat.com> Date: Tue Mar 13 15:20:47 2012 -0500 adding regex sub tests and some docstrings commit d72f2f28b364519710f95a53330821138fc40849 Author: Jesse Jaggars <jjaggars@redhat.com> Date: Tue Mar 13 11:13:06 2012 -0500 adding many tests for plugins
Diffstat (limited to 'tests/utilities_tests.py')
-rw-r--r--tests/utilities_tests.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/utilities_tests.py b/tests/utilities_tests.py
index 7eecc01a..24bc950b 100644
--- a/tests/utilities_tests.py
+++ b/tests/utilities_tests.py
@@ -2,7 +2,7 @@ import os.path
import unittest
from StringIO import StringIO
-from sos.utilities import grep, DirTree, checksum, get_hash_name, is_executable, sosGetCommandOutput, find
+from sos.utilities import grep, DirTree, checksum, get_hash_name, is_executable, sosGetCommandOutput, find, tail
import sos
TEST_DIR = os.path.dirname(__file__)
@@ -28,6 +28,18 @@ class GrepTest(unittest.TestCase):
self.assertEquals(matches, ['import unittest\n'])
+class TailTest(unittest.TestCase):
+
+ def test_tail(self):
+ t = tail("tests/tail_test.txt", 10)
+ self.assertEquals(t, "last line\n")
+
+ def test_tail_too_many(self):
+ t = tail("tests/tail_test.txt", 200)
+ expected = open("tests/tail_test.txt", "r").read()
+ self.assertEquals(t, expected)
+
+
class DirTreeTest(unittest.TestCase):
def test_makes_tree(self):