Exemplo n.º 1
0
    def test_positive_update(self, options):
        """@Test: Update domain with valid values

        @Feature: Domain positive update

        @Assert: Domain is updated

        """
        try:
            domain = make_domain({
                u'description': gen_string(str_type='utf8')
            })
        except CLIFactoryError as err:
            self.fail(err)

        # update description
        result = Domain.update(dict(options, id=domain['id']))
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        # check - domain updated
        result = Domain.info({'id': domain['id']})
        self.assertEqual(result.return_code, 0)
        for key, val in options.iteritems():
            self.assertEqual(result.stdout[key], val)
Exemplo n.º 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)
Exemplo n.º 3
0
    def test_positive_set_parameter(self, options):
        """@Test: Domain set-parameter with valid key and value

        @Feature: Domain positive set-parameter

        @Assert: Domain parameter is set

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

        options['domain-id'] = domain['id']
        # set parameter
        result = Domain.set_parameter(options)
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        # check - parameter set
        result = Domain.info({'id': domain['id']})
        self.assertEqual(result.return_code, 0)

        parameter = {
            # Sattelite applies lower to parameter's name
            options['name'].lower(): options['value'],
        }
        self.assertDictEqual(parameter, result.stdout['parameters'])
Exemplo n.º 4
0
    def test_positive_set_parameter(self, options):
        """@Test: Domain set-parameter with valid key and value

        @Feature: Domain positive set-parameter

        @Assert: Domain parameter is set

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

        options['domain-id'] = domain['id']
        # set parameter
        result = Domain.set_parameter(options)
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        # check - parameter set
        result = Domain.info({'id': domain['id']})
        self.assertEqual(result.return_code, 0)

        parameter = {
            # Sattelite applies lower to parameter's name
            options['name'].lower(): options['value'],
        }
        self.assertDictEqual(parameter, result.stdout['parameters'])
Exemplo n.º 5
0
    def test_positive_update(self, options):
        """@Test: Update domain with valid values

        @Feature: Domain positive update

        @Assert: Domain is updated

        """
        try:
            domain = make_domain({
                u'description': gen_string(str_type='utf8')
            })
        except CLIFactoryError as err:
            self.fail(err)

        # update description
        result = Domain.update(dict(options, id=domain['id']))
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        # check - domain updated
        result = Domain.info({'id': domain['id']})
        self.assertEqual(result.return_code, 0)
        for key, val in options.iteritems():
            self.assertEqual(result.stdout[key], val)
Exemplo n.º 6
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)
Exemplo n.º 7
0
    def test_negative_delete(self):
        """@test: Create Domain then delete it by wrong ID

        @feature: Domain

        @assert: Domain is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Domain.delete({'id': entity_id})
Exemplo n.º 8
0
    def test_negative_delete_by_id(self):
        """Create Domain then delete it by wrong ID

        @feature: Domain

        @assert: Domain is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Domain.delete({'id': entity_id})
Exemplo n.º 9
0
    def test_negative_delete_by_id(self):
        """Create Domain then delete it by wrong ID

        @id: 0e4ef107-f006-4433-abc3-f872613e0b91

        @assert: Domain is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Domain.delete({'id': entity_id})
Exemplo n.º 10
0
    def test_negative_delete_by_id(self):
        """Create Domain then delete it by wrong ID

        @id: 0e4ef107-f006-4433-abc3-f872613e0b91

        @assert: Domain is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Domain.delete({'id': entity_id})
Exemplo n.º 11
0
    def test_negative_delete_by_id(self):
        """Create Domain then delete it by wrong ID

        :id: 0e4ef107-f006-4433-abc3-f872613e0b91

        :expectedresults: Domain is not deleted

        :CaseImportance: Critical
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Domain.delete({'id': entity_id})
Exemplo n.º 12
0
    def test_negative_delete_by_id(self):
        """Create Domain then delete it by wrong ID

        :id: 0e4ef107-f006-4433-abc3-f872613e0b91

        :expectedresults: Domain is not deleted

        :CaseImportance: Critical
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Domain.delete({'id': entity_id})
Exemplo n.º 13
0
def test_negative_delete_by_id(entity_id):
    """Create Domain then delete it by wrong ID

    :id: 0e4ef107-f006-4433-abc3-f872613e0b91

    :parametrized: yes

    :expectedresults: Domain is not deleted

    :CaseImportance: Medium
    """
    with pytest.raises(CLIReturnCodeError):
        Domain.delete({'id': entity_id})
Exemplo n.º 14
0
    def test_positive_delete_by_id(self):
        """Create Domain with valid values then delete it
        by ID

        @id: b50a5daa-67f8-4ecd-8e03-2a3c492d3c25

        @assert: Domain is deleted
        """
        for name in valid_data_list():
            with self.subTest(name):
                domain = make_domain({'name': name})
                Domain.delete({'id': domain['id']})
                with self.assertRaises(CLIReturnCodeError):
                    Domain.info({'id': domain['id']})
Exemplo n.º 15
0
    def test_positive_delete_by_id(self):
        """Create Domain with valid values then delete it
        by ID

        @id: b50a5daa-67f8-4ecd-8e03-2a3c492d3c25

        @assert: Domain is deleted
        """
        for name in valid_data_list():
            with self.subTest(name):
                domain = make_domain({'name': name})
                Domain.delete({'id': domain['id']})
                with self.assertRaises(CLIReturnCodeError):
                    Domain.info({'id': domain['id']})
Exemplo n.º 16
0
    def test_positive_delete(self):
        """@test: Create Domain with valid values then delete it
        by ID

        @feature: Domain

        @assert: Domain is deleted
        """
        for name in valid_data_list():
            with self.subTest(name):
                domain = make_domain({'name': name})
                Domain.delete({'id': domain['id']})
                with self.assertRaises(CLIReturnCodeError):
                    Domain.info({'id': domain['id']})
Exemplo n.º 17
0
    def test_negative_update(self, options):
        """@Test: Update domain with invalid values

        @Feature: Domain negative update

        @Assert: Domain is not updated

        """
        domain = make_domain()
        # update description
        with self.assertRaises(CLIReturnCodeError):
            Domain.update(dict(options, id=domain['id']))
        # check - domain not updated
        result = Domain.info({'id': domain['id']})
        for key in options.keys():
            self.assertEqual(result[key], domain[key])
Exemplo n.º 18
0
    def test_negative_set_parameter(self, options):
        """@Test: Domain set-parameter with invalid values

        @Feature: Domain negative set-parameter

        @Assert: Domain parameter is not set

        """
        domain = make_domain()
        options['domain-id'] = domain['id']
        # set parameter
        with self.assertRaises(CLIReturnCodeError):
            Domain.set_parameter(options)
        # check - parameter not set
        domain = Domain.info({'id': domain['id']})
        self.assertEqual(len(domain['parameters']), 0)
Exemplo n.º 19
0
def test_negative_update(module_domain, options):
    """Update domain with invalid values

    :id: 9fc708dc-20f9-4d7c-af53-863826462981

    :parametrized: yes

    :expectedresults: Domain is not updated

    :CaseImportance: Medium
    """
    with pytest.raises(CLIReturnCodeError):
        Domain.update(dict(options, id=module_domain.id))
    # check - domain not updated
    result = Domain.info({'id': module_domain.id})
    for key in options.keys():
        assert result[key] == getattr(module_domain, key)
Exemplo n.º 20
0
    def test_positive_update(self, options):
        """@Test: Update domain with valid values

        @Feature: Domain positive update

        @Assert: Domain is updated

        """
        domain = make_domain({
            u'description': gen_string(str_type='utf8')
        })
        # update description
        Domain.update(dict(options, id=domain['id']))
        # check - domain updated
        domain = Domain.info({'id': domain['id']})
        for key, val in options.iteritems():
            self.assertEqual(domain[key], val)
Exemplo n.º 21
0
    def test_positive_update(self):
        """Update domain with valid values

        @id: 9da3cc96-c146-4f82-bb25-b237a367ba91

        @Assert: Domain is updated

        """
        domain = make_domain({u'description': gen_string(str_type='utf8')})
        for options in valid_update_params():
            with self.subTest(options):
                # update description
                Domain.update(dict(options, id=domain['id']))
                # check - domain updated
                domain = Domain.info({'id': domain['id']})
                for key, val in options.iteritems():
                    self.assertEqual(domain[key], val)
Exemplo n.º 22
0
    def test_negative_update(self):
        """Update domain with invalid values

        @id: 9fc708dc-20f9-4d7c-af53-863826462981

        @Assert: Domain is not updated

        """
        domain = make_domain()
        for options in invalid_update_params():
            with self.subTest(options):
                with self.assertRaises(CLIReturnCodeError):
                    Domain.update(dict(options, id=domain['id']))
                # check - domain not updated
                result = Domain.info({'id': domain['id']})
                for key in options.keys():
                    self.assertEqual(result[key], domain[key])
Exemplo n.º 23
0
    def test_negative_update(self):
        """Update domain with invalid values

        @id: 9fc708dc-20f9-4d7c-af53-863826462981

        @Assert: Domain is not updated

        """
        domain = make_domain()
        for options in invalid_update_params():
            with self.subTest(options):
                with self.assertRaises(CLIReturnCodeError):
                    Domain.update(dict(options, id=domain['id']))
                # check - domain not updated
                result = Domain.info({'id': domain['id']})
                for key in options.keys():
                    self.assertEqual(result[key], domain[key])
Exemplo n.º 24
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)
Exemplo n.º 25
0
    def test_negative_set_parameter(self):
        """Domain set-parameter with invalid values

        @id: 991fb849-83be-48f4-a12b-81eabb2bd8d3

        @Assert: Domain parameter is not set

        """
        domain = make_domain()
        for options in invalid_set_params():
            with self.subTest(options):
                options['domain-id'] = domain['id']
                # set parameter
                with self.assertRaises(CLIReturnCodeError):
                    Domain.set_parameter(options)
                # check - parameter not set
                domain = Domain.info({'id': domain['id']})
                self.assertEqual(len(domain['parameters']), 0)
Exemplo n.º 26
0
    def test_negative_set_parameter(self):
        """Domain set-parameter with invalid values

        @id: 991fb849-83be-48f4-a12b-81eabb2bd8d3

        @Assert: Domain parameter is not set

        """
        domain = make_domain()
        for options in invalid_set_params():
            with self.subTest(options):
                options['domain-id'] = domain['id']
                # set parameter
                with self.assertRaises(CLIReturnCodeError):
                    Domain.set_parameter(options)
                # check - parameter not set
                domain = Domain.info({'id': domain['id']})
                self.assertEqual(len(domain['parameters']), 0)
Exemplo n.º 27
0
def test_negative_set_parameter(module_domain, options):
    """Domain set-parameter with invalid values

    :id: 991fb849-83be-48f4-a12b-81eabb2bd8d3

    :parametrized: yes

    :expectedresults: Domain parameter is not set

    :CaseImportance: Low
    """
    options['domain-id'] = module_domain.id
    # set parameter
    with pytest.raises(CLIReturnCodeError):
        Domain.set_parameter(options)
    # check - parameter not set
    domain = Domain.info({'id': module_domain.id})
    assert len(domain['parameters']) == 0
Exemplo n.º 28
0
    def test_positive_set_parameter(self, options):
        """@Test: Domain set-parameter with valid key and value

        @Feature: Domain positive set-parameter

        @Assert: Domain parameter is set

        """
        domain = make_domain()
        options['domain-id'] = domain['id']
        # set parameter
        Domain.set_parameter(options)
        # check - parameter set
        domain = Domain.info({'id': domain['id']})
        parameter = {
            # Sattelite applies lower to parameter's name
            options['name'].lower(): options['value'],
        }
        self.assertDictEqual(parameter, domain['parameters'])
Exemplo n.º 29
0
    def test_positive_set_parameter(self):
        """@Test: Domain set-parameter with valid key and value

        @Feature: Domain positive set-parameter

        @Assert: Domain parameter is set

        """
        for options in valid_set_params():
            with self.subTest(options):
                domain = make_domain()
                options['domain-id'] = domain['id']
                Domain.set_parameter(options)
                domain = Domain.info({'id': domain['id']})
                parameter = {
                    # Satellite applies lower to parameter's name
                    options['name'].lower(): options['value'],
                }
                self.assertDictEqual(parameter, domain['parameters'])
Exemplo n.º 30
0
    def test_positive_update(self):
        """Update domain with valid values

        @id: 9da3cc96-c146-4f82-bb25-b237a367ba91

        @Assert: Domain is updated

        """
        domain = make_domain({
            u'description': gen_string(str_type='utf8')
        })
        for options in valid_update_params():
            with self.subTest(options):
                # update description
                Domain.update(dict(options, id=domain['id']))
                # check - domain updated
                domain = Domain.info({'id': domain['id']})
                for key, val in options.iteritems():
                    self.assertEqual(domain[key], val)
Exemplo n.º 31
0
    def test_positive_set_parameter(self):
        """Domain set-parameter with valid key and value

        @id: 62fea9f7-95e2-47f7-bf4b-415ea6fd72f8

        @Assert: Domain parameter is set

        """
        for options in valid_set_params():
            with self.subTest(options):
                domain = make_domain()
                options['domain-id'] = domain['id']
                Domain.set_parameter(options)
                domain = Domain.info({'id': domain['id']})
                parameter = {
                    # Satellite applies lower to parameter's name
                    options['name'].lower():
                    options['value'],
                }
                self.assertDictEqual(parameter, domain['parameters'])
Exemplo n.º 32
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)
Exemplo n.º 33
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)
Exemplo n.º 34
0
    def test_positive_set_parameter(self):
        """Domain set-parameter with valid key and value

        :id: 62fea9f7-95e2-47f7-bf4b-415ea6fd72f8

        :expectedresults: Domain parameter is set


        :CaseImportance: Critical
        """
        for options in valid_set_params():
            with self.subTest(options):
                domain = make_domain()
                options['domain-id'] = domain['id']
                Domain.set_parameter(options)
                domain = Domain.info({'id': domain['id']})
                parameter = {
                    # Satellite applies lower to parameter's name
                    options['name'].lower(): options['value'],
                }
                self.assertDictEqual(parameter, domain['parameters'])
Exemplo n.º 35
0
    def test_negative_set_parameter(self, options):
        """@Test: Domain set-parameter with invalid values

        @Feature: Domain negative set-parameter

        @Assert: Domain parameter is not set

        """
        try:
            domain = make_domain()
        except CLIFactoryError as err:
            self.fail(err)
        options['domain-id'] = domain['id']
        # set parameter
        result = Domain.set_parameter(options)
        self.assertNotEqual(result.return_code, 0)
        self.assertNotEqual(len(result.stderr), 0)

        # check - parameter not set
        result = Domain.info({'id': domain['id']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stdout['parameters']), 0)
Exemplo n.º 36
0
    def test_negative_set_parameter(self, options):
        """@Test: Domain set-parameter with invalid values

        @Feature: Domain negative set-parameter

        @Assert: Domain parameter is not set

        """
        try:
            domain = make_domain()
        except CLIFactoryError as err:
            self.fail(err)
        options['domain-id'] = domain['id']
        # set parameter
        result = Domain.set_parameter(options)
        self.assertNotEqual(result.return_code, 0)
        self.assertNotEqual(len(result.stderr), 0)

        # check - parameter not set
        result = Domain.info({'id': domain['id']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stdout['parameters']), 0)
Exemplo n.º 37
0
    def test_negative_update(self, options):
        """@Test: Update domain with invalid values

        @Feature: Domain negative update

        @Assert: Domain is not updated

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

        # update description
        result = Domain.update(dict(options, id=domain['id']))
        self.assertNotEqual(result.return_code, 0)
        self.assertNotEqual(len(result.stderr), 0)

        # check - domain not updated
        result = Domain.info({'id': domain['id']})
        self.assertEqual(result.return_code, 0)
        for key in options.keys():
            self.assertEqual(result.stdout[key], domain[key])
Exemplo n.º 38
0
    def test_negative_update(self, options):
        """@Test: Update domain with invalid values

        @Feature: Domain negative update

        @Assert: Domain is not updated

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

        # update description
        result = Domain.update(dict(options, id=domain['id']))
        self.assertNotEqual(result.return_code, 0)
        self.assertNotEqual(len(result.stderr), 0)

        # check - domain not updated
        result = Domain.info({'id': domain['id']})
        self.assertEqual(result.return_code, 0)
        for key in options.keys():
            self.assertEqual(result.stdout[key], domain[key])
Exemplo n.º 39
0
 def _cleanup():
     if Domain.exists(search=('name', domain['name'])):
         Domain.delete(options={'id': domain['id']})
Exemplo n.º 40
0
def test_positive_create_update_delete_domain():
    """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({
        'name': options['name'],
        'description': options['description'],
        'location-ids': location['id'],
        'organization-ids': org['id'],
    })
    assert domain['name'] == options['name']
    assert domain['description'] == options['description']
    assert location['name'] in domain['locations']
    assert org['name'] in 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']
    }
    assert 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():
        assert domain[key] == val

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

    # delete domain
    Domain.delete({'id': domain['id']})
    with pytest.raises(CLIReturnCodeError):
        Domain.info({'id': domain['id']})