Пример #1
0
 def test_sync_deletes_contact(self):
     create(Builder('contact').within(self.contacts).having(
         _id='julia.meier',
         ldap_dn=u'cn=Meier Julia,ou=Payroll,dc=domain, dc=net',
     ))
     res = sync_contacts(self.contacts, get_ldif_records('contact.ldif'))
     self.assertEquals(1, res['deleted'])
     self.assertNotIn('julia.meier', self.contacts.objectIds())
Пример #2
0
    def test_sync_creates_contact_with_attributes(self):
        res = sync_contacts(self.contacts, get_ldif_records('contact.ldif'))
        self.assertEquals(1, res['created'])

        contact = self.contacts['nina-mueller']
        self.assertEquals(u'cn=M\xfcller Nina,ou=Payroll,dc=domain, dc=net',
                          IContactSchema(contact).ldap_dn)
        self.assertEquals('Nina', IContactSchema(contact).firstname)
        self.assertEquals('M\xc3\xbcller', IContactSchema(contact).lastname)
        self.assertEquals('4teamwork AG', IContactSchema(contact).organization)
        self.assertEquals('[email protected]', IContactSchema(contact).email)
        self.assertEquals('Biel', IContactSchema(contact).city)
Пример #3
0
 def test_sync_reindexes_updated_contact(self):
     contact = create(Builder('contact').within(self.contacts).having(
         _id='nina-mueller',
         ldap_dn=u'cn=M\u00fcller Nina,ou=Payroll,dc=domain, dc=net',
         firstname='Nina',
         lastname='Meier',
         ))
     self.contacts.manage_renameObject(contact.id, 'nina-mueller')
     res = sync_contacts(self.contacts, get_ldif_records('contact.ldif'))
     self.assertEquals(1, res['modified'])
     catalog_results = self.portal.portal_catalog(Title='M\xc3\xbcller')
     self.assertEquals(1, len(catalog_results))
     self.assertEquals('M\xc3\xbcller Nina', catalog_results[0].Title)
Пример #4
0
 def test_sync_updates_contact(self):
     contact = create(Builder('contact').within(self.contacts).having(
         _id='nina.mueller',
         ldap_dn=u'cn=M\u00fcller Nina,ou=Payroll,dc=domain, dc=net',
         firstname='Nina',
         lastname='Meier',
         ))
     self.contacts.manage_renameObject(contact.id, 'nina-mueller')
     res = sync_contacts(self.contacts, get_ldif_records('contact.ldif'))
     self.assertEquals(1, res['modified'])
     self.assertEquals('Nina', IContactSchema(contact).firstname)
     self.assertEquals('M\xc3\xbcller', IContactSchema(contact).lastname)
     self.assertEquals('4teamwork AG', IContactSchema(contact).organization)
     self.assertEquals('[email protected]', IContactSchema(contact).email)
Пример #5
0
 def test_sync_contact_without_changes(self):
     res = sync_contacts(self.contacts, get_ldif_records('contact.ldif'))
     res = sync_contacts(self.contacts, get_ldif_records('contact.ldif'))
     self.assertEquals(1, res['unchanged'])
Пример #6
0
 def test_sync_creates_contacts(self):
     res = sync_contacts(self.contacts, get_ldif_records('contacts.ldif'))
     self.assertEquals(5, res['created'])
     self.assertEquals(5, len(self.contacts.objectIds()))
Пример #7
0
 def test_custom_updater_updates_field(self):
     sync_contacts(self.contacts, get_ldif_records('contact.ldif'))
     self.assertEquals(
         'Tania',
         IContactSchema(self.contacts['nina-mueller']).firstname)