Esempio n. 1
0
def test_update():
    """ Test updating LDAPEntry object. """
    entry = LDAPEntry("cn=test")
    entry.update({"GivenName": "test2", "mail": "test@mail"})
    entry.update([("sn", "test")])
    with pytest.raises(ValueError):
        entry.update([("sn", "test", 1)])
    entry.update(uidnumber=1, gidnumber=1)
    assert entry["mail"] == ["test@mail"]
    assert entry["givenname"] == ["test2"]
    assert entry["sn"][0] == "test"
    assert entry["uidnumber"] == [1]
    assert entry["gidnumber"] == [1]
Esempio n. 2
0
def test_update():
    """ Test updating LDAPEntry object. """
    entry = LDAPEntry("cn=test")
    entry.update({"GivenName": "test2", "mail": "test@mail"})
    entry.update([("sn", "test")])
    with pytest.raises(ValueError):
        entry.update([("sn", "test", 1)])
    entry.update(uidnumber=1, gidnumber=1)
    assert entry["mail"] == ["test@mail"]
    assert entry["givenname"] == ["test2"]
    assert entry["sn"][0] == "test"
    assert entry["uidnumber"] == [1]
    assert entry["gidnumber"] == [1]
Esempio n. 3
0
 def test_update(self):
     """ Test updating LDAPEntry object. """
     entry = LDAPEntry("cn=test")
     entry.update({"GivenName": "test2", "mail" : "test@mail"})
     entry.update([("sn", "test")])
     self.assertRaises(ValueError,
                       lambda: entry.update([("sn", "test", 1)]))
     entry.update(uidnumber=1, gidnumber=1)
     self.assertEqual(entry['mail'], ['test@mail'])
     self.assertEqual(entry['givenname'], ['test2'])
     self.assertEqual(entry['sn'][0], 'test')
     self.assertEqual(entry['uidnumber'], [1])
     self.assertEqual(entry['gidnumber'], [1])
Esempio n. 4
0
 def test_update(self):
     """ Test updating LDAPEntry object. """
     entry = LDAPEntry("cn=test")
     entry.update({"GivenName": "test2", "mail" : "test@mail"})
     entry.update([("sn", "test")])
     entry.update(uidnumber=1, gidnumber=1)
     self.assertEqual(entry['mail'], ['test@mail'])
     self.assertEqual(entry['givenname'], ['test2'])
     self.assertEqual(entry['sn'][0], 'test')
     self.assertEqual(entry['uidnumber'], [1])
     self.assertEqual(entry['gidnumber'], [1])