def objects(self, dn, connection, base): connection.add(dn, UserRecord.LDAP_OBJECTCLASSES) record = UserRecord(dn=dn, attrs={}) action = ModifyAction(record=record, modifications={'mail': '*****@*****.**'}) action.execute(connection) return get_all_objects(connection, base)
def setUp(self): super(ModifyActionTestCase, self).setUp() self.uid = 'shizzle' self.dn = dn_from_username(self.uid, base=self.base) self.connection.add(self.dn, LDAP_OBJECTCLASSES) record = Record(dn=self.dn, attrs={}) action = ModifyAction(record=record, modifications={'mail': '*****@*****.**'}) action.execute(self.connection)
def test_desired_record_passed(self): desired = Record(dn=None, attrs={'gecos': 'test'}) current = Record(dn=None, attrs={}) action = ModifyAction.from_two_records(desired_record=desired, current_record=current) self.assertEqual(action.record, desired)
def action_from_attrs(self, current, desired): current_record = Record(dn=None, attrs=current) desired_record = Record(dn=None, attrs=desired) return ModifyAction.from_two_records(desired_record=desired_record, current_record=current_record)
def test_modify_action(self, attrs_current, attrs_desired, modifications): action = ModifyAction.from_two_records( desired_record=UserRecord(dn=None, attrs=attrs_desired), current_record=UserRecord(dn=None, attrs=attrs_current)) assert action.modifications == modifications
def test_desired_record_passed(self): desired = UserRecord(dn=None, attrs={'gecos': 'test'}) current = UserRecord(dn=None, attrs={}) action = ModifyAction.from_two_records(desired_record=desired, current_record=current) assert action.record == desired