MCPcopy
hub / github.com/smallstep/cli / TestExtract

Function TestExtract

command/crypto/winpe/winpe_test.go:15–27  ·  view source on GitHub ↗

This test will write the chrome.exe installer into a temporary file Then it will just run the extractPE function.

(t *testing.T)

Source from the content-addressed store, hash-verified

13// This test will write the chrome.exe installer into a temporary file
14// Then it will just run the extractPE function.
15func TestExtract(t *testing.T) {
16 tmpfile, err := os.CreateTemp(t.TempDir(), "step-crypto-winpe-extract-chrome.*.exe")
17 assert.NoError(t, err)
18 defer os.Remove(tmpfile.Name())
19 defer tmpfile.Close()
20
21 dec := base64.NewDecoder(base64.StdEncoding, bytes.NewReader(ChromeExe))
22
23 _, err = io.Copy(tmpfile, dec)
24 assert.NoError(t, err)
25
26 assert.NoError(t, extractPE(tmpfile.Name()))
27}
28
29// Downloaded from the chrome website and base64 encoded from cli
30var ChromeExe = []byte(`

Callers

nothing calls this directly

Calls 2

extractPEFunction · 0.85
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…