Permalink
Browse files

Added tests for new Widget

  • Loading branch information...
gregjurman committed Feb 25, 2012
1 parent 27e81d8 commit 1127adc46a8ff79261eae481fee3baff1bb2ea1d
Showing with 14 additions and 4 deletions.
  1. +2 −2 tests/test_exceptions.py
  2. +1 −1 tests/test_js.py
  3. +11 −1 tests/test_widget.py
View
@@ -23,15 +23,15 @@ def setup():
twc.core.request_local()['middleware'] = twc.make_middleware()
def test_exception_nodata_url():
- w = tw2.dyntext.DynamicTextWidget(id='foobar')
+ w = tw2.dyntext.PollingDynamicTextWidget(id='foobar')
try:
w.display()
assert(False)
except ValueError as e:
assert(str(e) == 'DynamicTextWidget data_url parameter must be set')
def test_exception_bad_data_url():
- w = tw2.dyntext.DynamicTextWidget(id='foobar', data_url=dict())
+ w = tw2.dyntext.PollingDynamicTextWidget(id='foobar', data_url=dict())
try:
w.display()
assert(False)
View
@@ -23,7 +23,7 @@ def setup():
twc.core.request_local()['middleware'] = twc.make_middleware()
def test_js_call():
- w = tw2.dyntext.DynamicTextWidget(id='foobar', data_url="/herp/derp")
+ w = tw2.dyntext.PollingDynamicTextWidget(id='foobar', data_url="/herp/derp")
w.display()
js_calls = filter(lambda x: "JSFuncCall" in str(x), w.resources)
View
@@ -3,9 +3,19 @@
class TestDemoWidget(WidgetTest):
# place your widget at the TestWidget attribute
- widget = tw2.dyntext.DynamicTextWidget
+ widget = tw2.dyntext.PollingDynamicTextWidget
# Initilization args. go here
attrs = {'id' : 'affected_count'}
params = {'data_url' : '/stats/affected_count'}
expected = """<span id="affected_count"></span>"""
+
+
+class TestDemoWidget(WidgetTest):
+ # place your widget at the TestWidget attribute
+ widget = tw2.dyntext.DynamicTextWidget
+
+ # Initilization args. go here
+ attrs = {'id' : 'affected_count'}
+ params = {'initial_text' : 'test'}
+ expected = """<span id="affected_count">test</span>"""

0 comments on commit 1127adc

Please sign in to comment.