From 532edf85eb036631d7d007a4a2db7728edf12bb7 Mon Sep 17 00:00:00 2001 From: eliott Date: Thu, 17 Apr 2008 23:56:18 -0700 Subject: Modified get_depends handling slightly --- main/models.py | 6 +++--- main/tests.py | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'main') diff --git a/main/models.py b/main/models.py index ef8f6cd1..333becca 100644 --- a/main/models.py +++ b/main/models.py @@ -235,11 +235,11 @@ def get_depends(self): if len(pkgs) == 0: # couldn't find a package in the DB # it should be a virtual depend (or a removed package) - deps.append((None, dep.depname, None)) + deps.append({'dep': dep, 'pkg': None}) continue else: - for p in pkgs: - deps.append((p.id,dep.depname,dep.depvcmp)) + for pkg in pkgs: + deps.append({'dep': dep, 'pkg': pkg}) return deps class PackageFile(models.Model): diff --git a/main/tests.py b/main/tests.py index 7b870c92..d0e87729 100644 --- a/main/tests.py +++ b/main/tests.py @@ -21,7 +21,10 @@ def testPackageGetDepends(self): Test the Package object's get_depends() method """ p = Package.objects.get(pkgname='abs',arch__name__iexact='i686') - expected = [(7L, 'bash', ''), (None, 'rsync', None)] + dep1 = {'dep': PackageDepend.objects.get(id=1), + 'pkg': Package.objects.get(id=7)} + dep2 = {'dep': PackageDepend.objects.get(id=2), 'pkg': None} + expected = [dep1, dep2] results = p.get_depends() self.failUnlessEqual(results, expected) del p -- cgit v1.2.3-54-g00ecf