Adds tests for AlbumDatabase
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
@@ -83,6 +84,7 @@ func GetCsvData() *bytes.Buffer {
|
||||
}
|
||||
|
||||
func init() {
|
||||
start := time.Now()
|
||||
albumsPath := filepath.Join("testdata", "albums.json")
|
||||
f, err := os.Open(albumsPath)
|
||||
if err != nil {
|
||||
@@ -95,10 +97,12 @@ func init() {
|
||||
panic(fmt.Sprintf("Could not parse '%s': %s", albumsPath, err))
|
||||
}
|
||||
|
||||
log.Printf("loaded test data in %s", time.Since(start))
|
||||
start = time.Now()
|
||||
dv := diskv.New(diskv.Options{
|
||||
BasePath: filepath.Join("testdata", "web-cache"),
|
||||
CacheSizeMax: 100 * 1024 * 1024, // 100MB
|
||||
})
|
||||
testGetter = httpcache.NewTransport(diskcache.NewWithDiskv(dv)).Client()
|
||||
|
||||
log.Printf("loaded httpcache in %s", time.Since(start))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user