def testContributorToAndFromString(self): self.contributor.name = atom.Name(text='J Scud') self.contributor.email = atom.Email(text='nobody@nowhere') self.contributor.uri = atom.Uri(text='http://www.google.com') self.assert_(self.contributor.name.text == 'J Scud') self.assert_(self.contributor.email.text == 'nobody@nowhere') self.assert_(self.contributor.uri.text == 'http://www.google.com') new_contributor = atom.ContributorFromString( self.contributor.ToString()) self.assert_(self.contributor.name.text == new_contributor.name.text) self.assert_(self.contributor.email.text == new_contributor.email.text) self.assert_(self.contributor.uri.text == new_contributor.uri.text)
def testPostEntryWithCommentAndDelete(self): """Test posting a new entry with an extended property, deleting it""" # Get random data for creating event r = random.Random() r.seed() random_event_number = str(r.randint(100000, 1000000)) random_event_title = 'My Random Comments Test Event %s' % ( random_event_number) # Set event data event = gdata.calendar.CalendarEventEntry() event.author.append( atom.Author(name=atom.Name(text='GData Test user'))) event.title = atom.Title(text=random_event_title) event.content = atom.Content(text='Picnic with some lunch') # Insert event self.cal_client.ProgrammaticLogin() new_event = self.cal_client.InsertEvent( event, '/calendar/feeds/default/private/full') # Get comments feed comments_url = new_event.comments.feed_link.href comments_query = gdata.calendar.service.CalendarEventCommentQuery( comments_url) comments_feed = self.cal_client.CalendarQuery(comments_query) # Add comment comments_entry = gdata.calendar.CalendarEventCommentEntry() comments_entry.content = atom.Content(text='Comments content') comments_entry.author.append( atom.Author(name=atom.Name(text='GData Test user'), email=atom.Email(text=username))) new_comments_entry = self.cal_client.InsertEventComment( comments_entry, comments_feed.GetPostLink().href) # Delete the event event_to_delete = self.cal_client.GetCalendarEventEntry( new_event.id.text) self.cal_client.DeleteEvent(event_to_delete.GetEditLink().href)
def setUp(self): self.email = atom.Email()