diff options
Diffstat (limited to 'grumpy/testsuite/__init__.py')
-rw-r--r-- | grumpy/testsuite/__init__.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/grumpy/testsuite/__init__.py b/grumpy/testsuite/__init__.py index eb7540c..67242c6 100644 --- a/grumpy/testsuite/__init__.py +++ b/grumpy/testsuite/__init__.py @@ -13,10 +13,20 @@ import copy, unittest from pkgcore.ebuild import ebuild_src, repo_objs from grumpy import app -from grumpy.models import db +from grumpy.models import db, Category, Package class GrumpyTestCase(unittest.TestCase): + def make_package(self, package): + with self.app.test_request_context(): + cat = package.key.split('/')[0] + c = Category.query.filter_by(name=cat).first() + if not c: + c = Category(cat) + self.db.session.add(c) + c.packages[package.key] = Package(package) + self.db.session.commit() + def get_pkg(self, cpv, pkg_data={}, data={}): """Returns a custom ebuild""" # We need to set up info from metadata.xml separately |