def test_spoke_org_get_missing(self): """Retrieve a missing org; return an empty list.""" org_name = 'testSpokeOrgMissing' org = SpokeOrg() expected_result = [] result = org.get(org_name)['data'] self.assertEqual(result, expected_result)
def _get_org(self, org_name): """Retrieve our org object.""" org = SpokeOrg() result = org.get(org_name) if result['data'] == []: msg = "Can't find org %s" % org_name raise error.NotFound(msg) return result
def setUp(self): """Create test organisation and user.""" org = SpokeOrg() org.create(self.org_name) user = SpokeUser(self.org_name) user.create(self.email_addr, self.first, self.last) svn = SpokeSVN(self.org_name, self.user_id) svn.create(self.svn_repo_name)
def setUp(self): """Create test organisation and user.""" org = SpokeOrg() org.create(self.org_name, self.org_children) user = SpokeUser(self.org_name) user.create(self.email_addr, self.first, self.last) pwd = SpokePwd(self.org_name, self.user_id) pwd.create(self.user_def_pwd)
def tearDown(self): """Delete test organisation and host""" host = SpokeHost(self.org_name) host.delete(self.host_name) org = SpokeOrg() org.delete(self.org_name, self.org_children) next_uuid = SpokeHostUUID() next_uuid.delete()
def tearDown(self): """Delete test organisation, user and email domain.""" acc = SpokeEmailAccount(self.org_name, self.user_id) acc.delete(self.email_addr) user = SpokeUser(self.org_name) user.delete(self.first, self.last) dom = SpokeEmailDomain(self.org_name) dom.delete(self.email_dom) org = SpokeOrg() org.delete(self.org_name, self.org_children)
def test_spoke_org_get(self): """Retrieve an org; return an org object.""" org = SpokeOrg() dn = '%s=%s,%s' % (self.org_attr, self.org_name, self.base_dn) dn_info = {'objectClass': ['top', self.org_class], self.org_attr: [self.org_name]} expected_result = [(dn, dn_info)] result = org.get(self.org_name)['data'] self.assertEqual(result, expected_result)
def setUp(self): """Create test organisation, user and email domain.""" org = SpokeOrg() org.create(self.org_name) dom = SpokeEmailDomain(self.org_name) dom.create(self.email_dom) user = SpokeUser(self.org_name) user.create(self.email_addr, self.first, self.last) acc = SpokeEmailAccount(self.org_name, self.user_id) acc.create(self.email_addr)
def setUp(self): """Create test organisation and host.""" org = SpokeOrg() org.create(self.org_name, self.org_children) next_uuid = SpokeHostUUID() next_uuid.create(self.next_uuid_start) host = SpokeHost(self.org_name) host.create(self.host_name, self.host_uuid, self.host_mem, self.host_cpu, self.host_family, self.host_type, self.host_storage_layout,self.host_network_layout, self.host_extra_opts)
def test_spoke_org_suffix_create(self): """Create an org with specific suffix; return True.""" org_name = 'testSpokeOrgCreate' base_dn = self.base_dn org = SpokeOrg() dn = 'o=%s,%s' % (org_name, base_dn) dn_info = {'objectClass': ['top', self.org_class, self.user_class], self.org_attr: [org_name], self.org_suffix_attr: [self.org_suffix_name]} expected_result = [(dn, dn_info)] self.assertTrue(org.create(org_name, suffix=self.org_suffix_name)) result = org.get(org_name)['data'] self.assertEqual(result, expected_result) org.delete(org_name, self.org_children)
def test_create_dns_zone_with_missing_container(self): """Create a DNS zone in a missing dns container; return result object.""" dns_zone = 'testcreate.dhcp.server.local' org_name = 'TestMissingContainerOrg' org_def_children = 'people,groups' org_children = org_def_children.split(',') org = SpokeOrg() org.create(org_name, org_children) zone = SpokeDNSZone(org_name, dns_zone) result = zone.create()['data'] basedn = '%s=%s,%s=%s,%s' % (self.dns_cont_attr, self.dns_cont_name, self.org_attr, org_name, self.base_dn) dn = '%s=%s,%s' % (self.dns_zone_name_attr, dns_zone, basedn) dn_info = {'objectClass': ['top', self.dns_zone_name_class], 'relativeDomainName': ['@'], 'zoneName': [dns_zone]} expected_result = [(dn, dn_info)] self.assertEqual(result, expected_result) zone.delete() org.delete(org_name)
def test_spoke_org_create(self): """Create an org with default children; return True.""" org_name = 'testSpokeOrgCreate' base_dn = self.base_dn org = SpokeOrg() dn = 'o=%s,%s' % (org_name, base_dn) dn_info = {'objectClass': ['top', self.org_class], self.org_attr: [org_name]} expected_result = [(dn, dn_info)] self.assertTrue(org.create(org_name)) result = org.get(org_name)['data'] self.assertEqual(result, expected_result) for child_name in self.org_children: child = SpokeOrgChild(org_name) rdn = self.container_attr + '=' + child_name organisation = self.org_attr + '=' + org_name dn = rdn + ',' + organisation + ',' + self.base_dn dn_info = {'objectClass': ['top', self.container_class], self.container_attr: [child_name]} expected_result = [(dn, dn_info)] result = child.get(child_name)['data'] self.assertEqual(result, expected_result) org.delete(org_name)
def test_spoke_org_update_org_suffix(self): """Modify an org's suffix; return updated org object.""" old_suffix = self.org_suffix_name new_suffix = 'neworgsuffix.org' org_name = 'testOrgModSuffix' dn = 'o=%s,%s' % (org_name, self.base_dn) dn_info = {'objectClass': ['top', self.org_class, self.user_class], self.org_attr: [org_name], self.org_suffix_attr: [old_suffix]} expected_result = [(dn, dn_info)] org = SpokeOrg() org.create(org_name, suffix=new_suffix) org.modify(org_name, suffix=old_suffix) result = org.get(org_name)['data'] self.assertEqual(result, expected_result) org.delete(org_name, self.org_children)
def test_spoke_org_get_all(self): """Retrieve all orgs; return a list of org objects.""" # First org is already created by SetUp() org2 = 'SpokeOrgTest2' org_dn1 = '%s=%s,%s' % (self.org_attr, self.org_name, self.base_dn) org_dn2 = '%s=%s,%s' % (self.org_attr, org2, self.base_dn) org_dn1_info = {'objectClass': ['top', self.org_class], self.org_attr: [self.org_name]} org_dn2_info = {'objectClass': ['top', self.org_class], self.org_attr: [org2]} expected_result = [(org_dn1, org_dn1_info), (org_dn2, org_dn2_info)] org = SpokeOrg() org.create(org2) result = org.get()['data'] self.assertEqual(result, expected_result) org.delete(org2, self.org_children)
def tearDown(self): """Delete test organisation and user""" user = SpokeUser(self.org_name) user.delete(self.first) org = SpokeOrg() org.delete(self.org_name, self.org_children)
def setUp(self): """Create test organisation and user.""" org = SpokeOrg() org.create(self.org_name, self.org_children) user = SpokeUser(self.org_name) user.create(self.email_addr, self.first)
def test_spoke_org_delete(self): """Delete an org; return True.""" org_name = 'testSpokeOrgDelete' org = SpokeOrg() org.create(org_name) self.assertTrue(org.delete(org_name))
def setUp(self): org = SpokeOrg() org.create(self.org_name, self.org_children)
def tearDown(self): list = SpokeMailingList(self.org_name) list.delete(self.list_address) org = SpokeOrg() org.delete(self.org_name)
def setUp(self): org = SpokeOrg() org.create(self.org_name) list = SpokeMailingList(self.org_name) list.create(self.list_address, self.list_member)
def tearDown(self): org = SpokeOrg() org.delete(self.org_name, self.org_children)
def tearDown(self): zone = SpokeDNSZone(self.org_name, self.dns_zone_name) zone.delete() org = SpokeOrg() org.delete(self.org_name, self.org_children)
def setUp(self): org = SpokeOrg() org.create(self.org_name, self.org_children) zone = SpokeDNSZone(self.org_name, self.dns_zone_name) zone.create()