forked from pseudovirtual/earnings-calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testcal.py
39 lines (26 loc) · 829 Bytes
/
testcal.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/python
'''
Basic tests for calendar api
'''
import sys
import os
sys.path.append('gcal-boilerplate')
from mycal import MyCalendar
def main(argv):
mc = MyCalendar(argv)
testGetCalendars(mc)
testGetCalendarId(mc, "Test Calendar")
calId = mc.getCalendarId("Test Calendar")
testAddEvent(mc, calId, "AXP", "16-Apr-14")
def testGetCalendars(mc):
calendar_list = mc.getCalendars()
for calendar_list_entry in calendar_list['items']:
print calendar_list_entry['summary']
def testGetCalendarId(mc, name):
calendar = mc.getCalendarId(name)
print 'The calendar is %s'%(calendar)
def testAddEvent(mc, calId, company, day):
created_event = mc.addEvent(calId, company, day)
print 'Successfully Created event %s %s'%(created_event['summary'], created_event['id'])
if __name__ == '__main__':
main(sys.argv)