Exemplo n.º 1
0
    def test_positive_update_model(self):
        """Update a host with a new model

        @feature: Hosts

        @assert: A host is updated with a new model
        """
        host = entities.Host(model=entities.Model().create()).create()
        new_model = entities.Model().create()
        host.model = new_model
        host = host.update(['model'])
        self.assertEqual(host.model.read().name, new_model.name)
Exemplo n.º 2
0
    def test_positive_update_model(self):
        """Update a host with a new model

        @id: da584445-ec24-4bed-82d0-d964bafa49bf

        @assert: A host is updated with a new model

        @CaseLevel: Integration
        """
        host = entities.Host(model=entities.Model().create()).create()
        new_model = entities.Model().create()
        host.model = new_model
        host = host.update(['model'])
        self.assertEqual(host.model.read().name, new_model.name)
Exemplo n.º 3
0
    def test_positive_create_with_model(self):
        """Create a host with model specified

        @feature: Hosts

        @assert: A host is created with expected model assigned
        """
        model = entities.Model().create()
        host = entities.Host(model=model).create()
        self.assertEqual(host.model.read().name, model.name)
Exemplo n.º 4
0
    def test_positive_create_with_model(self):
        """Create a host with model specified

        @id: 7a912a19-71e4-4843-87fd-bab98c156f4a

        @assert: A host is created with expected model assigned

        @CaseLevel: Integration
        """
        model = entities.Model().create()
        host = entities.Host(model=model).create()
        self.assertEqual(host.model.read().name, model.name)
Exemplo n.º 5
0
def test_positive_create_and_update_with_model(module_model):
    """Create and update a host with model specified

    :id: 7a912a19-71e4-4843-87fd-bab98c156f4a

    :expectedresults: A host is created and updated with expected model assigned

    :CaseLevel: Integration
    """
    host = entities.Host(model=module_model).create()
    assert host.model.read().name == module_model.name
    new_model = entities.Model().create()
    host.model = new_model
    host = host.update(['model'])
    assert host.model.read().name == new_model.name
Exemplo n.º 6
0
    def test_positive_sort_by_model(self):
        """Create some Host entities and sort them by hardware model
        ascendingly and then descendingly

        :id: 56853ffb-47b2-47ce-89c5-d295c16200c8

        :customerscenario: true

        :expectedresults: Host entities are sorted properly

        :CaseImportance: High

        :BZ: 1268085

        :CaseLevel: Integration
        """
        org = entities.Organization().create()
        name_list = [gen_string('alpha', 20) for _ in range(5)]
        host = entities.Host(organization=org)
        host.create_missing()
        for name in name_list:
            model = entities.Model(name=name).create()
            entities.Host(
                organization=org,
                architecture=host.architecture,
                domain=host.domain,
                environment=host.environment,
                location=host.location,
                mac=host.mac,
                medium=host.medium,
                operatingsystem=host.operatingsystem,
                ptable=host.ptable,
                root_pass=host.root_pass,
                model=model
            ).create()
        with Session(self) as session:
            set_context(session, org=org.name)
            self.hosts.navigate_to_entity()
            self.assertEqual(
                self.hosts.sort_table_by_column('Model'),
                sorted(name_list, key=six.text_type.lower)
            )
            self.assertEqual(
                self.hosts.sort_table_by_column('Model'),
                sorted(name_list, key=six.text_type.lower, reverse=True)
            )
Exemplo n.º 7
0
def module_model():
    return entities.Model().create()