Skip to content

Commit f7d0ae7

Browse files
author
Katrina Owen
authored
Merge pull request #668 from exercism/hard-code-explicitly
Don't pass files to payload template in download test
2 parents f81bc67 + 8572e98 commit f7d0ae7

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

cmd/download_test.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,22 +159,19 @@ func fakeDownloadServer(requestor string) *httptest.Server {
159159
mux := http.NewServeMux()
160160
server := httptest.NewServer(mux)
161161

162-
path1 := "file-1.txt"
163-
mux.HandleFunc("/"+path1, func(w http.ResponseWriter, r *http.Request) {
162+
mux.HandleFunc("/file-1.txt", func(w http.ResponseWriter, r *http.Request) {
164163
fmt.Fprint(w, "this is file 1")
165164
})
166165

167-
path2 := "subdir/file-2.txt"
168-
mux.HandleFunc("/"+path2, func(w http.ResponseWriter, r *http.Request) {
166+
mux.HandleFunc("/subdir/file-2.txt", func(w http.ResponseWriter, r *http.Request) {
169167
fmt.Fprint(w, "this is file 2")
170168
})
171169

172-
path3 := "file-3.txt"
173-
mux.HandleFunc("/"+path3, func(w http.ResponseWriter, r *http.Request) {
170+
mux.HandleFunc("/file-3.txt", func(w http.ResponseWriter, r *http.Request) {
174171
fmt.Fprint(w, "")
175172
})
176173

177-
payloadBody := fmt.Sprintf(payloadTemplate, requestor, server.URL+"/", path1, path2, path3)
174+
payloadBody := fmt.Sprintf(payloadTemplate, requestor, server.URL+"/")
178175
mux.HandleFunc("/solutions/latest", func(w http.ResponseWriter, r *http.Request) {
179176
fmt.Fprint(w, payloadBody)
180177
})
@@ -238,9 +235,9 @@ const payloadTemplate = `
238235
},
239236
"file_download_base_url": "%s",
240237
"files": [
241-
"%s",
242-
"%s",
243-
"%s"
238+
"/file-1.txt",
239+
"/subdir/file-2.txt",
240+
"/file-3.txt"
244241
],
245242
"iteration": {
246243
"submitted_at": "2017-08-21t10:11:12.130z"

0 commit comments

Comments
 (0)