aboutsummaryrefslogtreecommitdiffstats
path: root/tests/utilities_tests.py
diff options
context:
space:
mode:
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):