Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Commit

Permalink
remove windows tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aaperis committed Apr 21, 2023
1 parent b4a35fe commit fbc0e59
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions helper/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package helper

import (
"os"
"path/filepath"
"runtime"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -75,25 +73,12 @@ func TestCreateECToken(t *testing.T) {

func TestFormatUploadFilePath(t *testing.T) {

// This is non-trivial only on windows
unixPath := "a/b/c.c4gh"
testPath := filepath.Join("a", "b", "c.c4gh")
testPath := "a\\b\\c.c4gh"
uploadPath, err := FormatUploadFilePath(testPath)
assert.NoError(t, err)
assert.Equal(t, unixPath, uploadPath)

testPath = "a\\b\\c.c4gh"
uploadPath, err = FormatUploadFilePath(testPath)
if runtime.GOOS == "windows" {
// this is expected to work on windows
assert.Equal(t, unixPath, uploadPath)
assert.NoError(t, err)
} else {
// this is expected to fail on linux/mac
assert.ErrorContains(t, err, "filepath contains disallowed characters: \\, \\")

}

// mixed "\" and "/"
weirdPath := `dq\sw:*?"<>|\t\s/df.c4gh`
_, err = FormatUploadFilePath(weirdPath)
Expand All @@ -102,9 +87,6 @@ func TestFormatUploadFilePath(t *testing.T) {
// no mixed "\" and "/" but not allowed
weirdPath = `dq\sw:*?"<>|\t\sdf.c4gh`
_, err = FormatUploadFilePath(weirdPath)
if runtime.GOOS == "windows" {
assert.EqualError(t, err, "filepath contains disallowed characters: :, *, ?, \", <, >, |")
} else {
assert.EqualError(t, err, "filepath contains disallowed characters: \\, :, *, ?, \", <, >, |, \\, \\")
}
assert.EqualError(t, err, "filepath contains disallowed characters: :, *, ?, \", <, >, |")

}

0 comments on commit fbc0e59

Please sign in to comment.