-
Notifications
You must be signed in to change notification settings - Fork 0
/
imdb_test.go
58 lines (48 loc) · 943 Bytes
/
imdb_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package main
import "testing"
import "os"
import "fmt"
func CIMDB() *IMDB {
c := (Config{})
c.TempPath = "tmp/"
c.DBPath = "tmp/"
os.Mkdir("tmp", os.ModePerm)
i := IMDB{conf:&c}
i.SetupDB()
return &i
}
func TestDownload(t *testing.T) {
/*
fmt.Println("test download")
i := CIMDB()
i.downloadData()
expectedFiles := []string{"title.basics.tsv.gz", "title.ratings.tsv.gz"}
for _,f := range expectedFiles {
if _, err := os.Stat(path.Join(i.conf.TempPath, f)); err != nil {
t.FailNow()
}
}
*/
}
func TestUpdateIMDB(t *testing.T) {
return
fmt.Println("test update")
i := CIMDB()
i.UpdateData()
i.db.Close()
}
func TestIMDBAccuracy(t *testing.T) {
fmt.Println("test accuracy")
i := CIMDB()
/*idd := i.GetIdForMovie("", 0)
fmt.Println(idd)
if idd != "" {
t.FailNow()
}*/
rating, _ := i.GetRating(i.GetIdForShow("Narcos"))
fmt.Println(rating)
if rating < 8 {
panic("")
t.FailNow()
}
}