go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/providers/os/resources/systemd/machineinfo_test.go (about)

     1  // Copyright (c) Mondoo, Inc.
     2  // SPDX-License-Identifier: BUSL-1.1
     3  
     4  package systemd
     5  
     6  import (
     7  	"github.com/stretchr/testify/assert"
     8  	"github.com/stretchr/testify/require"
     9  	"strings"
    10  	"testing"
    11  )
    12  
    13  func TestParseMachineInfo(t *testing.T) {
    14  
    15  	content := `
    16  PRETTY_HOSTNAME="Lennart's Tablet"
    17  ICON_NAME=computer-tablet
    18  CHASSIS=tablet
    19  DEPLOYMENT=production
    20  `
    21  
    22  	mi, err := ParseMachineInfo(strings.NewReader(content))
    23  	require.NoError(t, err)
    24  	assert.Equal(t, "Lennart's Tablet", mi.PrettyHostname)
    25  	assert.Equal(t, "computer-tablet", mi.IconName)
    26  	assert.Equal(t, "tablet", mi.Chassis)
    27  	assert.Equal(t, "production", mi.Deployment)
    28  }