Commits

Ralph Bean committed 62bc51d

100% test coverage

  • Participants
  • Parent commits bad9c53

Comments (0)

Files changed (2)

     url='http://github.com/ralphbean/tw2.tipster',
     install_requires=[
         "tw2.jqplugins.ui",
-        ## Add other requirements here
-        # "Genshi",
+        "mako"
         ],
     packages=find_packages(exclude=['ez_setup', 'tests']),
     namespace_packages = ['tw2'],
     zip_safe=False,
     include_package_data=True,
+    tests_require = [
+        'nose',
+        'BeautifulSoup',
+        'Genshi',
+        'mako',
+        # formencode isn't actually needed, but is just here to patch up
+        # tw2.forms
+        'formencode',
+    ],
     test_suite = 'nose.collector',
     entry_points="""
         [tw2.widgets]

tests/test_widgets.py

+from tw2.core.testbase import assert_in_xml, assert_eq_xml, WidgetTest
+
+import tw2.tipster
+import tw2.tipster.samples
+
+class TestMenuWidget(WidgetTest):
+    widget = tw2.tipster.TipsterWidget
+    attrs = { 'id' : 'foo' }
+    params = {
+        'tips' : [
+            'Test all your code.',
+            'No, really.',
+        ]
+    }
+    expected = """
+<div class="ui-widget">
+<div id="foo" class="ui-state-highlight ui-corner-all"></div>
+<script type="text/javascript">
+setupTipster('foo', ["Test all your code.", "No, really."], '');
+</script>
+</div>
+"""
+
+class TestDemoWidget(WidgetTest):
+    widget = tw2.tipster.samples.DemoTipsterWidget
+    attrs = { 'id' : 'foo' }
+    params = {}
+    expected = """
+<div class="ui-widget">
+<div id="foo" class="ui-state-highlight ui-corner-all"></div>
+<script type="text/javascript">
+setupTipster('foo', ["Here's a tip:  Wash your face!", "No really, wash your face!", "You know... if you specify a stopTipsURL you can stop tips.", "blah"], 'this-url-doesnot-exist____you-are-responsible-for-backend');
+</script>
+</div>
+"""