Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding much more test coverage for calendar_resource.client.

git-svn-id: http://gdata-python-client.googlecode.com/svn/trunk@971 7ed92db3-4423-0410-a5bc-5f2579731264
  • Loading branch information...
commit ed48420d9fd026fc35acb32c55634dba9fb6fcab 1 parent 430ff6c
vf@google.com authored
Showing with 41 additions and 2 deletions.
  1. +41 −2 tests/gdata_tests/calendar_resource/live_client_test.py
View
43 tests/gdata_tests/calendar_resource/live_client_test.py
@@ -36,7 +36,8 @@
class CalendarResourceClientTest(unittest.TestCase):
def setUp(self):
- self.client = None
+ self.client = gdata.calendar_resource.client.CalendarResourceClient(
+ domain='example.com')
if conf.options.get_value('runlive') == 'true':
self.client = gdata.calendar_resource.client.CalendarResourceClient(
domain=conf.options.get_value('appsdomain'))
@@ -48,7 +49,35 @@ def setUp(self):
def tearDown(self):
conf.close_client(self.client)
- def testCreateUpdateDelete(self):
+ def testClientConfiguration(self):
+ self.assertEqual('apps-apis.google.com', self.client.host)
+ self.assertEqual('2.0', self.client.api_version)
+ self.assertEqual('apps', self.client.auth_service)
+ self.assertEqual(
+ ('http://www.google.com/a/feeds/',
+ 'https://www.google.com/a/feeds/',
+ 'http://apps-apis.google.com/a/feeds/',
+ 'https://apps-apis.google.com/a/feeds/'), self.client.auth_scopes)
+ if conf.options.get_value('runlive') == 'true':
+ self.assertEqual(self.client.domain, conf.options.get_value('appsdomain'))
+ else:
+ self.assertEqual(self.client.domain, 'example.com')
+
+ def testMakeResourceFeedUri(self):
+ self.assertEqual('/a/feeds/calendar/resource/2.0/%s/' % self.client.domain,
+ self.client.MakeResourceFeedUri())
+ self.assertEqual('/a/feeds/calendar/resource/2.0/%s/CR-NYC-14-12-BR'
+ % self.client.domain,
+ self.client.MakeResourceFeedUri(resource_id='CR-NYC-14-12-BR'))
+ self.assertEqual('/a/feeds/calendar/resource/2.0/%s/?test=1'
+ % self.client.domain,
+ self.client.MakeResourceFeedUri(params={'test': 1}))
+ self.assertEqual('/a/feeds/calendar/resource/2.0/%s/CR-NYC-14-12-BR?test=1'
+ % self.client.domain,
+ self.client.MakeResourceFeedUri(resource_id='CR-NYC-14-12-BR',
+ params={'test': 1}))
+
+ def testCreateRetrieveUpdateDelete(self):
if not conf.options.get_value('runlive') == 'true':
return
@@ -69,6 +98,16 @@ def testCreateUpdateDelete(self):
'Boardroom'))
self.assertEqual(new_entry.resource_type, 'CR')
+ fetched_entry = self.client.get_resource(resource_id='CR-NYC-14-12-BR')
+ self.assert_(isinstance(fetched_entry,
+ gdata.calendar_resource.data.CalendarResourceEntry))
+ self.assertEqual(fetched_entry.resource_id, 'CR-NYC-14-12-BR')
+ self.assertEqual(fetched_entry.resource_common_name, 'Boardroom')
+ self.assertEqual(fetched_entry.resource_description,
+ ('This conference room is in New York City, building 14, floor 12, '
+ 'Boardroom'))
+ self.assertEqual(fetched_entry.resource_type, 'CR')
+
new_entry.resource_id = 'CR-MTV-14-12-BR'
new_entry.resource_common_name = 'Executive Boardroom'
new_entry.resource_description = 'This conference room is in Mountain View'
Please sign in to comment.
Something went wrong with that request. Please try again.