def test_regimenth_vcard(self): regimenth = self.directory['armeedeterre']['corpsa']['divisionalpha']['regimenth'] vcard_provider = IVCard(regimenth) vcard = vcard_provider.get_vcard() self.assertEqual(vcard.fn.value, u'Régiment H') self.assertEqual(vcard.kind.value, 'org') self.assertTrue(hasattr(vcard, 'adr'))
def test_regimenth_vcard(self): regimenth = self.directory['armeedeterre']['corpsa']['divisionalpha']['regimenth'] vcard_provider = IVCard(regimenth) vcard = vcard_provider.get_vcard() self.assertEqual(vcard.fn.value, u'Régiment H'.encode('utf-8')) self.assertEqual(vcard.kind.value, 'org') self.assertTrue(hasattr(vcard, 'adr'))
def render(self): self.request.response.setHeader('Content-type', "text/x-vCard; charset=utf-8") content_disposition = 'attachment; filename=%s.vcf' % (self.context.id) self.request.response.setHeader('Content-Disposition', content_disposition) vcard_provider = IVCard(self.context) vcard = vcard_provider.get_vcard() return vcard.serialize()
def test_sgt_pepper_vcard(self): sergent_pepper = self.pepper['sergent_pepper'] vcard_provider = IVCard(sergent_pepper) vcard = vcard_provider.get_vcard() self.assertEqual(vcard.fn.value, 'Pepper') self.assertEqual(vcard.org.value, [u'Armée de terre', u'Corps A', u'Division Alpha', u'Régiment H', u'Brigade LH']) self.assertEqual(vcard.role.value, "Sergent de la brigade LH")
def render(self): self.request.response.setHeader( 'Content-type', "text/x-vCard; charset=utf-8") content_disposition = 'attachment; filename=%s.vcf' % (self.context.id) self.request.response.setHeader( 'Content-Disposition', content_disposition) vcard_provider = IVCard(self.context) vcard = vcard_provider.get_vcard() return vcard.serialize()
def test_gadt_vcard(self): gadt = self.degaulle['gadt'] vcard_provider = IVCard(gadt) vcard = vcard_provider.get_vcard() self.assertEqual(vcard.fn.value, u'Charles De Gaulle') self.assertEqual(vcard.org.value, [u'Armée de terre']) self.assertEqual(vcard.role.value, u"Général de l'armée de terre") self.assertEqual(vcard.title.value, u"Général de l'armée de terre") self.assertEqual(vcard.email.value, '*****@*****.**') self.assertEqual(vcard.email.type_param, 'INTERNET') self.assertTrue(hasattr(vcard, 'adr')) self.assertFalse(hasattr(vcard, 'tel_list')) self.assertEqual(vcard.bday.value, '1901-11-22')
def test_gadt_vcard(self): gadt = self.degaulle['gadt'] vcard_provider = IVCard(gadt) api.portal.set_registry_record(name='person_contact_details_private', value=True, interface=IContactCoreParameters) vcard = vcard_provider.get_vcard() self.assertEqual(vcard.fn.value, u'Charles De Gaulle') self.assertEqual(vcard.org.value, [u'Armée de terre']) self.assertEqual(vcard.role.value, u"Général de l'armée de terre") self.assertEqual(vcard.title.value, u"Général de l'armée de terre") self.assertEqual(vcard.email.value, '*****@*****.**') self.assertEqual(vcard.email.type_param, 'INTERNET') self.assertTrue(hasattr(vcard, 'adr')) self.assertTrue(hasattr(vcard, 'tel_list')) self.assertEqual(vcard.bday.value, '1901-11-22') api.portal.set_registry_record(name='person_contact_details_private', value=False, interface=IContactCoreParameters) vcard = vcard_provider.get_vcard() self.assertEqual(vcard.email.value, '*****@*****.**') self.assertEqual(vcard.email.type_param, 'INTERNET') self.assertTrue(hasattr(vcard, 'adr')) self.assertTrue(hasattr(vcard, 'tel_list')) self.assertEqual(vcard.bday.value, '1901-11-22')