diff options
Diffstat (limited to 'grumpy/testsuite/favorites.py')
-rw-r--r-- | grumpy/testsuite/favorites.py | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/grumpy/testsuite/favorites.py b/grumpy/testsuite/favorites.py index 4add8d4..827a490 100644 --- a/grumpy/testsuite/favorites.py +++ b/grumpy/testsuite/favorites.py @@ -32,30 +32,29 @@ class FavoritesTestCase(GrumpyTestCase): return u def test_favorites(self): - with self.app.test_request_context(): - u = self.make_users() - assert User.query.count() == 2 - for i in self.ps: - self.make_package(self.get_pkg(i, self.d2, self.d1)) - assert Package.query.count() == len(self.ps) - - # Fetch some packages - pkgs = Package.query.filter(Package.key.in_(\ - ['sys-test/kala', 'kala-base/appp', 'sys-apps/ssss'])).all() - for p in pkgs: - u[0].favorites.append(p) - pkgs = Package.query.filter(Package.key.in_(\ - ['sys-apps/fffuuu', 'kala-base/appp'])).all() - for p in pkgs: - u[1].favorites.append(p) - self.db.session.commit() + u = self.make_users() + assert User.query.count() == 2 + for i in self.ps: + self.make_package(self.get_pkg(i, self.d2, self.d1)) + assert Package.query.count() == len(self.ps) + + # Fetch some packages + pkgs = Package.query.filter(Package.key.in_(\ + ['sys-test/kala', 'kala-base/appp', 'sys-apps/ssss'])).all() + for p in pkgs: + u[0].favorites.append(p) + pkgs = Package.query.filter(Package.key.in_(\ + ['sys-apps/fffuuu', 'kala-base/appp'])).all() + for p in pkgs: + u[1].favorites.append(p) + self.db.session.commit() - assert len(u[0].favorites) == 3 - assert len(u[1].favorites) == 2 - p = Package.query.filter_by(key='sys-apps/ssss').one() - assert len(p.favorites) == 1 - p = Package.query.filter_by(key='kala-base/appp').one() - assert len(p.favorites) == 2 + assert len(u[0].favorites) == 3 + assert len(u[1].favorites) == 2 + p = Package.query.filter_by(key='sys-apps/ssss').one() + assert len(p.favorites) == 1 + p = Package.query.filter_by(key='kala-base/appp').one() + assert len(p.favorites) == 2 def suite(): |