go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/providers/os/id/platformid/osx_test.go (about)

     1  // Copyright (c) Mondoo, Inc.
     2  // SPDX-License-Identifier: BUSL-1.1
     3  
     4  package platformid
     5  
     6  import (
     7  	"path/filepath"
     8  	"testing"
     9  
    10  	"github.com/stretchr/testify/assert"
    11  	"github.com/stretchr/testify/require"
    12  	"go.mondoo.com/cnquery/providers/os/connection/mock"
    13  )
    14  
    15  func TestMacOSMachineId(t *testing.T) {
    16  	filepath, _ := filepath.Abs("./testdata/osx_test.toml")
    17  	provider, err := mock.New(filepath, nil)
    18  	require.NoError(t, err)
    19  
    20  	lid := MacOSIdProvider{connection: provider}
    21  	id, err := lid.ID()
    22  	require.NoError(t, err)
    23  
    24  	assert.Equal(t, "5c09e2c7-07f2-5bee-be82-7cb70688e55c", id, "machine id is properly detected")
    25  }