def test_validation_zeroboot_host(self):
        # provide zeroboot host before installing
        data = {
            "lkrnUrl": "some-url",
            "zerobootPool": "pool1",
            "hostInstance": "host-foo",
        }
        reservation = ZerobootReservation(name="test", data=data)
        reservation.api = MagicMock()

        with pytest.raises(ValueError, message="Should fail due to provided hostInstance before installing") as exinfo:
            reservation.validate()
        if not "hostInstance" in str(exinfo):
            pytest.fail("Expected an error but received error was not for 'hostInstance': %s" % exinfo)

        # no zeroboot host after installing
        reservation.state.set("actions", "install", "ok")
        reservation.data = {
            "lkrnUrl": "some-url",
            "zerobootPool": "pool1",
        }
        with pytest.raises(ValueError, message="Should fail due to provided missing hostInstance after installing") as exinfo:
            reservation.validate()
        if not "hostInstance" in str(exinfo):
            pytest.fail("Expected an error but received error was not for 'hostInstance': %s" % exinfo)
    def test_validation_invalid_data(self):
        data = {
            "zerobootPool": "pool1",
        }
        reservation = ZerobootReservation(name="test", data=data)
        reservation.api = MagicMock()

        # missing lkrnUrl
        with pytest.raises(ValueError, message="Should fail due to missing lkrnUrl") as exinfo:
            reservation.validate()
        if not "lkrnUrl" in str(exinfo):
            pytest.fail("Validation failed but did not contain missing data 'lkrnUrl': %s" % exinfo)

        # missing pool 
        reservation.data = {
            "lkrnUrl": "some-url",
        }

        with pytest.raises(ValueError, message="Should fail due to missing zerobootPool") as exinfo:
            reservation.validate()
        if not "zerobootPool" in str(exinfo):
            pytest.fail("Validation failed but did not contain missing data 'zerobootPool': %s" % exinfo)