go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/providers/os/detector/windows/build_version_test.go (about)

     1  // Copyright (c) Mondoo, Inc.
     2  // SPDX-License-Identifier: BUSL-1.1
     3  
     4  package windows
     5  
     6  import (
     7  	"github.com/stretchr/testify/assert"
     8  	"strings"
     9  	"testing"
    10  )
    11  
    12  // UBR - Update Build Revision
    13  func TestParseWinRegistryCurrentVersion(t *testing.T) {
    14  
    15  	data := `{
    16      "CurrentBuild":  "17763",
    17  		"UBR":  720,
    18  		"EditionID": "ServerDatacenterEval",
    19  		"ReleaseId": "1809"
    20  	}`
    21  
    22  	m, err := ParseWinRegistryCurrentVersion(strings.NewReader(data))
    23  	assert.Nil(t, err)
    24  
    25  	assert.Equal(t, "17763", m.CurrentBuild, "buildnumber should be parsed properly")
    26  	assert.Equal(t, 720, m.UBR, "ubr should be parsed properly")
    27  
    28  }