Commit b41b2ed1 authored by Lukas Böhm's avatar Lukas Böhm 🎱
Browse files

better reset

parent 18c17f0f
......@@ -64,12 +64,16 @@ func Reset() {
// delete everything
db.Where("1 = 1").Delete(Share{})
db.Where("1 = 1").Delete(Attachment{})
os.RemoveAll(filepath.Join(config.mediaDir, "data"))
os.RemoveAll(filepath.Join(config.mediaDir, "temp"))
// create everything
for _, sh := range shares {
db.Create(&sh)
}
os.MkdirAll(filepath.Join(config.mediaDir, "data"), os.ModePerm)
os.MkdirAll(filepath.Join(config.mediaDir, "temp"), os.ModePerm)
// testfile
ioutil.WriteFile(filepath.Join(config.mediaDir, "kekw.txt"), []byte("Hallo welt"), os.ModePerm)
ioutil.WriteFile(filepath.Join(config.mediaDir, "poggers.txt"), []byte("Hallo welt"), os.ModePerm)
}
/////////////////////////////////////
......@@ -167,7 +171,7 @@ func TestOpenShare(t *testing.T) {
Attachments: []Attachment {
{
ID: uuid.MustParse("2b524827-9c3c-47e0-9277-8b51fd45b4bd"),
Filename: "kekw.txt",
Filename: "hallo.txt",
Filesize: 123456,
IsEncrypted: false,
ShareID: uuid.MustParse("e5134044-2704-4864-85be-318fb158009f"),
......@@ -212,6 +216,7 @@ func TestCloseShare(t *testing.T) {
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
assert.Equal(t, http.StatusOK, res.StatusCode)
})
......
Supports Markdown
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