Skip to content

Commit

Permalink
[decrypt_test] Fix windows test case
Browse files Browse the repository at this point in the history
  • Loading branch information
jbygdell committed Dec 18, 2023
1 parent ad2f7bd commit 9af7779
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion decrypt/decrypt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"io"
"os"
"path/filepath"
"runtime"
"testing"

createKey "github.com/NBISweden/sda-cli/create_key"
Expand Down Expand Up @@ -97,8 +98,12 @@ func (suite *DecryptTests) Testdecrypt() {
assert.NoError(suite.T(), err)

// Test decrypting a non-existent file
msg := "no such file or directory"
if runtime.GOOS == "windows" {
msg = "open somekey: The system cannot find the file specified."
}
err = decryptFile(filepath.Join(suite.tempDir, "non-existent"), "output_file", *privateKey)
assert.ErrorContains(suite.T(), err, "no such file or directory")
assert.ErrorContains(suite.T(), err, msg)

// Test decryption with malformed key
fakeKey := [32]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
Expand Down

0 comments on commit 9af7779

Please sign in to comment.