diff options
-rw-r--r-- | grumpy/models.py | 3 | ||||
-rw-r--r-- | grumpy/testsuite/pkgmodel.py | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/grumpy/models.py b/grumpy/models.py index 31127a0..82a8c6f 100644 --- a/grumpy/models.py +++ b/grumpy/models.py @@ -221,11 +221,12 @@ class Package(db.Model): def rename(self, key): """Rename a package and all its ebuilds""" # Look up or create new category - cat = key.split('/')[0] + cat, pkg = key.split('/') c = Category.query.filter_by(name=cat).first() if not c: c = Category(cat) self.key = key + self.pkg = pkg self.category = c for ebuild in self.ebuilds.values(): ebuild.rename(key) diff --git a/grumpy/testsuite/pkgmodel.py b/grumpy/testsuite/pkgmodel.py index 4154141..0c65c91 100644 --- a/grumpy/testsuite/pkgmodel.py +++ b/grumpy/testsuite/pkgmodel.py @@ -157,8 +157,6 @@ class PkgModelTestCase(GrumpyTestCase): assert Developer.query.count() == 2 def test_package_rename(self): - data = {} - info = {'maintainers' : (), 'herds': ()} with self.app.test_request_context(): self.make_package(self.get_pkg('sys-apps/action-1.0-r2', {}, {})) assert Category.query.count() == 1 @@ -176,6 +174,7 @@ class PkgModelTestCase(GrumpyTestCase): assert p == None p = Package.query.filter_by(key='sys-fail/kala').first() assert p != None + assert p.pkg == 'kala' e = Ebuild.query.first() assert e.cpv == 'sys-fail/kala-1.0-r2' |