示例#1
0
    def test_positive_create_update_delete_domain(self):
        """Create domain, update and delete domain and set parameters

        :id: 018740bf-1551-4162-b88e-4d4905af097b

        :expectedresults: Domain successfully created, updated and deleted


        :CaseImportance: Critical
        """
        options = valid_create_params()[0]
        location = make_location()
        org = make_org()
        domain = make_domain({
            u'name': options['name'],
            u'description': options['description'],
            u'location-ids': location['id'],
            u'organization-ids': org['id']
        })
        self.assertEqual(domain['name'], options['name'])
        self.assertEqual(domain['description'], options['description'])
        self.assertIn(location['name'], domain['locations'])
        self.assertIn(org['name'], domain['organizations'])

        # set parameter
        parameter_options = valid_set_params()[0]
        parameter_options['domain-id'] = domain['id']
        Domain.set_parameter(parameter_options)
        domain = Domain.info({'id': domain['id']})
        parameter = {
            # Satellite applies lower to parameter's name
            parameter_options['name'].lower():
            parameter_options['value'],
        }
        self.assertDictEqual(parameter, domain['parameters'])

        # update domain
        options = valid_update_params()[0]
        Domain.update(dict(options, id=domain['id']))
        # check - domain updated
        domain = Domain.info({'id': domain['id']})
        for key, val in options.items():
            self.assertEqual(domain[key], val)

        # delete parameter
        Domain.delete_parameter({
            u'name': parameter_options['name'],
            u'domain-id': domain['id'],
        })
        # check - parameter not set
        domain = Domain.info({'name': domain['name']})
        self.assertEqual(len(domain['parameters']), 0)

        # delete domain
        Domain.delete({'id': domain['id']})
        with self.assertRaises(CLIReturnCodeError):
            Domain.info({'id': domain['id']})
示例#2
0
    def test_positive_delete_parameter(self, options):
        """@Test: Domain delete-parameter removes parameter

        @Feature: Domain positive delete-parameter

        @Assert: Domain parameter is removed

        """
        try:
            domain = make_domain()
        except CLIFactoryError as err:
            self.fail(err)

        options['domain'] = domain['name']
        result = Domain.set_parameter(options)
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        result = Domain.delete_parameter({
            u'name': options['name'],
            u'domain-id': domain['id']
        })
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        # check - parameter not set
        result = Domain.info({'name': domain['name']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stdout['parameters']), 0)
示例#3
0
    def test_positive_delete_parameter(self, options):
        """@Test: Domain delete-parameter removes parameter

        @Feature: Domain positive delete-parameter

        @Assert: Domain parameter is removed

        """
        try:
            domain = make_domain()
        except CLIFactoryError as err:
            self.fail(err)

        options['domain'] = domain['name']
        result = Domain.set_parameter(options)
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        result = Domain.delete_parameter({
            u'name': options['name'],
            u'domain-id': domain['id']
        })
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        # check - parameter not set
        result = Domain.info({'name': domain['name']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stdout['parameters']), 0)
示例#4
0
    def test_positive_delete_parameter(self, options):
        """@Test: Domain delete-parameter removes parameter

        @Feature: Domain positive delete-parameter

        @Assert: Domain parameter is removed

        """
        domain = make_domain()
        options['domain'] = domain['name']
        Domain.set_parameter(options)
        Domain.delete_parameter({
            u'name': options['name'],
            u'domain-id': domain['id'],
        })
        # check - parameter not set
        domain = Domain.info({'name': domain['name']})
        self.assertEqual(len(domain['parameters']), 0)
示例#5
0
    def test_positive_delete_parameter(self):
        """Domain delete-parameter removes parameter

        @id: 481afe1c-0b9e-435f-a581-159d9619291c

        @Assert: Domain parameter is removed

        """
        for options in valid_delete_params():
            with self.subTest(options):
                domain = make_domain()
                options['domain'] = domain['name']
                Domain.set_parameter(options)
                Domain.delete_parameter({
                    u'name': options['name'],
                    u'domain-id': domain['id'],
                })
                # check - parameter not set
                domain = Domain.info({'name': domain['name']})
                self.assertEqual(len(domain['parameters']), 0)
示例#6
0
    def test_positive_delete_parameter(self):
        """Domain delete-parameter removes parameter

        @id: 481afe1c-0b9e-435f-a581-159d9619291c

        @Assert: Domain parameter is removed

        """
        for options in valid_delete_params():
            with self.subTest(options):
                domain = make_domain()
                options['domain'] = domain['name']
                Domain.set_parameter(options)
                Domain.delete_parameter({
                    u'name': options['name'],
                    u'domain-id': domain['id'],
                })
                # check - parameter not set
                domain = Domain.info({'name': domain['name']})
                self.assertEqual(len(domain['parameters']), 0)