def test_get_timezones(self): ws = GetServerTimeZones(self.account.protocol) data = ws.call() self.assertAlmostEqual(len(list(data)), 130, delta=30, msg=data) # Test shortcut self.assertAlmostEqual(len(list(self.account.protocol.get_timezones())), 130, delta=30, msg=data) # Test translation to TimeZone objects for tz_id, tz_name, periods, transitions, transitionsgroups in self.account.protocol.get_timezones( return_full_timezone_data=True): TimeZone.from_server_timezone(periods=periods, transitions=transitions, transitionsgroups=transitionsgroups, for_year=2018)
def test_invalid_server_version(self): # Test that we get a client-side error if we call a service that was only implemented in a later version version = mock_version(build=EXCHANGE_2007) account = mock_account(version=version, protocol=mock_protocol(version=version, service_endpoint='example.com')) with self.assertRaises(NotImplementedError): list(GetServerTimeZones(protocol=account.protocol).call()) with self.assertRaises(NotImplementedError): list(GetRoomLists(protocol=account.protocol).call()) with self.assertRaises(NotImplementedError): list(GetRooms(protocol=account.protocol).call('XXX'))
def test_get_timezones(self): ws = GetServerTimeZones(self.config.protocol) data = ws.call() self.assertAlmostEqual(len(data), 100, delta=10, msg=data)