def test_sync_local_user(self): self.login_as_portal_owner() user = self._create_userprofile() ad = IUserProfileManager(user) ad.sync() self.assertFalse( hasattr(user, 'last_sync'), 'User should not have been synced', )
def test_sync(self): self.login_as_portal_owner() user = self._create_userprofile() member = api.user.get(username=user.username) email = '*****@*****.**' self._set_foreign_property(member, 'email', email) user = pi_api.userprofile.get(user.username) upm = IUserProfileManager(user) upm.sync() self.assertEqual(user.email, email) catalog = api.portal.get_tool(name='portal_catalog') brains = catalog.searchResults(portal_type=user.portal_type) self.assertEqual(len(brains), 1) self.assertEqual(brains[0]['email'], email) self._check_last_sync_set(brains[0].getObject())