provision: Add tests for determine_netbios_name.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 26 Feb 2012 19:39:13 +0000 (20:39 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 26 Feb 2012 19:52:05 +0000 (20:52 +0100)
source4/scripting/python/samba/tests/provision.py

index 0ebe40040546aa026c9e801ce45d1d492076082f..a96efdf39e52d3e1f642fc7ba6cd7e0ecc9d740a 100644 (file)
@@ -24,6 +24,7 @@ from samba.provision import (
     ProvisionNames,
     ProvisionPaths,
     ProvisionResult,
+    determine_netbios_name,
     sanitize_server_role,
     setup_secretsdb,
     findnss,
@@ -190,3 +191,11 @@ class ProvisionResultTests(TestCase):
         self.assertEquals(entries[1],
                 ("INFO", 'Admin password:        geheim'))
 
+
+class DetermineNetbiosNameTests(TestCase):
+
+    def test_limits_to_15(self):
+        self.assertEquals("A" * 15, determine_netbios_name("a" * 30))
+
+    def test_strips_invalid(self):
+        self.assertEquals("BLABLA", determine_netbios_name("bla/bla"))