def test_negative_end_to_end(self, module_host): """Attempt to create and update an interface with different invalid entries as names (>255 chars, unsupported string types), at the end attempt to remove primary interface :id: 6fae26d8-8f62-41ba-a1cc-0185137ef70f :expectedresults: An interface is not created, not updated and primary interface is not deleted :CaseImportance: Critical """ name = gen_choice(invalid_interfaces_list()) with pytest.raises(HTTPError) as error: entities.Interface(host=module_host, name=name).create() assert str(422) in str(error) interface = entities.Interface(host=module_host).create() interface.name = name with pytest.raises(HTTPError) as error: interface.update(['name']) assert interface.read().name != name assert str(422) in str(error) primary_interface = next( interface for interface in module_host.interface if interface.read().primary ) with pytest.raises(HTTPError): primary_interface.delete() try: primary_interface.read() except HTTPError: pytest.fail("HTTPError 404 raised unexpectedly!")
def test_positive_create_end_to_end(self, module_host): """Create update and delete an interface with different names and minimal input parameters :id: a45ee576-bec6-47a6-a018-a00e555eb2ad :expectedresults: An interface is created updated and deleted :CaseImportance: Critical """ name = gen_choice(valid_interfaces_list()) interface = entities.Interface(host=module_host, name=name).create() assert interface.name == name new_name = gen_choice(valid_interfaces_list()) interface.name = new_name interface = interface.update(['name']) assert interface.name == new_name interface.delete() with pytest.raises(HTTPError): interface.read()
def test_positive_delete_and_check_host(self): """Delete host's interface (not primary) and make sure the host was not accidentally removed altogether with the interface :BZ: 1285669 :id: 3b3e9b3f-cfb2-433f-bd1f-0a8e1d9f0b34 :expectedresults: An interface was successfully deleted, host was not deleted :CaseImportance: Critical """ host = entities.Host().create() interface = entities.Interface(host=host, primary=False).create() interface.delete() with pytest.raises(HTTPError): interface.read() try: host.read() except HTTPError: pytest.fail("HTTPError 404 raised unexpectedly!")