Commit 91043705 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Cast strings to []byte in tests

parent 7a84085b
...@@ -209,7 +209,7 @@ func TestDownloadCacheHit(t *testing.T) { ...@@ -209,7 +209,7 @@ func TestDownloadCacheHit(t *testing.T) {
if err := os.MkdirAll(cacheDir, 0755); err != nil { if err := os.MkdirAll(cacheDir, 0755); err != nil {
t.Fatal(err) t.Fatal(err)
} }
cachedContent := []byte{'c', 'a', 'c', 'h', 'e', 'd'} cachedContent := []byte("cached")
if err := ioutil.WriteFile(path.Join(cacheDir, archiveName), cachedContent, 0644); err != nil { if err := ioutil.WriteFile(path.Join(cacheDir, archiveName), cachedContent, 0644); err != nil {
t.Fatal(err) t.Fatal(err)
} }
...@@ -406,7 +406,7 @@ func allowedXSendfileDownload(t *testing.T, contentFilename string, filePath str ...@@ -406,7 +406,7 @@ func allowedXSendfileDownload(t *testing.T, contentFilename string, filePath str
if err := os.MkdirAll(cacheDir, 0755); err != nil { if err := os.MkdirAll(cacheDir, 0755); err != nil {
t.Fatal(err) t.Fatal(err)
} }
contentBytes := []byte{'c', 'o', 'n', 't', 'e', 'n', 't'} contentBytes := []byte("content")
if err := ioutil.WriteFile(contentPath, contentBytes, 0644); err != nil { if err := ioutil.WriteFile(contentPath, contentBytes, 0644); err != nil {
t.Fatal(err) t.Fatal(err)
} }
...@@ -449,7 +449,7 @@ func deniedXSendfileDownload(t *testing.T, contentFilename string, filePath stri ...@@ -449,7 +449,7 @@ func deniedXSendfileDownload(t *testing.T, contentFilename string, filePath stri
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
if bytes.Compare(actual, []byte{'D', 'e', 'n', 'i', 'e', 'd'}) != 0 { if bytes.Compare(actual, []byte("Denied")) != 0 {
t.Fatal("Unexpected file contents in download") t.Fatal("Unexpected file contents in download")
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment