Makes all tests pass green again
* Removed a concurrent write condition that was happening while fetching BD * Updated the local test database to match bedetheque.com state * Note field being highly dynamic removed test from it.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"path/filepath"
|
||||
"time"
|
||||
@@ -43,14 +44,19 @@ func (s *AlbumDatabaseSuite) TestCanGet(c *C) {
|
||||
|
||||
func (s *AlbumDatabaseSuite) TestCanSort(c *C) {
|
||||
start := time.Now()
|
||||
data := []AlbumID{160366, 58595, 15875, 9935, 84448, 46005, 19762, 164, 52100, 8179, 44989, 32043, 22737, 754}
|
||||
|
||||
sorted, err := s.db.ByPurchaseDate()
|
||||
|
||||
log.Printf("sorting took %s", time.Since(start))
|
||||
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(len(sorted), Equals, len(data))
|
||||
for i, a := range sorted {
|
||||
c.Check(a, Equals, data[i], Commentf("expected %d", a))
|
||||
c.Assert(len(sorted) > 0, Equals, true)
|
||||
last := time.Now()
|
||||
for _, a := range sorted {
|
||||
al, err := s.db.get(fmt.Sprintf("%d", a))
|
||||
if c.Check(err, IsNil) == false {
|
||||
continue
|
||||
}
|
||||
c.Check(last.After(al.PurchaseDate), Equals, true)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user