def test_positive_add_and_remove_locations(module_org): """Add and remove a locations from organization :id: 37b63e5c-8fd5-439c-9540-972b597b590a :expectedresults: Locations are handled :BZ: 1395229, 1473387 :steps: 1. add and remove locations by name 2. add and remove locations by id :CaseLevel: Integration """ locations = [make_location() for _ in range(0, 2)] Org.add_location({'location-id': locations[0]['id'], 'name': module_org.name}) Org.add_location({'location': locations[1]['name'], 'name': module_org.name}) org_info = Org.info({'id': module_org.id}) assert len(org_info['locations']) == 2, "Failed to add locations" assert locations[0]['name'] in org_info['locations'] assert locations[1]['name'] in org_info['locations'] Org.remove_location({'location-id': locations[0]['id'], 'id': module_org.id}) Org.remove_location({'location': locations[1]['name'], 'id': module_org.id}) org_info = Org.info({'id': module_org.id}) assert not org_info.get('locations'), "Failed to remove locations"
def test_positive_add_and_remove_locations(self): """Add and remove a locations from organization :id: 37b63e5c-8fd5-439c-9540-972b597b590a :expectedresults: Locations are handled :BZ: 1395229, 1473387 :steps: 1. add and remove locations by name 2. add and remove locations by id :CaseLevel: Integration """ loc_a = make_location() loc_b = make_location() Org.add_location({ 'location-id': loc_a['id'], 'name': self.org['name'] }) Org.add_location({'location': loc_b['name'], 'name': self.org['name']}) org_info = Org.info({'id': self.org['id']}) self.assertEqual(len(org_info['locations']), 2, "Failed to add locations") self.assertIn(loc_a['name'], org_info['locations']) self.assertIn(loc_b['name'], org_info['locations']) Org.remove_location({'location-id': loc_a['id'], 'id': self.org['id']}) Org.remove_location({'location': loc_b['name'], 'id': self.org['id']}) org_info = Org.info({'id': self.org['id']}) self.assertNotIn('locations', org_info, "Failed to remove locations")
def setUpClass(cls): super(EC2ComputeResourceTestCase, cls).setUpClass() cls.org = make_org() cls.loc = make_location() Org.add_location({'id': cls.org['id'], 'location-id': cls.loc['id']}) cls.aws_access_key = settings.ec2.access_key cls.aws_secret_key = settings.ec2.secret_key cls.aws_region = settings.ec2.region cls.aws_image = settings.ec2.image cls.aws_availability_zone = settings.ec2.availability_zone cls.aws_subnet = settings.ec2.subnet cls.aws_security_groups = settings.ec2.security_groups cls.aws_managed_ip = settings.ec2.managed_ip
def aws(): aws = type('rhev', (object, ), {})() aws.org = make_org() aws.loc = make_location() Org.add_location({'id': aws.org['id'], 'location-id': aws.loc['id']}) aws.aws_access_key = settings.ec2.access_key aws.aws_secret_key = settings.ec2.secret_key aws.aws_region = settings.ec2.region aws.aws_image = settings.ec2.image aws.aws_availability_zone = settings.ec2.availability_zone aws.aws_subnet = settings.ec2.subnet aws.aws_security_groups = settings.ec2.security_groups aws.aws_managed_ip = settings.ec2.managed_ip return aws
def setUpClass(cls): super().setUpClass() cls.org = make_org() cls.loc = make_location() Org.add_location({'id': cls.org['id'], 'location-id': cls.loc['id']}) cls.vmware_server = settings.vmware.vcenter cls.vmware_password = settings.vmware.password cls.vmware_username = settings.vmware.username cls.vmware_datacenter = settings.vmware.datacenter cls.vmware_img_name = settings.vmware.image_name cls.vmware_img_arch = settings.vmware.image_arch cls.vmware_img_os = settings.vmware.image_os cls.vmware_img_user = settings.vmware.image_username cls.vmware_img_pass = settings.vmware.image_password cls.vmware_vm_name = settings.vmware.vm_name cls.current_interface = (VMWARE_CONSTANTS.get('network_interfaces') % settings.vlan_networking.bridge)
def test_positive_add_location_by_name(self): """Add a location to organization by its name @id: f39522e8-5280-429e-b954-79153c2c73c2 @Assert: Location is added to the org @CaseLevel: Integration """ org = make_org() loc = make_location() Org.add_location({ 'location': loc['name'], 'name': org['name'], }) result = Org.info({'id': org['id']}) self.assertEqual(len(result['locations']), 1) self.assertIn(loc['name'], result['locations'])
def test_positive_add_location_by_id(self): """Add a location to organization by its id @id: 83848f18-2cca-457c-af57-e6249386c81c @Assert: Location is added to the org @CaseLevel: Integration """ org = make_org() loc = make_location() Org.add_location({ 'location-id': loc['id'], 'name': org['name'], }) result = Org.info({'id': org['id']}) self.assertEqual(len(result['locations']), 1) self.assertIn(loc['name'], result['locations'])
def vmware(module_org, module_location): vmware = type('vmware', (object, ), {})() vmware.org = module_org vmware.loc = module_location Org.add_location({'id': vmware.org.id, 'location-id': vmware.loc.id}) vmware.vmware_server = settings.vmware.vcenter vmware.vmware_password = settings.vmware.password vmware.vmware_username = settings.vmware.username vmware.vmware_datacenter = settings.vmware.datacenter vmware.vmware_img_name = settings.vmware.image_name vmware.vmware_img_arch = settings.vmware.image_arch vmware.vmware_img_os = settings.vmware.image_os vmware.vmware_img_user = settings.vmware.image_username vmware.vmware_img_pass = settings.vmware.image_password vmware.vmware_vm_name = settings.vmware.vm_name vmware.current_interface = (VMWARE_CONSTANTS.get('network_interfaces') % settings.vlan_networking.bridge) return vmware
def setUpClass(cls): super(VMWareComputeResourceTestCase, cls).setUpClass() cls.org = make_org() cls.loc = make_location() Org.add_location({'id': cls.org['id'], 'location-id': cls.loc['id']}) cls.vmware_server = settings.vmware.vcenter cls.vmware_password = settings.vmware.password cls.vmware_username = settings.vmware.username cls.vmware_datacenter = settings.vmware.datacenter cls.vmware_img_name = settings.vmware.image_name cls.vmware_img_arch = settings.vmware.image_arch cls.vmware_img_os = settings.vmware.image_os cls.vmware_img_user = settings.vmware.image_username cls.vmware_img_pass = settings.vmware.image_password cls.vmware_vm_name = settings.vmware.vm_name cls.current_interface = ( VMWARE_CONSTANTS.get( 'network_interfaces') % settings.vlan_networking.bridge )
def test_positive_add_and_remove_locations(self): """Add and remove a locations from organization :id: 37b63e5c-8fd5-439c-9540-972b597b590a :expectedresults: Locations are handled :BZ: 1395229, 1473387 :steps: 1. add and remove locations by name 2. add and remove locations by id :CaseLevel: Integration """ org = make_org() loc_a = make_location() loc_b = make_location() Org.add_location({ 'location-id': loc_a['id'], 'name': org['name'], }) Org.add_location({ 'location': loc_b['name'], 'name': org['name'], }) org_info = Org.info({'id': org['id']}) self.assertEqual(len(org_info['locations']), 2, "Failed to add locations") self.assertIn(loc_a['name'], org_info['locations']) self.assertIn(loc_b['name'], org_info['locations']) Org.remove_location({ 'location-id': loc_a['id'], 'id': org['id'], }) Org.remove_location({ 'location': loc_b['name'], 'id': org['id'], }) org_info = Org.info({'id': org['id']}) self.assertNotIn('locations', org_info, "Failed to remove locations")
def test_positive_remove_location_by_name(self): """Remove a location from organization by its name @id: 35770afa-1623-448c-af4f-a702851063db @Assert: Location is removed from the org @CaseLevel: Integration """ org = make_org() loc = make_location() Org.add_location({ 'location': loc['name'], 'name': org['name'], }) result = Org.info({'id': org['id']}) self.assertEqual(len(result['locations']), 1) self.assertIn(loc['name'], result['locations']) Org.remove_location({ 'location': loc['name'], 'id': org['id'], }) result = Org.info({'id': org['id']}) self.assertEqual(len(result['locations']), 0)
def test_positive_remove_location_by_id(self): """Remove a location from organization by its id @id: 37b63e5c-8fd5-439c-9540-972b597b590a @Assert: Location is removed from the org @CaseLevel: Integration """ org = make_org() loc = make_location() Org.add_location({ 'location-id': loc['id'], 'name': org['name'], }) result = Org.info({'id': org['id']}) self.assertEqual(len(result['locations']), 1) self.assertIn(loc['name'], result['locations']) Org.remove_location({ 'location-id': loc['id'], 'id': org['id'], }) result = Org.info({'id': org['id']}) self.assertEqual(len(result['locations']), 0)