示例#1
0
    def test_positive_create_locked(self):
        """Check that locked Template cannot be created

        @Feature: Template - Create

        @Assert: It is not allowed to create locked Template
        """
        with self.assertRaises(CLIFactoryError):
            make_template({"locked": "true", "name": gen_string("alpha")})
    def test_negative_create_locked(self):
        """Check that locked Template cannot be created

        @Feature: Template - Create

        @Assert: It is not allowed to create locked Template
        """
        with self.assertRaises(CLIFactoryError):
            make_template({
                'locked': 'true',
                'name': gen_string('alpha'),
            })
示例#3
0
    def test_negative_create_locked(self):
        """Check that locked Template cannot be created

        @Feature: Template - Create

        @Assert: It is not allowed to create locked Template
        """
        with self.assertRaises(CLIFactoryError):
            make_template({
                'locked': 'true',
                'name': gen_string('alpha'),
            })
示例#4
0
    def test_positive_remove_template_by_id(self):
        """Remove a provisioning template from organization by its ID

        @Feature: Organization

        @Assert: Template is removed from the org
        """
        org = make_org()
        template = make_template({'content': gen_string('alpha')})
        # Add config-template
        Org.add_config_template({
            'config-template-id': template['id'],
            'id': org['id'],
        })
        result = Org.info({'id': org['id']})
        self.assertIn(
            u'{0} ({1})'. format(template['name'], template['type']),
            result['templates'],
        )
        # Remove config-template
        Org.remove_config_template({
            'config-template-id': template['id'],
            'id': org['id'],
        })
        result = Org.info({'id': org['id']})
        self.assertNotIn(
            u'{0} ({1})'. format(template['name'], template['type']),
            result['templates'],
        )
示例#5
0
    def test_positive_update_with_manager_role(self):
        """Create template providing the initial name, then update its name
        with manager user role.

        :id: 28c4357a-93cb-4b01-a445-5db50435bcc0

        :expectedresults: Provisioning Template is created, and its name can
            be updated.

        :CaseImportance: Critical

        :BZ: 1277308
        """
        new_name = gen_string('alpha')
        username = gen_string('alpha')
        password = gen_string('alpha')
        org = make_org()
        loc = make_location()
        template = make_template({
            'organization-ids': org['id'], 'location-ids': loc['id']})
        # Create user with Manager role
        user = make_user({
            'login': username,
            'password': password,
            'admin': False,
            'organization-ids': org['id'],
            'location-ids': loc['id'],
        })
        User.add_role({'id': user['id'], 'role': "Manager"})
        # Update template name with that user
        Template.with_user(username=username, password=password).update({
            'id': template['id'], 'name': new_name})
        template = Template.info({'id': template['id']})
        self.assertEqual(new_name, template['name'])
示例#6
0
    def test_remove_operating_system_1(self):
        """@Test: Check if OS can be removed Template

        @Feature: Template - Remove Operating System

        @Assert: Template no longer has an operating system

        """
        template = make_template()
        new_os = make_os()
        Template.add_operatingsystem({
            'id': template['id'],
            'operatingsystem-id': new_os['id'],
        })
        template = Template.info({'id': template['id']})
        os_string = '{0} {1}.{2}'.format(
            new_os['name'], new_os['major-version'], new_os['minor-version']
        )
        self.assertIn(os_string, template['operating-systems'])
        Template.remove_operatingsystem({
            'id': template['id'],
            'operatingsystem-id': new_os['id']
        })
        template = Template.info({'id': template['id']})
        self.assertNotIn(os_string, template['operating-systems'])
示例#7
0
    def test_add_configtemplate(self):
        """@test: Add configtemplate to os

        @feature: Operating System - Add comfigtemplate

        @assert: Operating System is updated with config template

        """

        conf_obj = make_template()

        result = Template.info({'id': conf_obj['id']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        self.assertEqual(conf_obj['name'], result.stdout['name'])

        new_obj = make_os()
        result = OperatingSys.add_config_template({
            'id':
            new_obj['id'],
            'config-template':
            conf_obj['name']
        })
        self.assertEqual(result.return_code, 0, "Failed to add configtemplate")
        self.assertEqual(len(result.stderr), 0,
                         "Should not have gotten an error")

        result = OperatingSys.info({'id': new_obj['id']})
        self.assertEqual(result.return_code, 0, "Failed to find object")
        self.assertEqual(len(result.stdout['templates']), 1)
        template_name = result.stdout['templates'][0]
        self.assertTrue(template_name.startswith(conf_obj['name']))
示例#8
0
    def test_positive_remove_template_by_name(self):
        """ARemove a provisioning template from organization by its name

        @Feature: Organization

        @Assert: Template is removed from the org
        """
        for name in valid_data_list():
            with self.subTest(name):
                org = make_org()
                template = make_template({
                    'content': gen_string('alpha'),
                    'name': name,
                })
                # Add config-template
                Org.add_config_template({
                    'name': org['name'],
                    'config-template': template['name'],
                })
                result = Org.info({'name': org['name']})
                self.assertIn(
                    u'{0} ({1})'. format(template['name'], template['type']),
                    result['templates'],
                )
                # Remove config-template
                Org.remove_config_template({
                    'config-template': template['name'],
                    'name': org['name'],
                })
                result = Org.info({'name': org['name']})
                self.assertNotIn(
                    u'{0} ({1})'. format(template['name'], template['type']),
                    result['templates'],
                )
示例#9
0
    def test_positive_remove_template_by_id(self):
        """Remove a provisioning template from organization by its ID

        @Feature: Organization

        @Assert: Template is removed from the org
        """
        org = make_org()
        template = make_template({'content': gen_string('alpha')})
        # Add config-template
        Org.add_config_template({
            'config-template-id': template['id'],
            'id': org['id'],
        })
        result = Org.info({'id': org['id']})
        self.assertIn(
            u'{0} ({1})'. format(template['name'], template['type']),
            result['templates'],
        )
        # Remove config-template
        Org.remove_config_template({
            'config-template-id': template['id'],
            'id': org['id'],
        })
        result = Org.info({'id': org['id']})
        self.assertNotIn(
            u'{0} ({1})'. format(template['name'], template['type']),
            result['templates'],
        )
示例#10
0
    def test_positive_remove_template_by_id(self):
        """Remove a provisioning template from organization by its ID

        @id: 8f3e05c2-6c0d-48a6-a311-41ad032b7977

        @Assert: Template is removed from the org

        @CaseLevel: Integration
        """
        org = make_org()
        template = make_template({'content': gen_string('alpha')})
        # Add config-template
        Org.add_config_template({
            'config-template-id': template['id'],
            'id': org['id'],
        })
        result = Org.info({'id': org['id']})
        self.assertIn(
            u'{0} ({1})'. format(template['name'], template['type']),
            result['templates'],
        )
        # Remove config-template
        Org.remove_config_template({
            'config-template-id': template['id'],
            'id': org['id'],
        })
        result = Org.info({'id': org['id']})
        self.assertNotIn(
            u'{0} ({1})'. format(template['name'], template['type']),
            result['templates'],
        )
示例#11
0
    def test_positive_add_template_by_name(self):
        """Add a provisioning template to organization by its name

        @id: bd46a192-488f-4da0-bf47-1f370ae5f55c

        @Assert: Template is added to the org

        @CaseLevel: Integration
        """
        for name in valid_data_list():
            with self.subTest(name):
                org = make_org()
                template = make_template({
                    'content': gen_string('alpha'),
                    'name': name,
                })
                Org.add_config_template({
                    'config-template': template['name'],
                    'name': org['name'],
                })
                org = Org.info({'name': org['name']})
                self.assertIn(
                    u'{0} ({1})'. format(template['name'], template['type']),
                    org['templates']
                )
示例#12
0
    def test_delete_template_1(self):
        """
        @Test: Check if Template can be deleted
        @Feature: Template - Delete
        @Assert: Template is deleted
        @BZ: 1096333
        """

        content = generate_string("alpha", 10)
        name = generate_string("alpha", 10)

        new_obj = make_template({
            'name': name,
            'content': content,
        })

        result = Template.info({'id': new_obj['id']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        self.assertEqual(new_obj['name'], result.stdout['name'])

        Template.delete({'id': new_obj['id']})

        result = Template.info({'id': new_obj['id']})
        self.assertNotEqual(result.return_code, 0)
        self.assertGreater(len(result.stderr), 0)
示例#13
0
    def test_positive_remove_template_by_name(self):
        """ARemove a provisioning template from organization by its name

        @Feature: Organization

        @Assert: Template is removed from the org
        """
        for name in valid_data_list():
            with self.subTest(name):
                org = make_org()
                template = make_template({
                    'content': gen_string('alpha'),
                    'name': name,
                })
                # Add config-template
                Org.add_config_template({
                    'name': org['name'],
                    'config-template': template['name'],
                })
                result = Org.info({'name': org['name']})
                self.assertIn(
                    u'{0} ({1})'. format(template['name'], template['type']),
                    result['templates'],
                )
                # Remove config-template
                Org.remove_config_template({
                    'config-template': template['name'],
                    'name': org['name'],
                })
                result = Org.info({'name': org['name']})
                self.assertNotIn(
                    u'{0} ({1})'. format(template['name'], template['type']),
                    result['templates'],
                )
示例#14
0
    def test_positive_update_with_manager_role(self):
        """Create template providing the initial name, then update its name
        with manager user role.

        :id: 28c4357a-93cb-4b01-a445-5db50435bcc0

        :expectedresults: Provisioning Template is created, and its name can
            be updated.

        :CaseImportance: Critical

        :BZ: 1277308
        """
        new_name = gen_string('alpha')
        username = gen_string('alpha')
        password = gen_string('alpha')
        org = make_org()
        loc = make_location()
        template = make_template({
            'organization-ids': org['id'], 'location-ids': loc['id']})
        # Create user with Manager role
        user = make_user({
            'login': username,
            'password': password,
            'admin': False,
            'organization-ids': org['id'],
            'location-ids': loc['id'],
        })
        User.add_role({'id': user['id'], 'role': "Manager"})
        # Update template name with that user
        Template.with_user(username=username, password=password).update({
            'id': template['id'], 'name': new_name})
        template = Template.info({'id': template['id']})
        self.assertEqual(new_name, template['name'])
示例#15
0
    def test_update_template_1(self):
        """@Test: Check if Template can be updated

        @Feature: Template - Update

        @Assert: Template is updated

        """

        content = generate_string("alpha", 10)
        name = generate_string("alpha", 10)

        try:
            new_obj = make_template(
                {
                    'name': name,
                    'content': content,
                }
            )
        except CLIFactoryError as e:
            self.fail(e)

        result = Template.info({'id': new_obj['id']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        self.assertEqual(new_obj['name'], result.stdout['name'])

        updated_name = generate_string("alpha", 10)
        Template.update({'id': new_obj['id'], 'name': updated_name})
        result = Template.info({'id': new_obj['id']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        self.assertEqual(updated_name, result.stdout['name'])
示例#16
0
    def test_add_configtemplate(self):
        """@test: Add configtemplate to os

        @feature: Operating System - Add comfigtemplate

        @assert: Operating System is updated with config template

        """

        conf_obj = make_template()

        result = Template.info({'id': conf_obj['id']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        self.assertEqual(conf_obj['name'], result.stdout['name'])

        new_obj = make_os()
        result = OperatingSys.add_config_template(
            {'id': new_obj['id'],
             'config-template': conf_obj['name']})
        self.assertEqual(result.return_code, 0, "Failed to add configtemplate")
        self.assertEqual(
            len(result.stderr), 0, "Should not have gotten an error")

        result = OperatingSys.info({'id': new_obj['id']})
        self.assertEqual(result.return_code, 0, "Failed to find object")
        self.assertEqual(len(result.stdout['templates']), 1)
        template_name = result.stdout['templates'][0]
        self.assertTrue(template_name.startswith(conf_obj['name']))
示例#17
0
    def test_add_operating_system_1(self):
        """@Test: Check if Template can be assigned operating system

        @Feature: Template - Add Operating System

        @Assert: Template has an operating system

        """

        content = gen_string("alpha", 10)
        name = gen_string("alpha", 10)

        try:
            new_template = make_template({
                'name': name,
                'content': content,
            })
            new_os = make_os()
        except CLIFactoryError as err:
            self.fail(err)

        result = Template.add_operatingsystem({
            "id": new_template["id"],
            "operatingsystem-id": new_os["id"],
        })
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        result = Template.info({'id': new_template['id']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        os_string = '{0} {1}.{2}'.format(
            new_os['name'], new_os['major-version'], new_os['minor-version']
        )
        self.assertIn(os_string, result.stdout['operating-systems'])
示例#18
0
def test_positive_remove_os_by_id(module_os_with_minor):
    """Check if operating system can be removed from a template

    :id: b5362565-6dce-4770-81e1-4fe3ec6f6cee

    :expectedresults: Operating system is removed from template

    :CaseLevel: Integration

    :CaseImportance: Medium

    :BZ: 1395229
    """
    template = make_template()
    Template.add_operatingsystem(
        {'id': template['id'], 'operatingsystem-id': module_os_with_minor.id}
    )
    template = Template.info({'id': template['id']})
    os_string = (
        f'{module_os_with_minor.name} {module_os_with_minor.major}.{module_os_with_minor.minor}'
    )
    assert os_string in template['operating-systems']
    Template.remove_operatingsystem(
        {'id': template['id'], 'operatingsystem-id': module_os_with_minor.id}
    )
    template = Template.info({'id': template['id']})
    assert os_string not in template['operating-systems']
示例#19
0
    def test_positive_remove_template_by_id(self):
        """Remove a provisioning template from organization by its ID

        @id: 8f3e05c2-6c0d-48a6-a311-41ad032b7977

        @Assert: Template is removed from the org

        @CaseLevel: Integration
        """
        org = make_org()
        template = make_template({'content': gen_string('alpha')})
        # Add config-template
        Org.add_config_template({
            'config-template-id': template['id'],
            'id': org['id'],
        })
        result = Org.info({'id': org['id']})
        self.assertIn(
            u'{0} ({1})'. format(template['name'], template['type']),
            result['templates'],
        )
        # Remove config-template
        Org.remove_config_template({
            'config-template-id': template['id'],
            'id': org['id'],
        })
        result = Org.info({'id': org['id']})
        self.assertNotIn(
            u'{0} ({1})'. format(template['name'], template['type']),
            result['templates'],
        )
示例#20
0
    def test_positive_remove_os_by_id(self):
        """Check if operating system can be removed from a template

        :id: b5362565-6dce-4770-81e1-4fe3ec6f6cee

        :expectedresults: Operating system is removed from template

        :CaseLevel: Integration
        """
        template = make_template()
        new_os = make_os()
        Template.add_operatingsystem({
            'id': template['id'],
            'operatingsystem-id': new_os['id'],
        })
        template = Template.info({'id': template['id']})
        os_string = '{0} {1}.{2}'.format(
            new_os['name'], new_os['major-version'], new_os['minor-version']
        )
        self.assertIn(os_string, template['operating-systems'])
        Template.remove_operatingsystem({
            'id': template['id'],
            'operatingsystem-id': new_os['id']
        })
        template = Template.info({'id': template['id']})
        self.assertNotIn(os_string, template['operating-systems'])
示例#21
0
    def test_dump_template_1(self):
        """@Test: Check if Template can be created with specific content

        @Feature: Template - Create

        @Assert: Template is created with specific content

        """

        content = generate_string("alpha", 10)
        name = generate_string("alpha", 10)

        new_obj = make_template(
            {
                'name': name,
                'content': content,
            }
        )

        result = Template.info({'id': new_obj['id']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        self.assertEqual(new_obj['name'], result.stdout['name'])

        template_content = Template.dump({'id': new_obj['id']})
        self.assertIn(content, template_content.stdout[0])
示例#22
0
    def test_delete_template_1(self):
        """@Test: Check if Template can be deleted

        @Feature: Template - Delete

        @Assert: Template is deleted

        @BZ: 1096333

        """

        content = generate_string("alpha", 10)
        name = generate_string("alpha", 10)

        new_obj = make_template(
            {
                'name': name,
                'content': content,
            }
        )

        result = Template.info({'id': new_obj['id']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        self.assertEqual(new_obj['name'], result.stdout['name'])

        Template.delete({'id': new_obj['id']})

        result = Template.info({'id': new_obj['id']})
        self.assertNotEqual(result.return_code, 0)
        self.assertGreater(len(result.stderr), 0)
示例#23
0
    def test_positive_remove_os_by_id(self):
        """Check if operating system can be removed from a template

        @id: b5362565-6dce-4770-81e1-4fe3ec6f6cee

        @Assert: Operating system is removed from template

        @CaseLevel: Integration
        """
        template = make_template()
        new_os = make_os()
        Template.add_operatingsystem({
            'id': template['id'],
            'operatingsystem-id': new_os['id'],
        })
        template = Template.info({'id': template['id']})
        os_string = '{0} {1}.{2}'.format(
            new_os['name'], new_os['major-version'], new_os['minor-version']
        )
        self.assertIn(os_string, template['operating-systems'])
        Template.remove_operatingsystem({
            'id': template['id'],
            'operatingsystem-id': new_os['id']
        })
        template = Template.info({'id': template['id']})
        self.assertNotIn(os_string, template['operating-systems'])
示例#24
0
def test_positive_update_with_manager_role(module_location, module_org):
    """Create template providing the initial name, then update its name
    with manager user role.

    :id: 28c4357a-93cb-4b01-a445-5db50435bcc0

    :expectedresults: Provisioning Template is created, and its name can
        be updated.

    :CaseImportance: Medium

    :BZ: 1277308
    """
    new_name = gen_string('alpha')
    username = gen_string('alpha')
    password = gen_string('alpha')
    template = make_template(
        {'organization-ids': module_org.id, 'location-ids': module_location.id}
    )
    # Create user with Manager role
    user = entities.User(
        login=username,
        password=password,
        admin=False,
        organization=[module_org.id],
        location=[module_location.id],
    ).create()
    User.add_role({'id': user.id, 'role': "Manager"})
    # Update template name with that user
    Template.with_user(username=username, password=password).update(
        {'id': template['id'], 'name': new_name}
    )
    template = Template.info({'id': template['id']})
    assert new_name == template['name']
示例#25
0
    def test_positive_add_template_by_name(self):
        """Add a provisioning template to organization by its name

        @id: bd46a192-488f-4da0-bf47-1f370ae5f55c

        @Assert: Template is added to the org

        @CaseLevel: Integration
        """
        for name in valid_data_list():
            with self.subTest(name):
                org = make_org()
                template = make_template({
                    'content': gen_string('alpha'),
                    'name': name,
                })
                Org.add_config_template({
                    'config-template': template['name'],
                    'name': org['name'],
                })
                org = Org.info({'name': org['name']})
                self.assertIn(
                    u'{0} ({1})'. format(template['name'], template['type']),
                    org['templates']
                )
示例#26
0
def _template(request):
    template = make_template()

    @request.addfinalizer
    def _cleanup():
        if Template.exists(search=('name', template['name'])):
            Template.delete(options={'id': template['id']})

    return template
示例#27
0
 def test_add_configtemplate(self):
     "Adds a configtemplate to an org"
     org_result = make_org()
     template_result = make_template()
     return_value = Org().add_configtemplate({
             'name': org_result['name'],
             'configtemplate': template_result['name']})
     self.assertTrue(return_value.return_code, 0)
     self.assertFalse(return_value.stderr)
示例#28
0
    def test_positive_add_and_remove_templates(self):
        """Add and remove provisioning templates to organization

        :id: bd46a192-488f-4da0-bf47-1f370ae5f55c

        :expectedresults: Templates are handled as expected

        :steps:
            1. Add and remove template by id
            2. Add and remove template by name

        :CaseLevel: Integration
        """
        # create and remove templates by name
        name = valid_data_list()[0]

        template = make_template({
            'content': gen_string('alpha'),
            'name': name,
        })
        # Add config-template
        Org.add_config_template({
            'name': self.org['name'],
            'config-template': template['name'],
        })
        org_info = Org.info({'name': self.org['name']})
        self.assertIn(u'{0} ({1})'.format(template['name'], template['type']),
                      org_info['templates'], "Failed to add template by name")
        # Remove config-template
        Org.remove_config_template({
            'config-template': template['name'],
            'name': self.org['name'],
        })
        org_info = Org.info({'name': self.org['name']})
        self.assertNotIn(
            u'{0} ({1})'.format(template['name'], template['type']),
            org_info['templates'], "Failed to remove template by name")

        # add and remove templates by id
        # Add config-template
        Org.add_config_template({
            'config-template-id': template['id'],
            'id': self.org['id'],
        })
        org_info = Org.info({'id': self.org['id']})
        self.assertIn(u'{0} ({1})'.format(template['name'], template['type']),
                      org_info['templates'], "Failed to add template by name")
        # Remove config-template
        Org.remove_config_template({
            'config-template-id': template['id'],
            'id': self.org['id'],
        })
        org_info = Org.info({'id': self.org['id']})
        self.assertNotIn(
            u'{0} ({1})'.format(template['name'], template['type']),
            org_info['templates'], "Failed to remove template by id")
示例#29
0
    def test_remove_operating_system_1(self):
        """@Test: Check if OS can be removed Template

        @Feature: Template - Remove Operating System

        @Assert: Template no longer has an operating system

        """

        content = generate_string("alpha", 10)
        name = generate_string("alpha", 10)

        try:
            new_obj = make_template(
                {
                    'name': name,
                    'content': content,
                }
            )
            new_os = make_os()
        except CLIFactoryError as e:
            self.fail(e)

        result = Template.add_operatingsystem(
            {
                "id": new_obj["id"],
                "operatingsystem-id": new_os["id"]
            }
        )
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        result = Template.info({'id': new_obj['id']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        os_string = "%s %s.%s" % (
            new_os['name'], new_os['major'], new_os['minor']
        )
        self.assertIn(os_string, result.stdout['operating-systems'])

        result = Template.remove_operatingsystem(
            {
                "id": new_obj["id"],
                "operatingsystem-id": new_os["id"]
            }
        )
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        result = Template.info({'id': new_obj['id']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        os_string = "%s %s.%s" % (
            new_os['name'], new_os['major'], new_os['minor']
        )
        self.assertNotIn(os_string, result.stdout['operating-systems'])
示例#30
0
    def test_positive_create_with_loc(self):
        """Check if Template with Location can be created

        @Feature: Template - Create

        @Assert: Template is created and new Location has been assigned
        """
        new_loc = make_location()
        new_template = make_template({'location-ids': new_loc['id']})
        self.assertIn(new_loc['name'], new_template['locations'])
示例#31
0
    def test_positive_create_with_loc(self):
        """Check if Template with Location can be created

        @Feature: Template - Create

        @Assert: Template is created and new Location has been assigned
        """
        new_loc = make_location()
        new_template = make_template({'location-ids': new_loc['id']})
        self.assertIn(new_loc['name'], new_template['locations'])
示例#32
0
    def test_positive_create_with_org(self):
        """Check if Template with Organization can be created

        @Feature: Template - Create

        @Assert: Template is created and new Organization has been assigned
        """
        new_org = make_org()
        new_template = make_template({"name": gen_string("alpha"), "organization-ids": new_org["id"]})
        self.assertIn(new_org["name"], new_template["organizations"])
示例#33
0
    def test_positive_create_with_name(self):
        """Check if Template can be created

        @Feature: Template - Create

        @Assert: Template is created
        """
        name = gen_string('alpha')
        template = make_template({'name': name})
        self.assertEqual(template['name'], name)
示例#34
0
    def test_positive_create_with_loc(self):
        """Check if Template with Location can be created

        @Feature: Template - Create

        @Assert: Template is created and new Location has been assigned
        """
        new_loc = make_location()
        new_template = make_template({"location-ids": new_loc["id"]})
        self.assertIn(new_loc["name"], new_template["locations"])
示例#35
0
    def test_positive_create_with_loc(self):
        """Check if Template with Location can be created

        @id: 263aba0e-4f54-4227-af97-f4bc8f5c0788

        @Assert: Template is created and new Location has been assigned
        """
        new_loc = make_location()
        new_template = make_template({'location-ids': new_loc['id']})
        self.assertIn(new_loc['name'], new_template['locations'])
示例#36
0
    def test_positive_create_with_name(self):
        """Check if Template can be created

        @id: 77deaae8-447b-47cc-8af3-8b17476c905f

        @Assert: Template is created
        """
        name = gen_string('alpha')
        template = make_template({'name': name})
        self.assertEqual(template['name'], name)
示例#37
0
    def test_positive_create_with_name(self):
        """Check if Template can be created

        @Feature: Template - Create

        @Assert: Template is created
        """
        name = gen_string('alpha')
        template = make_template({'name': name})
        self.assertEqual(template['name'], name)
示例#38
0
    def test_positive_delete_by_id(self):
        """Check if Template can be deleted

        @id: 8e5245ee-13dd-44d4-8111-d4382cacf005

        @Assert: Template is deleted
        """
        template = make_template()
        Template.delete({'id': template['id']})
        with self.assertRaises(CLIReturnCodeError):
            Template.info({'id': template['id']})
示例#39
0
    def test_positive_delete_by_id(self):
        """Check if Template can be deleted

        @Feature: Template - Delete

        @Assert: Template is deleted
        """
        template = make_template()
        Template.delete({'id': template['id']})
        with self.assertRaises(CLIReturnCodeError):
            Template.info({'id': template['id']})
示例#40
0
    def test_positive_delete_by_id(self):
        """Check if Template can be deleted

        @Feature: Template - Delete

        @Assert: Template is deleted
        """
        template = make_template()
        Template.delete({'id': template['id']})
        with self.assertRaises(CLIReturnCodeError):
            Template.info({'id': template['id']})
示例#41
0
    def test_positive_create_with_name(self):
        """Check if Template can be created

        :id: 77deaae8-447b-47cc-8af3-8b17476c905f

        :expectedresults: Template is created

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        template = make_template({'name': name})
        self.assertEqual(template['name'], name)
示例#42
0
def test_positive_add_and_remove_templates(module_org):
    """Add and remove provisioning templates to organization

    :id: bd46a192-488f-4da0-bf47-1f370ae5f55c

    :expectedresults: Templates are handled as expected

    :BZ: 1845860, 1886876

    :steps:
        1. Add and remove template by id
        2. Add and remove template by name

    :CaseLevel: Integration
    """
    # create and remove templates by name
    name = list(valid_data_list().values())[0]

    template = make_template({'content': gen_string('alpha'), 'name': name})
    # Add provisioning-template
    Org.add_provisioning_template({
        'name': module_org.name,
        'provisioning-template': template['name']
    })
    org_info = Org.info({'name': module_org.name})
    assert (f"{template['name']} ({template['type']})"
            in org_info['templates']), "Failed to add template by name"
    # Remove provisioning-template
    Org.remove_provisioning_template({
        'provisioning-template': template['name'],
        'name': module_org.name
    })
    org_info = Org.info({'name': module_org.name})
    assert (f"{template['name']} ({template['type']})"
            not in org_info['templates']), "Failed to remove template by name"

    # add and remove templates by id
    # Add provisioning-template
    Org.add_provisioning_template({
        'provisioning-template-id': template['id'],
        'id': module_org.id
    })
    org_info = Org.info({'id': module_org.id})
    assert (f"{template['name']} ({template['type']})"
            in org_info['templates']), "Failed to add template by name"
    # Remove provisioning-template
    Org.remove_provisioning_template({
        'provisioning-template-id': template['id'],
        'id': module_org.id
    })
    org_info = Org.info({'id': module_org.id})
    assert (f"{template['name']} ({template['type']})"
            not in org_info['templates']), "Failed to remove template by id"
示例#43
0
def test_positive_create_with_org(module_org):
    """Check if Template with Organization can be created

    :id: 5de5ca76-1a39-46ac-8dd4-5d41b4b49076

    :expectedresults: Template is created and new Organization has been
        assigned

    :CaseImportance: Medium
    """
    new_template = make_template({'name': gen_string('alpha'), 'organization-ids': module_org.id})
    assert module_org.name in new_template['organizations']
示例#44
0
def test_positive_create_with_name():
    """Check if Template can be created

    :id: 77deaae8-447b-47cc-8af3-8b17476c905f

    :expectedresults: Template is created

    :CaseImportance: Critical
    """
    name = gen_string('alpha')
    template = make_template({'name': name})
    assert template['name'] == name
示例#45
0
def test_positive_create_with_loc(module_location):
    """Check if Template with Location can be created

    :id: 263aba0e-4f54-4227-af97-f4bc8f5c0788

    :expectedresults: Template is created and new Location has been
        assigned

    :CaseImportance: Medium
    """
    new_template = make_template({'location-ids': module_location.id})
    assert module_location.name in new_template['locations']
示例#46
0
    def test_positive_update_name(self):
        """Check if Template can be updated

        @Feature: Template - Update

        @Assert: Template is updated
        """
        template = make_template()
        updated_name = gen_string("alpha")
        Template.update({"id": template["id"], "name": updated_name})
        template = Template.info({"id": template["id"]})
        self.assertEqual(updated_name, template["name"])
示例#47
0
def test_positive_create_locked():
    """Check that locked Template can be created

    :id: ff10e369-85c6-45f3-9cda-7e1c17a6632d

    :expectedresults: The locked template is created successfully


    :CaseImportance: Medium
    """
    new_template = make_template({'locked': 'true', 'name': gen_string('alpha')})
    assert new_template['locked'] == 'yes'
示例#48
0
    def test_positive_create_with_loc(self):
        """Check if Template with Location can be created

        :id: 263aba0e-4f54-4227-af97-f4bc8f5c0788

        :expectedresults: Template is created and new Location has been
            assigned

        :CaseImportance: Critical
        """
        new_loc = make_location()
        new_template = make_template({'location-ids': new_loc['id']})
        self.assertIn(new_loc['name'], new_template['locations'])
示例#49
0
    def test_positive_delete_by_id(self):
        """Check if Template can be deleted

        :id: 8e5245ee-13dd-44d4-8111-d4382cacf005

        :expectedresults: Template is deleted

        :CaseImportance: Critical
        """
        template = make_template()
        Template.delete({'id': template['id']})
        with self.assertRaises(CLIReturnCodeError):
            Template.info({'id': template['id']})
示例#50
0
    def test_positive_add_os_by_id(self):
        """Check if operating system can be added to a template

        @Feature: Template - Add Operating System

        @Assert: Operating system is added to the template
        """
        new_template = make_template()
        new_os = make_os()
        Template.add_operatingsystem({"id": new_template["id"], "operatingsystem-id": new_os["id"]})
        new_template = Template.info({"id": new_template["id"]})
        os_string = "{0} {1}.{2}".format(new_os["name"], new_os["major-version"], new_os["minor-version"])
        self.assertIn(os_string, new_template["operating-systems"])
示例#51
0
def test_positive_delete_by_id():
    """Check if Template can be deleted

    :id: 8e5245ee-13dd-44d4-8111-d4382cacf005

    :expectedresults: Template is deleted

    :CaseImportance: Critical
    """
    template = make_template()
    Template.delete({'id': template['id']})
    with pytest.raises(CLIReturnCodeError):
        Template.info({'id': template['id']})
示例#52
0
    def test_positive_create_locked(self):
        """Check that locked Template can be created

        @id: ff10e369-85c6-45f3-9cda-7e1c17a6632d

        @Assert: The locked template is created successfully

        """
        new_template = make_template({
            'locked': 'true',
            'name': gen_string('alpha'),
        })
        self.assertEqual(new_template['locked'], 'yes')
示例#53
0
    def test_positive_create_with_org(self):
        """Check if Template with Organization can be created

        @Feature: Template - Create

        @Assert: Template is created and new Organization has been assigned
        """
        new_org = make_org()
        new_template = make_template({
            'name': gen_string('alpha'),
            'organization-ids': new_org['id'],
        })
        self.assertIn(new_org['name'], new_template['organizations'])
示例#54
0
    def test_positive_create_with_org(self):
        """Check if Template with Organization can be created

        @id: 5de5ca76-1a39-46ac-8dd4-5d41b4b49076

        @Assert: Template is created and new Organization has been assigned
        """
        new_org = make_org()
        new_template = make_template({
            'name': gen_string('alpha'),
            'organization-ids': new_org['id'],
        })
        self.assertIn(new_org['name'], new_template['organizations'])
示例#55
0
    def test_positive_create_with_loc(self):
        """Check if Template with Location can be created

        :id: 263aba0e-4f54-4227-af97-f4bc8f5c0788

        :expectedresults: Template is created and new Location has been
            assigned

        :CaseImportance: Critical
        """
        new_loc = make_location()
        new_template = make_template({'location-ids': new_loc['id']})
        self.assertIn(new_loc['name'], new_template['locations'])
示例#56
0
    def test_positive_create_with_org(self):
        """Check if Template with Organization can be created

        @Feature: Template - Create

        @Assert: Template is created and new Organization has been assigned
        """
        new_org = make_org()
        new_template = make_template({
            'name': gen_string('alpha'),
            'organization-ids': new_org['id'],
        })
        self.assertIn(new_org['name'], new_template['organizations'])
示例#57
0
def test_positive_update_name():
    """Check if Template can be updated

    :id: 99bdab7b-1279-4349-a655-4294395ecbe1

    :expectedresults: Template is updated

    :CaseImportance: Critical
    """
    template = make_template()
    updated_name = gen_string('alpha')
    Template.update({'id': template['id'], 'name': updated_name})
    template = Template.info({'id': template['id']})
    assert updated_name == template['name']