changeset 608:27dc049120b1 pytest2

test for shorten_item_name() added in themes/test_navi_bar
author pkumar <contactprashantat@gmail.com>
date Fri, 01 Jul 2011 23:24:54 +0530
parents e9c80fcc5ae5
children ed593361022e
files MoinMoin/themes/_tests/test_navi_bar.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/themes/_tests/test_navi_bar.py	Fri Jul 01 18:02:08 2011 +0530
+++ b/MoinMoin/themes/_tests/test_navi_bar.py	Fri Jul 01 23:24:54 2011 +0530
@@ -11,6 +11,7 @@
 
 from MoinMoin._tests import wikiconfig
 from MoinMoin.themes import ThemeSupport
+from MoinMoin import themes
 
 class TestNaviBar(object):
     class Config(wikiconfig.Config):
@@ -46,5 +47,12 @@
         assert test_item_name_2 == 'some/place'
         assert test_segment_name_3 == 'test_item'
         assert test_item_name_3 == 'some/place/test_item'
-        
 
+def test_shorten_item_name():
+    test_result1 = themes.shorten_item_name(u'MoinMoin/some/value', 0) 
+    assert test_result1 == u'valu...lue'    
+    test_result2 = themes.shorten_item_name(u'MoinMoin/some/value', 5) 
+    assert test_result2 == 'value'    
+    test_result3 = themes.shorten_item_name(u'MoinMoin/some/value') 
+    assert test_result3 == u'MoinMoin/some/value'    
+