Improve testing across the max downloads per domain.
This commit is contained in:
parent
7007d92c07
commit
c5d1b35955
@ -68,9 +68,9 @@ func TestUpdateMetadata(t *testing.T) {
|
|||||||
func TestQueue(t *testing.T) {
|
func TestQueue(t *testing.T) {
|
||||||
conf := config.TestConfig()
|
conf := config.TestConfig()
|
||||||
|
|
||||||
new1 := Download{Id: 1, State: "queued", DownloadProfile: conf.DownloadProfiles[0], Config: conf}
|
new1 := Download{Id: 1, Url: "http://domain1.com/foo", State: "queued", DownloadProfile: conf.DownloadProfiles[0], Config: conf}
|
||||||
new2 := Download{Id: 2, State: "queued", DownloadProfile: conf.DownloadProfiles[0], Config: conf}
|
new2 := Download{Id: 2, Url: "http://domain1.com/foo", State: "queued", DownloadProfile: conf.DownloadProfiles[0], Config: conf}
|
||||||
new3 := Download{Id: 3, State: "queued", DownloadProfile: conf.DownloadProfiles[0], Config: conf}
|
new3 := Download{Id: 3, Url: "http://domain1.com/foo", State: "queued", DownloadProfile: conf.DownloadProfiles[0], Config: conf}
|
||||||
new4 := Download{Id: 4, Url: "http://company.org/", State: "queued", DownloadProfile: conf.DownloadProfiles[0], Config: conf}
|
new4 := Download{Id: 4, Url: "http://company.org/", State: "queued", DownloadProfile: conf.DownloadProfiles[0], Config: conf}
|
||||||
|
|
||||||
dls := Downloads{&new1, &new2, &new3, &new4}
|
dls := Downloads{&new1, &new2, &new3, &new4}
|
||||||
@ -101,4 +101,30 @@ func TestQueue(t *testing.T) {
|
|||||||
t.Error("#4 was not started but it should be")
|
t.Error("#4 was not started but it should be")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reset them all
|
||||||
|
dls[0].State = "queued"
|
||||||
|
dls[1].State = "queued"
|
||||||
|
dls[2].State = "queued"
|
||||||
|
dls[3].State = "queued"
|
||||||
|
|
||||||
|
dls.StartQueued(0)
|
||||||
|
|
||||||
|
// they should all be going
|
||||||
|
if dls[0].State == "queued" || dls[1].State == "queued" || dls[2].State == "queued" || dls[3].State == "queued" {
|
||||||
|
t.Error("none should be queued")
|
||||||
|
}
|
||||||
|
|
||||||
|
// reset them all
|
||||||
|
dls[0].State = "queued"
|
||||||
|
dls[1].State = "queued"
|
||||||
|
dls[2].State = "queued"
|
||||||
|
dls[3].State = "queued"
|
||||||
|
|
||||||
|
dls.StartQueued(2)
|
||||||
|
|
||||||
|
// first two should be running, third not (same domain) and 4th running (different domain)
|
||||||
|
if dls[0].State == "queued" || dls[1].State == "queued" || dls[2].State != "queued" || dls[3].State == "queued" {
|
||||||
|
t.Error("incorrect queued")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user