mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-15 11:57:59 +00:00
New upstream version 1.5.0+ds1
This commit is contained in:
+14
-3
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
|
||||
"github.com/aptly-dev/aptly/database"
|
||||
"github.com/aptly-dev/aptly/database/goleveldb"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
@@ -18,7 +19,7 @@ type LocalRepoSuite struct {
|
||||
var _ = Suite(&LocalRepoSuite{})
|
||||
|
||||
func (s *LocalRepoSuite) SetUpTest(c *C) {
|
||||
s.db, _ = database.NewOpenDB(c.MkDir())
|
||||
s.db, _ = goleveldb.NewOpenDB(c.MkDir())
|
||||
s.list = NewPackageList()
|
||||
s.list.Add(&Package{Name: "lib", Version: "1.7", Architecture: "i386"})
|
||||
s.list.Add(&Package{Name: "app", Version: "1.9", Architecture: "amd64"})
|
||||
@@ -83,7 +84,7 @@ type LocalRepoCollectionSuite struct {
|
||||
var _ = Suite(&LocalRepoCollectionSuite{})
|
||||
|
||||
func (s *LocalRepoCollectionSuite) SetUpTest(c *C) {
|
||||
s.db, _ = database.NewOpenDB(c.MkDir())
|
||||
s.db, _ = goleveldb.NewOpenDB(c.MkDir())
|
||||
s.collection = NewLocalRepoCollection(s.db)
|
||||
|
||||
s.list = NewPackageList()
|
||||
@@ -198,5 +199,15 @@ func (s *LocalRepoCollectionSuite) TestDrop(c *C) {
|
||||
r2, _ := collection.ByName("local2")
|
||||
c.Check(r2.String(), Equals, repo2.String())
|
||||
|
||||
c.Check(func() { s.collection.Drop(repo1) }, Panics, "local repo not found!")
|
||||
c.Check(s.collection.Drop(repo1), ErrorMatches, "local repo not found")
|
||||
}
|
||||
|
||||
func (s *LocalRepoCollectionSuite) TestDropNonExisting(c *C) {
|
||||
repo := NewLocalRepo("local3", "Comment 3")
|
||||
|
||||
_, err := s.collection.ByUUID(repo.UUID)
|
||||
c.Check(err, ErrorMatches, "local repo .* not found")
|
||||
|
||||
err = s.collection.Drop(repo)
|
||||
c.Check(s.collection.Drop(repo), ErrorMatches, "local repo not found")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user