Esempio n. 1
0
def test_valid_course(course_mnemo="INFOH500"):
    gehol_proxy = GeholProxy("164.15.72.157:8081")
    print "Fetching events for course : %s" % course_mnemo
    calendar = gehol_proxy.get_course_calendar(course_mnemo)
    print "Result : "
    print calendar
    print calendar.events
Esempio n. 2
0
def test_nonexistent_course():
    course_mnemo = "INFOH999"
    print "Fetching events for non existent course : %s" % course_mnemo
    gehol_proxy = GeholProxy("164.15.72.157:8081")
    try:
        calendar = gehol_proxy.get_course_calendar(course_mnemo)
    except Exception, e:
        print "Non existent course %s was not found" % course_mnemo
        print "Reason : ", e.message
Esempio n. 3
0
import sys
sys.path.append("../src")

from gehol import GeholProxy
from gehol.converters.utils import write_content_to_file
from gehol.converters.rfc5545icalwriter import convert_geholcalendar_to_ical

if __name__=="__main__":
    print 'import calendar test --> csv files'
    all_courses = ['INFOH500','BIMEH404','STATH400', 'COMMB411', 'TRANH100', 'INFOH100', 'TRANH100']
    host = '164.15.72.157:8081'
    first_monday = '19/09/2011'

    gehol_proxy = GeholProxy(host)

    for course in all_courses:
        print "fetching events for course %s" % course
        cal = gehol_proxy.get_course_calendar(course)
        dest_filename = '%s.ics' % course
        ical = convert_geholcalendar_to_ical(cal, first_monday)
        print "Saving %s events to %s" % (course, dest_filename)
        ical_data = ical.as_string()
        write_content_to_file(ical_data, dest_filename)