summaryrefslogtreecommitdiffstats
path: root/funcweb
diff options
context:
space:
mode:
authormakkalot <makkalot@gmail.com>2008-06-29 12:11:14 +0300
committermakkalot <makkalot@gmail.com>2008-06-29 12:11:14 +0300
commit3c4803b1aa6045a1667f656968004d9ae1a1409b (patch)
treec26d3bb4b42c4ecaacb7d15564afa3a81e21df55 /funcweb
parent9f3e499a4c89be848b2b6b58c241b8ab4d50b94d (diff)
downloadfunc-3c4803b1aa6045a1667f656968004d9ae1a1409b.tar.gz
func-3c4803b1aa6045a1667f656968004d9ae1a1409b.tar.xz
func-3c4803b1aa6045a1667f656968004d9ae1a1409b.zip
adding tests for pretty_label util method
Diffstat (limited to 'funcweb')
-rw-r--r--funcweb/funcweb/tests/test_widget_automation.py27
1 files changed, 23 insertions, 4 deletions
diff --git a/funcweb/funcweb/tests/test_widget_automation.py b/funcweb/funcweb/tests/test_widget_automation.py
index d02de93..51e8f63 100644
--- a/funcweb/funcweb/tests/test_widget_automation.py
+++ b/funcweb/funcweb/tests/test_widget_automation.py
@@ -2,8 +2,8 @@ import unittest
import turbogears
from turbogears import testutil
-from funcweb.widget_automation import WidgetListFactory,RemoteFormAutomation,RemoteFormFactory
-from funcweb.widget_validation import WidgetSchemaFactory
+from funcweb.widget_automation import *
+from funcweb.widget_validation import *
class TestWidgetListFactory(unittest.TestCase):
@@ -58,11 +58,14 @@ class TestWidgetListFactory(unittest.TestCase):
def test_remote_form_factory(self):
from turbogears.view import load_engines
load_engines()
-
+
+ schema_factory = WidgetSchemaFactory(self.get_test_default_args())
+ schema_validator=schema_factory.get_ready_schema()
+
# WidgetsList object
widget_list_object = self.widget_factory.get_widgetlist_object()
#print widget_list_object
- remote_form = RemoteFormFactory(widget_list_object).get_remote_form()
+ remote_form = RemoteFormFactory(widget_list_object,schema_validator).get_remote_form()
#it is a key,value dict
widget_list=self.widget_factory.get_widgetlist()
@@ -75,6 +78,22 @@ class TestWidgetListFactory(unittest.TestCase):
#print remote_form.render()
+
+ def test_pretty_label(self):
+ """
+ Testing the label converter util method
+ """
+ test_strings = ('service_name','some__other','cool-arg','somenormal','someweir*1*2*3*3')
+ #print pretty_label(test_strings[0])
+ assert pretty_label(test_strings[0]) == 'Service Name'
+ #print pretty_label(test_strings[1])
+ assert pretty_label(test_strings[1]) == 'Some Other'
+ #print pretty_label(test_strings[2])
+ assert pretty_label(test_strings[2]) == 'Cool Arg'
+ #print pretty_label(test_strings[3])
+ assert pretty_label(test_strings[3]) == 'Somenormal'
+ #print pretty_label(test_strings[4])
+ assert pretty_label(test_strings[4]) == 'Someweir*1*2*3*3'
def get_test_default_args(self):
return {