Rename private_announce_test to a shorter name

This commit is contained in:
Justin Li 2014-07-15 22:54:59 -04:00
parent c745c791a5
commit 660fbef778

View file

@ -15,44 +15,6 @@ import (
_ "github.com/chihaya/chihaya/drivers/tracker/memory"
)
func loadTestData(tkr *Tracker) error {
conn, err := tkr.tp.Get()
if err != nil {
return err
}
users := []string{
"vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv1",
"vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv2",
"vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv3",
}
for i, passkey := range users {
err = conn.PutUser(&models.User{
ID: uint64(i + 1),
Passkey: passkey,
})
if err != nil {
return err
}
}
err = conn.PutClient("TR2820")
if err != nil {
return err
}
torrent := &models.Torrent{
ID: 1,
Infohash: infoHash,
Seeders: make(map[string]models.Peer),
Leechers: make(map[string]models.Peer),
}
return conn.PutTorrent(torrent)
}
func TestPrivateAnnounce(t *testing.T) {
cfg := config.DefaultConfig
cfg.Private = true
@ -102,3 +64,41 @@ func TestPrivateAnnounce(t *testing.T) {
srv.URL = baseURL + "/users/vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv1"
checkAnnounce(peer, expected, srv, t)
}
func loadTestData(tkr *Tracker) error {
conn, err := tkr.tp.Get()
if err != nil {
return err
}
users := []string{
"vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv1",
"vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv2",
"vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv3",
}
for i, passkey := range users {
err = conn.PutUser(&models.User{
ID: uint64(i + 1),
Passkey: passkey,
})
if err != nil {
return err
}
}
err = conn.PutClient("TR2820")
if err != nil {
return err
}
torrent := &models.Torrent{
ID: 1,
Infohash: infoHash,
Seeders: make(map[string]models.Peer),
Leechers: make(map[string]models.Peer),
}
return conn.PutTorrent(torrent)
}