Contains the Concourse pipeline definition for building a line-server container
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

785 lines
17 KiB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. package main
  2. import (
  3. "bytes"
  4. "encoding/json"
  5. "mime/multipart"
  6. "net/http"
  7. "net/http/httptest"
  8. "net/url"
  9. "os"
  10. "path"
  11. "strconv"
  12. "strings"
  13. "testing"
  14. "time"
  15. "github.com/zenazn/goji"
  16. )
  17. type RespOkJSON struct {
  18. Filename string
  19. Url string
  20. Delete_Key string
  21. Expiry string
  22. Size string
  23. }
  24. type RespErrJSON struct {
  25. Error string
  26. }
  27. func TestSetup(t *testing.T) {
  28. Config.siteURL = "http://linx.example.org/"
  29. Config.filesDir = path.Join(os.TempDir(), generateBarename())
  30. Config.metaDir = Config.filesDir + "_meta"
  31. Config.noLogs = true
  32. Config.siteName = "linx"
  33. setup()
  34. }
  35. func TestIndex(t *testing.T) {
  36. w := httptest.NewRecorder()
  37. req, err := http.NewRequest("GET", "/", nil)
  38. if err != nil {
  39. t.Fatal(err)
  40. }
  41. goji.DefaultMux.ServeHTTP(w, req)
  42. if !strings.Contains(w.Body.String(), "Click or Drop file") {
  43. t.Fatal("String 'Click or Drop file' not found in index response")
  44. }
  45. }
  46. func TestNotFound(t *testing.T) {
  47. w := httptest.NewRecorder()
  48. req, err := http.NewRequest("GET", "/url/should/not/exist", nil)
  49. if err != nil {
  50. t.Fatal(err)
  51. }
  52. goji.DefaultMux.ServeHTTP(w, req)
  53. if w.Code != 404 {
  54. t.Fatalf("Expected 404, got %d", w.Code)
  55. }
  56. }
  57. func TestFileNotFound(t *testing.T) {
  58. w := httptest.NewRecorder()
  59. filename := generateBarename()
  60. req, err := http.NewRequest("GET", "/selif/"+filename, nil)
  61. if err != nil {
  62. t.Fatal(err)
  63. }
  64. goji.DefaultMux.ServeHTTP(w, req)
  65. if w.Code != 404 {
  66. t.Fatalf("Expected 404, got %d", w.Code)
  67. }
  68. }
  69. func TestDisplayNotFound(t *testing.T) {
  70. w := httptest.NewRecorder()
  71. filename := generateBarename()
  72. req, err := http.NewRequest("GET", "/"+filename, nil)
  73. if err != nil {
  74. t.Fatal(err)
  75. }
  76. goji.DefaultMux.ServeHTTP(w, req)
  77. if w.Code != 404 {
  78. t.Fatalf("Expected 404, got %d", w.Code)
  79. }
  80. }
  81. func TestPostCodeUpload(t *testing.T) {
  82. w := httptest.NewRecorder()
  83. filename := generateBarename()
  84. extension := "txt"
  85. form := url.Values{}
  86. form.Add("content", "File content")
  87. form.Add("filename", filename)
  88. form.Add("extension", extension)
  89. req, err := http.NewRequest("POST", "/upload/", nil)
  90. if err != nil {
  91. t.Fatal(err)
  92. }
  93. req.PostForm = form
  94. req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
  95. req.Header.Set("Referer", Config.siteURL)
  96. goji.DefaultMux.ServeHTTP(w, req)
  97. if w.Code != 301 {
  98. t.Fatalf("Status code is not 301, but %d", w.Code)
  99. }
  100. if w.Header().Get("Location") != "/"+filename+"."+extension {
  101. t.Fatalf("Was redirected to %s instead of /%s", w.Header().Get("Location"), filename)
  102. }
  103. }
  104. func TestPostCodeUploadWhitelistedHeader(t *testing.T) {
  105. w := httptest.NewRecorder()
  106. filename := generateBarename()
  107. extension := "txt"
  108. form := url.Values{}
  109. form.Add("content", "File content")
  110. form.Add("filename", filename)
  111. form.Add("extension", extension)
  112. req, err := http.NewRequest("POST", "/upload/", nil)
  113. if err != nil {
  114. t.Fatal(err)
  115. }
  116. req.PostForm = form
  117. req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
  118. req.Header.Set("Linx-Expiry", "0")
  119. goji.DefaultMux.ServeHTTP(w, req)
  120. if w.Code != 301 {
  121. t.Fatalf("Status code is not 301, but %d", w.Code)
  122. }
  123. }
  124. func TestPostCodeUploadNoReferrer(t *testing.T) {
  125. w := httptest.NewRecorder()
  126. filename := generateBarename()
  127. extension := "txt"
  128. form := url.Values{}
  129. form.Add("content", "File content")
  130. form.Add("filename", filename)
  131. form.Add("extension", extension)
  132. req, err := http.NewRequest("POST", "/upload/", nil)
  133. if err != nil {
  134. t.Fatal(err)
  135. }
  136. req.PostForm = form
  137. req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
  138. goji.DefaultMux.ServeHTTP(w, req)
  139. if w.Code != 400 {
  140. t.Fatalf("Status code is not 400, but %d", w.Code)
  141. }
  142. }
  143. func TestPostCodeUploadBadOrigin(t *testing.T) {
  144. w := httptest.NewRecorder()
  145. filename := generateBarename()
  146. extension := "txt"
  147. form := url.Values{}
  148. form.Add("content", "File content")
  149. form.Add("filename", filename)
  150. form.Add("extension", extension)
  151. req, err := http.NewRequest("POST", "/upload/", nil)
  152. if err != nil {
  153. t.Fatal(err)
  154. }
  155. req.PostForm = form
  156. req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
  157. req.Header.Set("Referer", Config.siteURL)
  158. req.Header.Set("Origin", "http://example.com/")
  159. goji.DefaultMux.ServeHTTP(w, req)
  160. if w.Code != 400 {
  161. t.Fatalf("Status code is not 400, but %d", w.Code)
  162. }
  163. }
  164. func TestPostCodeExpiryJSONUpload(t *testing.T) {
  165. w := httptest.NewRecorder()
  166. form := url.Values{}
  167. form.Add("content", "File content")
  168. form.Add("filename", "")
  169. form.Add("expires", "60")
  170. req, err := http.NewRequest("POST", "/upload/", nil)
  171. if err != nil {
  172. t.Fatal(err)
  173. }
  174. req.PostForm = form
  175. req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
  176. req.Header.Set("Accept", "application/json")
  177. req.Header.Set("Referer", Config.siteURL)
  178. goji.DefaultMux.ServeHTTP(w, req)
  179. if w.Code != 200 {
  180. t.Log(w.Body.String())
  181. t.Fatalf("Status code is not 200, but %d", w.Code)
  182. }
  183. var myjson RespOkJSON
  184. err = json.Unmarshal([]byte(w.Body.String()), &myjson)
  185. if err != nil {
  186. t.Fatal(err)
  187. }
  188. myExp, err := strconv.ParseInt(myjson.Expiry, 10, 64)
  189. if err != nil {
  190. t.Fatal(err)
  191. }
  192. curTime := time.Now().Unix()
  193. if myExp < curTime {
  194. t.Fatalf("File expiry (%d) is smaller than current time (%d)", myExp, curTime)
  195. }
  196. if myjson.Size != "12" {
  197. t.Fatalf("File size was not 12 but %s", myjson.Size)
  198. }
  199. }
  200. func TestPostUpload(t *testing.T) {
  201. w := httptest.NewRecorder()
  202. filename := generateBarename() + ".txt"
  203. var b bytes.Buffer
  204. mw := multipart.NewWriter(&b)
  205. fw, err := mw.CreateFormFile("file", filename)
  206. if err != nil {
  207. t.Fatal(err)
  208. }
  209. fw.Write([]byte("File content"))
  210. mw.Close()
  211. req, err := http.NewRequest("POST", "/upload/", &b)
  212. req.Header.Set("Content-Type", mw.FormDataContentType())
  213. req.Header.Set("Referer", Config.siteURL)
  214. if err != nil {
  215. t.Fatal(err)
  216. }
  217. goji.DefaultMux.ServeHTTP(w, req)
  218. if w.Code != 301 {
  219. t.Fatalf("Status code is not 301, but %d", w.Code)
  220. }
  221. if w.Header().Get("Location") != "/"+filename {
  222. t.Fatalf("Was redirected to %s instead of /%s", w.Header().Get("Location"), filename)
  223. }
  224. }
  225. func TestPostJSONUpload(t *testing.T) {
  226. w := httptest.NewRecorder()
  227. filename := generateBarename() + ".txt"
  228. var b bytes.Buffer
  229. mw := multipart.NewWriter(&b)
  230. fw, err := mw.CreateFormFile("file", filename)
  231. if err != nil {
  232. t.Fatal(err)
  233. }
  234. fw.Write([]byte("File content"))
  235. mw.Close()
  236. req, err := http.NewRequest("POST", "/upload/", &b)
  237. req.Header.Set("Content-Type", mw.FormDataContentType())
  238. req.Header.Set("Accept", "application/json")
  239. req.Header.Set("Referer", Config.siteURL)
  240. if err != nil {
  241. t.Fatal(err)
  242. }
  243. goji.DefaultMux.ServeHTTP(w, req)
  244. if w.Code != 200 {
  245. t.Log(w.Body.String())
  246. t.Fatalf("Status code is not 200, but %d", w.Code)
  247. }
  248. var myjson RespOkJSON
  249. err = json.Unmarshal([]byte(w.Body.String()), &myjson)
  250. if err != nil {
  251. t.Fatal(err)
  252. }
  253. if myjson.Filename != filename {
  254. t.Fatalf("Filename is not '%s' but '%s' ", filename, myjson.Filename)
  255. }
  256. if myjson.Expiry != "0" {
  257. t.Fatalf("File expiry is not 0 but %s", myjson.Expiry)
  258. }
  259. if myjson.Size != "12" {
  260. t.Fatalf("File size was not 12 but %s", myjson.Size)
  261. }
  262. }
  263. func TestPostExpiresJSONUpload(t *testing.T) {
  264. w := httptest.NewRecorder()
  265. filename := generateBarename() + ".txt"
  266. var b bytes.Buffer
  267. mw := multipart.NewWriter(&b)
  268. fw, err := mw.CreateFormFile("file", filename)
  269. if err != nil {
  270. t.Fatal(err)
  271. }
  272. fw.Write([]byte("File content"))
  273. exp, err := mw.CreateFormField("expires")
  274. if err != nil {
  275. t.Fatal(err)
  276. }
  277. exp.Write([]byte("60"))
  278. mw.Close()
  279. req, err := http.NewRequest("POST", "/upload/", &b)
  280. req.Header.Set("Content-Type", mw.FormDataContentType())
  281. req.Header.Set("Accept", "application/json")
  282. req.Header.Set("Referer", Config.siteURL)
  283. if err != nil {
  284. t.Fatal(err)
  285. }
  286. goji.DefaultMux.ServeHTTP(w, req)
  287. if w.Code != 200 {
  288. t.Log(w.Body.String())
  289. t.Fatalf("Status code is not 200, but %d", w.Code)
  290. }
  291. var myjson RespOkJSON
  292. err = json.Unmarshal([]byte(w.Body.String()), &myjson)
  293. if err != nil {
  294. t.Fatal(err)
  295. }
  296. if myjson.Filename != filename {
  297. t.Fatalf("Filename is not '%s' but '%s' ", filename, myjson.Filename)
  298. }
  299. myExp, err := strconv.ParseInt(myjson.Expiry, 10, 64)
  300. if err != nil {
  301. t.Fatal(err)
  302. }
  303. curTime := time.Now().Unix()
  304. if myExp < curTime {
  305. t.Fatalf("File expiry (%d) is smaller than current time (%d)", myExp, curTime)
  306. }
  307. if myjson.Size != "12" {
  308. t.Fatalf("File size was not 12 but %s", myjson.Size)
  309. }
  310. }
  311. func TestPostRandomizeJSONUpload(t *testing.T) {
  312. w := httptest.NewRecorder()
  313. filename := generateBarename() + ".txt"
  314. var b bytes.Buffer
  315. mw := multipart.NewWriter(&b)
  316. fw, err := mw.CreateFormFile("file", filename)
  317. if err != nil {
  318. t.Fatal(err)
  319. }
  320. fw.Write([]byte("File content"))
  321. rnd, err := mw.CreateFormField("randomize")
  322. if err != nil {
  323. t.Fatal(err)
  324. }
  325. rnd.Write([]byte("true"))
  326. mw.Close()
  327. req, err := http.NewRequest("POST", "/upload/", &b)
  328. req.Header.Set("Content-Type", mw.FormDataContentType())
  329. req.Header.Set("Accept", "application/json")
  330. req.Header.Set("Referer", Config.siteURL)
  331. if err != nil {
  332. t.Fatal(err)
  333. }
  334. goji.DefaultMux.ServeHTTP(w, req)
  335. if w.Code != 200 {
  336. t.Log(w.Body.String())
  337. t.Fatalf("Status code is not 200, but %d", w.Code)
  338. }
  339. var myjson RespOkJSON
  340. err = json.Unmarshal([]byte(w.Body.String()), &myjson)
  341. if err != nil {
  342. t.Fatal(err)
  343. }
  344. if myjson.Filename == filename {
  345. t.Fatalf("Filename (%s) is not random (%s)", filename, myjson.Filename)
  346. }
  347. if myjson.Size != "12" {
  348. t.Fatalf("File size was not 12 but %s", myjson.Size)
  349. }
  350. }
  351. func TestPostEmptyUpload(t *testing.T) {
  352. w := httptest.NewRecorder()
  353. filename := generateBarename() + ".txt"
  354. var b bytes.Buffer
  355. mw := multipart.NewWriter(&b)
  356. fw, err := mw.CreateFormFile("file", filename)
  357. if err != nil {
  358. t.Fatal(err)
  359. }
  360. fw.Write([]byte(""))
  361. mw.Close()
  362. req, err := http.NewRequest("POST", "/upload/", &b)
  363. req.Header.Set("Content-Type", mw.FormDataContentType())
  364. req.Header.Set("Referer", Config.siteURL)
  365. if err != nil {
  366. t.Fatal(err)
  367. }
  368. goji.DefaultMux.ServeHTTP(w, req)
  369. if w.Code != 500 {
  370. t.Log(w.Body.String())
  371. t.Fatalf("Status code is not 500, but %d", w.Code)
  372. }
  373. if !strings.Contains(w.Body.String(), "Empty file") {
  374. t.Fatal("Response did not contain 'Empty file'")
  375. }
  376. }
  377. func TestPostEmptyJSONUpload(t *testing.T) {
  378. w := httptest.NewRecorder()
  379. filename := generateBarename() + ".txt"
  380. var b bytes.Buffer
  381. mw := multipart.NewWriter(&b)
  382. fw, err := mw.CreateFormFile("file", filename)
  383. if err != nil {
  384. t.Fatal(err)
  385. }
  386. fw.Write([]byte(""))
  387. mw.Close()
  388. req, err := http.NewRequest("POST", "/upload/", &b)
  389. req.Header.Set("Content-Type", mw.FormDataContentType())
  390. req.Header.Set("Accept", "application/json")
  391. req.Header.Set("Referer", Config.siteURL)
  392. if err != nil {
  393. t.Fatal(err)
  394. }
  395. goji.DefaultMux.ServeHTTP(w, req)
  396. if w.Code != 500 {
  397. t.Log(w.Body.String())
  398. t.Fatalf("Status code is not 500, but %d", w.Code)
  399. }
  400. var myjson RespErrJSON
  401. err = json.Unmarshal([]byte(w.Body.String()), &myjson)
  402. if err != nil {
  403. t.Fatal(err)
  404. }
  405. if myjson.Error != "Could not upload file: Empty file" {
  406. t.Fatal("Json 'error' was not 'Empty file' but " + myjson.Error)
  407. }
  408. }
  409. func TestPutUpload(t *testing.T) {
  410. w := httptest.NewRecorder()
  411. filename := generateBarename() + ".ext"
  412. req, err := http.NewRequest("PUT", "/upload/"+filename, strings.NewReader("File content"))
  413. if err != nil {
  414. t.Fatal(err)
  415. }
  416. goji.DefaultMux.ServeHTTP(w, req)
  417. if w.Body.String() != Config.siteURL+filename {
  418. t.Fatal("Response was not expected URL")
  419. }
  420. }
  421. func TestPutRandomizedUpload(t *testing.T) {
  422. w := httptest.NewRecorder()
  423. filename := generateBarename() + ".ext"
  424. req, err := http.NewRequest("PUT", "/upload/"+filename, strings.NewReader("File content"))
  425. if err != nil {
  426. t.Fatal(err)
  427. }
  428. req.Header.Set("Linx-Randomize", "yes")
  429. goji.DefaultMux.ServeHTTP(w, req)
  430. if w.Body.String() == Config.siteURL+filename {
  431. t.Fatal("Filename was not random")
  432. }
  433. }
  434. func TestPutNoExtensionUpload(t *testing.T) {
  435. w := httptest.NewRecorder()
  436. filename := generateBarename()
  437. req, err := http.NewRequest("PUT", "/upload/"+filename, strings.NewReader("File content"))
  438. if err != nil {
  439. t.Fatal(err)
  440. }
  441. req.Header.Set("Linx-Randomize", "yes")
  442. goji.DefaultMux.ServeHTTP(w, req)
  443. if w.Body.String() == Config.siteURL+filename {
  444. t.Fatal("Filename was not random")
  445. }
  446. }
  447. func TestPutEmptyUpload(t *testing.T) {
  448. w := httptest.NewRecorder()
  449. filename := generateBarename() + ".ext"
  450. req, err := http.NewRequest("PUT", "/upload/"+filename, strings.NewReader(""))
  451. if err != nil {
  452. t.Fatal(err)
  453. }
  454. req.Header.Set("Linx-Randomize", "yes")
  455. goji.DefaultMux.ServeHTTP(w, req)
  456. if !strings.Contains(w.Body.String(), "Empty file") {
  457. t.Fatal("Response doesn't contain'Empty file'")
  458. }
  459. }
  460. func TestPutJSONUpload(t *testing.T) {
  461. var myjson RespOkJSON
  462. w := httptest.NewRecorder()
  463. filename := generateBarename() + ".ext"
  464. req, err := http.NewRequest("PUT", "/upload/"+filename, strings.NewReader("File content"))
  465. if err != nil {
  466. t.Fatal(err)
  467. }
  468. req.Header.Set("Accept", "application/json")
  469. goji.DefaultMux.ServeHTTP(w, req)
  470. err = json.Unmarshal([]byte(w.Body.String()), &myjson)
  471. if err != nil {
  472. t.Fatal(err)
  473. }
  474. if myjson.Filename != filename {
  475. t.Fatal("Filename was not provided one but " + myjson.Filename)
  476. }
  477. }
  478. func TestPutRandomizedJSONUpload(t *testing.T) {
  479. var myjson RespOkJSON
  480. w := httptest.NewRecorder()
  481. filename := generateBarename() + ".ext"
  482. req, err := http.NewRequest("PUT", "/upload/"+filename, strings.NewReader("File content"))
  483. if err != nil {
  484. t.Fatal(err)
  485. }
  486. req.Header.Set("Accept", "application/json")
  487. req.Header.Set("Linx-Randomize", "yes")
  488. goji.DefaultMux.ServeHTTP(w, req)
  489. err = json.Unmarshal([]byte(w.Body.String()), &myjson)
  490. if err != nil {
  491. t.Fatal(err)
  492. }
  493. if myjson.Filename == filename {
  494. t.Fatal("Filename was not random ")
  495. }
  496. }
  497. func TestPutExpireJSONUpload(t *testing.T) {
  498. var myjson RespOkJSON
  499. w := httptest.NewRecorder()
  500. filename := generateBarename() + ".ext"
  501. req, err := http.NewRequest("PUT", "/upload/"+filename, strings.NewReader("File content"))
  502. if err != nil {
  503. t.Fatal(err)
  504. }
  505. req.Header.Set("Accept", "application/json")
  506. req.Header.Set("Linx-Expiry", "600")
  507. goji.DefaultMux.ServeHTTP(w, req)
  508. err = json.Unmarshal([]byte(w.Body.String()), &myjson)
  509. if err != nil {
  510. t.Fatal(err)
  511. }
  512. expiry, err := strconv.Atoi(myjson.Expiry)
  513. if err != nil {
  514. t.Fatal("Expiry was not an integer")
  515. }
  516. if expiry < 1 {
  517. t.Fatal("Expiry was not set")
  518. }
  519. }
  520. func TestPutAndDelete(t *testing.T) {
  521. var myjson RespOkJSON
  522. w := httptest.NewRecorder()
  523. req, err := http.NewRequest("PUT", "/upload", strings.NewReader("File content"))
  524. if err != nil {
  525. t.Fatal(err)
  526. }
  527. req.Header.Set("Accept", "application/json")
  528. goji.DefaultMux.ServeHTTP(w, req)
  529. err = json.Unmarshal([]byte(w.Body.String()), &myjson)
  530. if err != nil {
  531. t.Fatal(err)
  532. }
  533. // Delete it
  534. w = httptest.NewRecorder()
  535. req, err = http.NewRequest("DELETE", "/"+myjson.Filename, nil)
  536. req.Header.Set("Linx-Delete-Key", myjson.Delete_Key)
  537. goji.DefaultMux.ServeHTTP(w, req)
  538. if w.Code != 200 {
  539. t.Fatal("Status code was not 200, but " + strconv.Itoa(w.Code))
  540. }
  541. // Make sure it's actually gone
  542. w = httptest.NewRecorder()
  543. req, err = http.NewRequest("GET", "/"+myjson.Filename, nil)
  544. goji.DefaultMux.ServeHTTP(w, req)
  545. if w.Code != 404 {
  546. t.Fatal("Status code was not 404, but " + strconv.Itoa(w.Code))
  547. }
  548. // Make sure torrent is also gone
  549. w = httptest.NewRecorder()
  550. req, err = http.NewRequest("GET", "/"+myjson.Filename+"/torrent", nil)
  551. goji.DefaultMux.ServeHTTP(w, req)
  552. if w.Code != 404 {
  553. t.Fatal("Status code was not 404, but " + strconv.Itoa(w.Code))
  554. }
  555. }
  556. func TestPutAndSpecificDelete(t *testing.T) {
  557. var myjson RespOkJSON
  558. w := httptest.NewRecorder()
  559. req, err := http.NewRequest("PUT", "/upload", strings.NewReader("File content"))
  560. if err != nil {
  561. t.Fatal(err)
  562. }
  563. req.Header.Set("Accept", "application/json")
  564. req.Header.Set("Linx-Delete-Key", "supersecret")
  565. goji.DefaultMux.ServeHTTP(w, req)
  566. err = json.Unmarshal([]byte(w.Body.String()), &myjson)
  567. if err != nil {
  568. t.Fatal(err)
  569. }
  570. // Delete it
  571. w = httptest.NewRecorder()
  572. req, err = http.NewRequest("DELETE", "/"+myjson.Filename, nil)
  573. req.Header.Set("Linx-Delete-Key", "supersecret")
  574. goji.DefaultMux.ServeHTTP(w, req)
  575. if w.Code != 200 {
  576. t.Fatal("Status code was not 200, but " + strconv.Itoa(w.Code))
  577. }
  578. // Make sure it's actually gone
  579. w = httptest.NewRecorder()
  580. req, err = http.NewRequest("GET", "/"+myjson.Filename, nil)
  581. goji.DefaultMux.ServeHTTP(w, req)
  582. if w.Code != 404 {
  583. t.Fatal("Status code was not 404, but " + strconv.Itoa(w.Code))
  584. }
  585. // Make sure torrent is gone too
  586. w = httptest.NewRecorder()
  587. req, err = http.NewRequest("GET", "/"+myjson.Filename+"/torrent", nil)
  588. goji.DefaultMux.ServeHTTP(w, req)
  589. if w.Code != 404 {
  590. t.Fatal("Status code was not 404, but " + strconv.Itoa(w.Code))
  591. }
  592. }
  593. func TestShutdown(t *testing.T) {
  594. os.RemoveAll(Config.filesDir)
  595. os.RemoveAll(Config.metaDir)
  596. }