def test_create_raise_exception_if_id_not_from_same_instance(self):
        command = Command('instance')
        ConfigBuilder.add_command('instance', command)

        self.validate_snapshot = False
        with pytest.raises(Exception) as excinfo:
            self.create_instance()
Exemplo n.º 2
0
    def create(id: str, force_create: bool = False):
        ValueChecker.validate_id(id)
        command = None if force_create else ConfigBuilder.get_command(id)
        if None is command:
            command = MySQLQueryCommand(id)
            ConfigBuilder.add_command(id, command)
        elif not isinstance(command, MySQLQueryCommand):
            raise Exception('Id must be for an instance of MySQLQueryCommand but other instance is returned')

        return command
    def create(id: str, force_create: bool = False) -> T:
        ValueChecker.validate_id(id)
        command = None if force_create else ConfigBuilder.get_command(id)
        if None is command:
            command = LastDiagnosticTestResultTimeCommand(id)
            ConfigBuilder.add_command(id, command)
        elif not isinstance(command, LastDiagnosticTestResultTimeCommand):
            raise Exception(
                'Id must be for an instance of LastDiagnosticTestResultTimeCommand but other instance is returned'
            )

        return command
Exemplo n.º 4
0
    def create(id, force_create=False) -> ESXIHardwareCommand:
        ValueChecker.validate_id(id)
        command = None if force_create else ConfigBuilder.get_command(id)
        if None is command:
            command = ESXIHardwareCommand(id)
            ConfigBuilder.add_command(id, command)
        elif not isinstance(command, ESXIHardwareCommand):
            raise Exception(
                'Id must be for an instance of ESXIHardwareCommand but other instance is returned'
            )

        return command