pyldb: Raise proper exception when attempting to assign a string to a dn
[metze/samba/wip.git] / source4 / lib / ldb / tests / python / api.py
index 05e3da782edc42b1e8d53dabb71f58d317e54cd5..110b1cabfe764f8d7ee451dc060c1d5023faed7b 100755 (executable)
@@ -279,6 +279,12 @@ class DnTests(unittest.TestCase):
     def setUp(self):
         self.ldb = ldb.Ldb(filename())
 
+    def test_set_dn_invalid(self):
+        x = ldb.Message()
+        def assign():
+            x.dn = "astring"
+        self.assertRaises(TypeError, assign)
+
     def test_eq(self):
         x = ldb.Dn(self.ldb, "dc=foo11,bar=bloe")
         y = ldb.Dn(self.ldb, "dc=foo11,bar=bloe")