diff options
author | 2010-08-02 00:37:22 +0300 | |
---|---|---|
committer | 2010-08-02 00:37:22 +0300 | |
commit | 702c5e59527d0e49b02d6bda3e904ba0e011fcbd (patch) | |
tree | a9d305cc02d380dcadfc56a1f31c5d2e4f4b0fce | |
parent | Added simple tests for Package (diff) | |
download | gsoc2010-grumpy-702c5e59527d0e49b02d6bda3e904ba0e011fcbd.tar.gz gsoc2010-grumpy-702c5e59527d0e49b02d6bda3e904ba0e011fcbd.tar.bz2 gsoc2010-grumpy-702c5e59527d0e49b02d6bda3e904ba0e011fcbd.zip |
Simplify Category -> Package mapping
-rw-r--r-- | grumpy/models.py | 2 | ||||
-rw-r--r-- | grumpy/testsuite/pkgmodel.py | 14 |
2 files changed, 9 insertions, 7 deletions
diff --git a/grumpy/models.py b/grumpy/models.py index cdebe33..cf33adb 100644 --- a/grumpy/models.py +++ b/grumpy/models.py @@ -38,7 +38,7 @@ class Category(db.Model): packages = db.relationship("Package", backref='category', \ cascade='all, delete, delete-orphan', \ - collection_class=column_mapped_collection(db.text('packages.pkg_cat'))) + collection_class=column_mapped_collection(db.text('packages.pkg'))) def __init__(self, name): self.name = name diff --git a/grumpy/testsuite/pkgmodel.py b/grumpy/testsuite/pkgmodel.py index 44f9dbe..a24b146 100644 --- a/grumpy/testsuite/pkgmodel.py +++ b/grumpy/testsuite/pkgmodel.py @@ -48,21 +48,23 @@ class PkgModelTestCase(GrumpyTestCase): assert Category.query.count() == 2 ## Create and test packages - for p in (p1, p2): - x = Package(p) - c[0].packages[x.pkg_cat] = x - x = Package(p3) - c[1].packages[x.pkg_cat] = x + c[0].packages[p1.package] = Package(p1) + c[0].packages[p2.package] = Package(p2) + c[1].packages[p3.package] = Package(p3) self.db.session.commit() assert Package.query.count() == 2 + # TODO: assert p.category vs package.category.name - # Query info p = Package.query.filter_by(pkg_cat='testpkg/%s' % C1).first() assert p.pkg == 'testpkg' assert p.desc == 'this is description' assert p.ldesc == 'this is longdescription' assert p.homepage == 'http://example.org/testpkg-app-misc' assert p.category.name == C1 + # TODO: herds, maintainers + + # Create and test ebuilds + # TODO: ... def make_packages_and_ebuild(self, categories): # Create package... |