Пример #1
0
 def test_convert_id(self):
     i = (
         "AAMkADQyYzZmYmUxLTJiYjItNDg2Ny1iMzNjLTIzYWE1NDgxNmZhNABGAAAAAADUebQDarW2Q7G2Ji8hKofPBwAl9iKCsfCfSa9cmjh"
         "+JCrCAAPJcuhjAAB0l+JSKvzBRYP+FXGewReXAABj6DrMAAA=")
     for fmt in ID_FORMATS:
         res = list(
             self.account.protocol.convert_ids(
                 [
                     AlternateId(id=i,
                                 format=EWS_ID,
                                 mailbox=self.account.primary_smtp_address)
                 ],
                 destination_format=fmt,
             ))
         self.assertEqual(len(res), 1)
         self.assertEqual(res[0].format, fmt)
     # Test bad format
     with self.assertRaises(ValueError) as e:
         self.account.protocol.convert_ids([
             AlternateId(id=i,
                         format=EWS_ID,
                         mailbox=self.account.primary_smtp_address)
         ],
                                           destination_format="XXX")
     self.assertEqual(
         e.exception.args[0],
         f"'destination_format' 'XXX' must be one of {sorted(ID_FORMATS)}")
     # Test bad item type
     with self.assertRaises(TypeError) as e:
         list(
             self.account.protocol.convert_ids([ItemId(id=1)],
                                               destination_format="EwsId"))
     self.assertIn("must be of type", e.exception.args[0])
Пример #2
0
 def test_convert_id(self):
     i = 'AAMkADQyYzZmYmUxLTJiYjItNDg2Ny1iMzNjLTIzYWE1NDgxNmZhNABGAAAAAADUebQDarW2Q7G2Ji8hKofPBwAl9iKCsfCfSa9cmjh' \
         '+JCrCAAPJcuhjAAB0l+JSKvzBRYP+FXGewReXAABj6DrMAAA='
     for fmt in ID_FORMATS:
         res = list(self.account.protocol.convert_ids(
                 [AlternateId(id=i, format=EWS_ID, mailbox=self.account.primary_smtp_address)],
                 destination_format=fmt))
         self.assertEqual(len(res), 1)
         self.assertEqual(res[0].format, fmt)