1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

s4-test/repl_schema: Make sure every object is with unique name

This way, test writer don't have to be careful to choose
unique objects suffix
This commit is contained in:
Kamen Mazdrashki 2010-12-13 20:15:26 +02:00
parent dda73b85e6
commit 9c78bdfd47

View File

@ -53,6 +53,8 @@ class DrsReplSchemaTestCase(samba.tests.TestCase):
# prefix for all objects created # prefix for all objects created
obj_prefix = None obj_prefix = None
# current Class or Attribute object id
obj_id = 0
def setUp(self): def setUp(self):
super(DrsReplSchemaTestCase, self).setUp() super(DrsReplSchemaTestCase, self).setUp()
@ -68,7 +70,7 @@ class DrsReplSchemaTestCase(samba.tests.TestCase):
# initialize objects prefix if not done yet # initialize objects prefix if not done yet
if self.obj_prefix is None: if self.obj_prefix is None:
t = time.strftime("%s", time.gmtime()) t = time.strftime("%s", time.gmtime())
DrsReplSchemaTestCase.obj_prefix = "DrsReplSchema-%s-" % t DrsReplSchemaTestCase.obj_prefix = "DrsReplSchema-%s" % t
# cache some of RootDSE props # cache some of RootDSE props
self.schema_dn = self.info_dc1["schemaNamingContext"][0] self.schema_dn = self.info_dc1["schemaNamingContext"][0]
@ -111,7 +113,8 @@ class DrsReplSchemaTestCase(samba.tests.TestCase):
def _make_obj_names(self, base_name): def _make_obj_names(self, base_name):
'''Try to create a unique name for an object '''Try to create a unique name for an object
that is to be added to schema''' that is to be added to schema'''
obj_name = self.obj_prefix + base_name self.obj_id += 1
obj_name = "%s-%d-%s" % (self.obj_prefix, self.obj_id, base_name)
obj_ldn = obj_name.replace("-", "") obj_ldn = obj_name.replace("-", "")
obj_dn = "CN=%s,%s" % (obj_name, self.schema_dn) obj_dn = "CN=%s,%s" % (obj_name, self.schema_dn)
return (obj_dn, obj_name, obj_ldn) return (obj_dn, obj_name, obj_ldn)