def test_get_events_to_stranger(): print '------------ test_get_events_to_guest ----------' user = myTools.get_user_by_name('Rightpeter') guest = myTools.get_user_by_name('june_fiend') events = calendar_tools.get_events_of_user_to_guest(user, guest, 0) for event in events: event_info = calendar_tools.get_event_by_id(event['id'], guest, 0) print 'title: ', event_info['title'], ' privilege: ', event_info[ 'privilege']
def test_share_a_event(): rel = int(raw_input('Input the rel of guest: \n')) user = myTools.get_user_by_name('Rightpeter') guest = myTools.get_user_by_name('june_fiend') events = calendar_tools.get_events_of_user_to_guest(user, guest, rel) print 'events: ', events for event in events: event_info = calendar_tools.get_event_by_id(event['id'], guest, rel) try: print 'id: ', event_info.id, ' title: ', event_info.title, ' privilege: ', event_info.privilege except Exception, e: print e print 'None'
def test_get_events(): print '------------ test_get_events -------------' user = myTools.get_user_by_name('Rightpeter') events = calendar_tools.get_events_of_user(user) for event in events: event_info = calendar_tools.get_event_by_id(event['id'], user, 1) print 'title: ', event_info['title'], ' privilege: ', event_info[ 'privilege']
def test_add_244_event_to_rightpeter(): user = myTools.get_user_by_name('Rightpeter') birthday_event = {} birthday_event['title'] = '244' birthday_event['starttime'] = '2015-06-22 00:00:00' birthday_event['endtime'] = '2015-06-22 23:59:59' birthday_event['allday'] = 1 birthday_event['privilege'] = 244 res = calendar_tools.add_event_to_user(birthday_event, user) print 'res: ', res