<s> import json <EOL> import unittest <EOL> from libsaas import port <EOL> from libsaas . executors import test_executor <EOL> from libsaas . services import googlecalendar <EOL> from libsaas . services . base import MethodNotSupported <EOL> class GoogleCalendarTestCase ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . executor = test_executor . use ( ) <EOL> self . executor . set_response ( b'<STR_LIT:{}>' , <NUM_LIT:200> , { } ) <EOL> self . service = googlecalendar . GoogleCalendar ( access_token = '<STR_LIT>' ) <EOL> def expect ( self , method = None , uri = None , params = { } , headers = None ) : <EOL> if method : <EOL> self . assertEqual ( method , self . executor . request . method ) <EOL> if uri : <EOL> self . assertEqual ( self . executor . request . uri , <EOL> '<STR_LIT>' + uri ) <EOL> self . assertEqual ( self . executor . request . params , params ) <EOL> if headers : <EOL> self . assertEqual ( self . executor . request . headers , headers ) <EOL> def test_user ( self ) : <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . me ( ) . get ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . me ( ) . create ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . me ( ) . update ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . me ( ) . patch ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . me ( ) . delete ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . me ( ) . settings ( ) . create ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . me ( ) . settings ( ) . update ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . me ( ) . settings ( ) . patch ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . me ( ) . settings ( ) . delete ( ) <EOL> self . service . me ( ) . settings ( ) . get ( ) <EOL> self . expect ( '<STR_LIT:GET>' , '<STR_LIT>' , { } ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . me ( ) . setting ( '<STR_LIT>' ) . create ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . me ( ) . setting ( '<STR_LIT>' ) . update ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . me ( ) . setting ( '<STR_LIT>' ) . patch ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . me ( ) . setting ( '<STR_LIT>' ) . delete ( ) <EOL> self . service . me ( ) . setting ( '<STR_LIT>' ) . get ( ) <EOL> self . expect ( '<STR_LIT:GET>' , '<STR_LIT>' , { } ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . me ( ) . calendar_lists ( ) . update ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . me ( ) . calendar_lists ( ) . patch ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . me ( ) . calendar_lists ( ) . delete ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . me ( ) . calendar_list ( '<STR_LIT>' ) . create ( ) <EOL> self . service . me ( ) . calendar_lists ( ) . get ( ) <EOL> self . expect ( '<STR_LIT:GET>' , '<STR_LIT>' , { } ) <EOL> obj = { '<STR_LIT:foo>' : '<STR_LIT:bar>' } <EOL> self . service . me ( ) . calendar_lists ( ) . create ( obj ) <EOL> self . expect ( '<STR_LIT:POST>' , '<STR_LIT>' , json . dumps ( obj ) ) <EOL> self . service . me ( ) . calendar_list ( '<STR_LIT>' ) . get ( ) <EOL> self . expect ( '<STR_LIT:GET>' , '<STR_LIT>' , { } ) <EOL> self . service . me ( ) . calendar_list ( '<STR_LIT>' ) . update ( obj ) <EOL> self . expect ( '<STR_LIT>' , '<STR_LIT>' , json . dumps ( obj ) ) <EOL> self . service . me ( ) . calendar_list ( '<STR_LIT>' ) . patch ( obj ) <EOL> self . expect ( '<STR_LIT>' , '<STR_LIT>' , json . dumps ( obj ) ) <EOL> self . service . me ( ) . calendar_list ( '<STR_LIT>' ) . delete ( ) <EOL> self . expect ( '<STR_LIT>' , '<STR_LIT>' , { } ) <EOL> def test_colors ( self ) : <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . colors ( ) . create ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . colors ( ) . update ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . colors ( ) . patch ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . colors ( ) . delete ( ) <EOL> self . service . colors ( ) . get ( ) <EOL> self . expect ( '<STR_LIT:GET>' , '<STR_LIT>' , { } ) <EOL> def test_freebusy ( self ) : <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . freebusy ( ) . get ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . freebusy ( ) . create ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . freebusy ( ) . update ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . freebusy ( ) . patch ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . freebusy ( ) . delete ( ) <EOL> obj = { '<STR_LIT:foo>' : '<STR_LIT:bar>' } <EOL> self . service . freebusy ( ) . query ( obj ) <EOL> self . expect ( '<STR_LIT:POST>' , '<STR_LIT>' , json . dumps ( obj ) ) <EOL> def test_calendar ( self ) : <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . calendars ( ) . get ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . calendars ( ) . update ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . calendars ( ) . patch ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . calendars ( ) . delete ( ) <EOL> obj = { '<STR_LIT:foo>' : '<STR_LIT:bar>' } <EOL> self . service . calendars ( ) . create ( obj ) <EOL> self . expect ( '<STR_LIT:POST>' , '<STR_LIT>' , json . dumps ( obj ) ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . calendar ( '<STR_LIT>' ) . create ( ) <EOL> self . service . calendar ( '<STR_LIT>' ) . get ( ) <EOL> self . expect ( '<STR_LIT:GET>' , '<STR_LIT>' , { } ) <EOL> self . service . calendar ( '<STR_LIT>' ) . update ( obj ) <EOL> self . expect ( '<STR_LIT>' , '<STR_LIT>' , json . dumps ( obj ) ) <EOL> self . service . calendar ( '<STR_LIT>' ) . patch ( obj ) <EOL> self . expect ( '<STR_LIT>' , '<STR_LIT>' , json . dumps ( obj ) ) <EOL> self . service . calendar ( '<STR_LIT>' ) . delete ( ) <EOL> self . expect ( '<STR_LIT>' , '<STR_LIT>' , { } ) <EOL> self . service . calendar ( '<STR_LIT>' ) . clear ( ) <EOL> self . expect ( '<STR_LIT:POST>' , '<STR_LIT>' , { } ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . calendar ( '<STR_LIT>' ) . rules ( ) . update ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . calendar ( '<STR_LIT>' ) . rules ( ) . patch ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . calendar ( '<STR_LIT>' ) . rules ( ) . delete ( ) <EOL> self . service . calendar ( '<STR_LIT>' ) . rules ( ) . get ( ) <EOL> self . expect ( '<STR_LIT:GET>' , '<STR_LIT>' , { } ) <EOL> obj = { '<STR_LIT:foo>' : '<STR_LIT:bar>' } <EOL> self . service . calendar ( '<STR_LIT>' ) . rules ( ) . create ( obj ) <EOL> self . expect ( '<STR_LIT:POST>' , '<STR_LIT>' , json . dumps ( obj ) ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . calendar ( '<STR_LIT>' ) . rule ( '<STR_LIT>' ) . create ( ) <EOL> self . service . calendar ( '<STR_LIT>' ) . rule ( '<STR_LIT>' ) . get ( ) <EOL> self . expect ( '<STR_LIT:GET>' , '<STR_LIT>' , { } ) <EOL> self . service . calendar ( '<STR_LIT>' ) . rule ( '<STR_LIT>' ) . update ( obj ) <EOL> self . expect ( '<STR_LIT>' , '<STR_LIT>' , json . dumps ( obj ) ) <EOL> self . service . calendar ( '<STR_LIT>' ) . rule ( '<STR_LIT>' ) . patch ( obj ) <EOL> self . expect ( '<STR_LIT>' , '<STR_LIT>' , json . dumps ( obj ) ) <EOL> self . service . calendar ( '<STR_LIT>' ) . rule ( '<STR_LIT>' ) . delete ( ) <EOL> self . expect ( '<STR_LIT>' , '<STR_LIT>' , { } ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . calendar ( '<STR_LIT>' ) . events ( ) . update ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . calendar ( '<STR_LIT>' ) . events ( ) . patch ( ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . calendar ( '<STR_LIT>' ) . events ( ) . delete ( ) <EOL> self . service . calendar ( '<STR_LIT>' ) . events ( ) . get ( ) <EOL> self . expect ( '<STR_LIT:GET>' , '<STR_LIT>' , { } ) <EOL> self . service . calendar ( '<STR_LIT>' ) . events ( ) . get ( timeZone = '<STR_LIT>' ) <EOL> self . expect ( '<STR_LIT:GET>' , '<STR_LIT>' , { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> obj = { '<STR_LIT:foo>' : '<STR_LIT:bar>' } <EOL> self . service . calendar ( '<STR_LIT>' ) . events ( ) . create ( obj ) <EOL> self . expect ( '<STR_LIT:POST>' , '<STR_LIT>' , json . dumps ( obj ) ) <EOL> self . service . calendar ( '<STR_LIT>' ) . events ( ) . importing ( obj ) <EOL> self . expect ( '<STR_LIT:POST>' , '<STR_LIT>' , json . dumps ( obj ) ) <EOL> self . service . calendar ( '<STR_LIT>' ) . events ( ) . quick_add ( '<STR_LIT:text>' , True ) <EOL> self . expect ( '<STR_LIT:POST>' , <EOL> '<STR_LIT>' ) <EOL> with port . assertRaises ( MethodNotSupported ) : <EOL> self . service . calendar ( '<STR_LIT>' ) . event ( '<STR_LIT>' ) . create ( ) <EOL> self . service . calendar ( '<STR_LIT>' ) . event ( '<STR_LIT>' ) . get ( ) <EOL> self . expect ( '<STR_LIT:GET>' , '<STR_LIT>' , { } ) <EOL> self . service . calendar ( '<STR_LIT>' ) . event ( '<STR_LIT>' ) . instances ( ) <EOL> self . expect ( '<STR_LIT:GET>' , '<STR_LIT>' , { } ) <EOL> self . service . calendar ( '<STR_LIT>' ) . event ( '<STR_LIT>' ) . instances ( maxResults = <NUM_LIT:1> ) <EOL> self . expect ( '<STR_LIT:GET>' , '<STR_LIT>' , <EOL> { '<STR_LIT>' : <NUM_LIT:1> } ) <EOL> self . service . calendar ( '<STR_LIT>' ) . event ( '<STR_LIT>' ) . update ( obj ) <EOL> self . expect ( '<STR_LIT>' , '<STR_LIT>' , json . dumps ( obj ) ) <EOL> self . service . calendar ( '<STR_LIT>' ) . event ( '<STR_LIT>' ) . update ( obj , True ) <EOL> self . expect ( '<STR_LIT>' , '<STR_LIT>' , <EOL> json . dumps ( obj ) ) <EOL> self . service . calendar ( '<STR_LIT>' ) . event ( '<STR_LIT>' ) . patch ( obj ) <EOL> self . expect ( '<STR_LIT>' , '<STR_LIT>' , json . dumps ( obj ) ) <EOL> self . service . calendar ( '<STR_LIT>' ) . event ( '<STR_LIT>' ) . patch ( obj , sendNotifications = True ) <EOL> self . expect ( '<STR_LIT>' , '<STR_LIT>' , <EOL> json . dumps ( obj ) ) <EOL> self . service . calendar ( '<STR_LIT>' ) . event ( '<STR_LIT>' ) . delete ( ) <EOL> self . expect ( '<STR_LIT>' , '<STR_LIT>' , { } ) <EOL> self . service . calendar ( '<STR_LIT>' ) . event ( '<STR_LIT>' ) . delete ( True ) <EOL> self . expect ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . service . calendar ( '<STR_LIT>' ) . event ( '<STR_LIT>' ) . move ( '<STR_LIT>' ) <EOL> self . expect ( '<STR_LIT:POST>' , '<STR_LIT>' ) </s>
