示例#1
0
    def test_ewstimezone(self):
        # Test autogenerated translations
        tz = EWSTimeZone('Europe/Copenhagen')
        self.assertIsInstance(tz, EWSTimeZone)
        self.assertEqual(tz.key, 'Europe/Copenhagen')
        self.assertEqual(tz.ms_id, 'Romance Standard Time')
        # self.assertEqual(EWSTimeZone('Europe/Copenhagen').ms_name, '')  # EWS works fine without the ms_name

        # Test localzone()
        tz = EWSTimeZone.localzone()
        self.assertIsInstance(tz, EWSTimeZone)

        # Test common helpers
        tz = EWSTimeZone('UTC')
        self.assertIsInstance(tz, EWSTimeZone)
        self.assertEqual(tz.key, 'UTC')
        self.assertEqual(tz.ms_id, 'UTC')
        tz = EWSTimeZone('GMT')
        self.assertIsInstance(tz, EWSTimeZone)
        self.assertEqual(tz.key, 'GMT')
        self.assertEqual(tz.ms_id, 'UTC')

        # Test mapper contents. Latest map from unicode.org has 394 entries
        self.assertGreater(len(EWSTimeZone.IANA_TO_MS_MAP), 300)
        for k, v in EWSTimeZone.IANA_TO_MS_MAP.items():
            self.assertIsInstance(k, str)
            self.assertIsInstance(v, tuple)
            self.assertEqual(len(v), 2)
            self.assertIsInstance(v[0], str)

        # Test IANA exceptions
        sanitized = list(t for t in zoneinfo.available_timezones()
                         if not t.startswith('SystemV/') and t != 'localtime')
        self.assertEqual(
            set(sanitized) - set(EWSTimeZone.IANA_TO_MS_MAP), set())

        # Test timezone unknown by ZoneInfo
        with self.assertRaises(UnknownTimeZone) as e:
            EWSTimeZone('UNKNOWN')
        self.assertEqual(e.exception.args[0],
                         'No time zone found with key UNKNOWN')

        # Test timezone known by IANA but with no Winzone mapping
        with self.assertRaises(UnknownTimeZone) as e:
            del EWSTimeZone.IANA_TO_MS_MAP['Africa/Tripoli']
            EWSTimeZone('Africa/Tripoli')
        self.assertEqual(
            e.exception.args[0],
            'No Windows timezone name found for timezone "Africa/Tripoli"')

        # Test __eq__ with non-EWSTimeZone compare
        self.assertFalse(EWSTimeZone('GMT') == zoneinfo.ZoneInfo('UTC'))

        # Test from_ms_id() with non-standard MS ID
        self.assertEqual(EWSTimeZone('Europe/Copenhagen'),
                         EWSTimeZone.from_ms_id('Europe/Copenhagen'))
示例#2
0
    top.geometry('%dx%d+%d+%d' % (w, h, x, y))
    top.update()
    credentials = Credentials(
        username='******',  # Or [email protected] for O365
        password='******')
    account = Account(primary_smtp_address='*****@*****.**',
                      credentials=credentials,
                      autodiscover=True,
                      access_type=DELEGATE)

    yardAccount = Account(primary_smtp_address='*****@*****.**',
                          credentials=credentials,
                          autodiscover=True,
                          access_type=DELEGATE)
    done = []
    tz = EWSTimeZone.localzone()
    Message.register('flag', Flag)

    top.after(0, doStuff, credentials, yardAccount, account, done)
    top.mainloop()
#         print("quitting")
#         sleep(2)
#         print("beofre")
#         try:
# #             driver.close()
#             driver.quit()
#         except:
#             print(exc_info())
#         print("aftr")
#         sleep(10)
# pyinstaller "C:\Users\ssleep\workspace\RNS Releaser\Automator\__init__.py" --distpath "J:\Spencer\RNS Releaser" -y