This test will write the chrome.exe installer into a temporary file Then it will just run the extractPE function.
(t *testing.T)
| 13 | // This test will write the chrome.exe installer into a temporary file |
| 14 | // Then it will just run the extractPE function. |
| 15 | func 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 |
| 30 | var ChromeExe = []byte(` |