Skip to content

Commit d7d72fa

Browse files
author
j.s@google.com
committed
Adding unit test to cover the sample code in calendar gadgets documentation.
1 parent 9b22ea8 commit d7d72fa

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/gdata_tests/calendar_test.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,24 @@ def assertValidWebContentGadget(self, expected_url=None, expected_width=None,
872872
self.assertEquals(expected_pref_value,
873873
web_content_element.gadget_pref[0].value)
874874

875+
def testSampleCode(self):
876+
# From http://code.google.com/apis/calendar/gadgets/event/
877+
wc = gdata.calendar.WebContent()
878+
wc.url = 'http://www.thefreedictionary.com/_/WoD/wod-module.xml'
879+
wc.width = '300'
880+
wc.height = '136'
881+
wc.gadget_pref.append(gdata.calendar.WebContentGadgetPref(name='Days', value='1'))
882+
wc.gadget_pref.append(gdata.calendar.WebContentGadgetPref(name='Format', value='0'))
883+
wcl = gdata.calendar.WebContentLink()
884+
wcl.title = 'Word of the Day'
885+
wcl.href = 'http://www.thefreedictionary.com/favicon.ico'
886+
wcl.type = 'application/x-google-gadgets+xml'
887+
wcl.web_content = wc
888+
self.assertEqual(wcl.web_content.url,
889+
'http://www.thefreedictionary.com/_/WoD/wod-module.xml')
890+
self.assertEqual(wcl.type, 'application/x-google-gadgets+xml')
891+
self.assertEqual(wcl.web_content.height, '136')
892+
875893

876894
class ExtendedPropertyTest(unittest.TestCase):
877895

0 commit comments

Comments
 (0)