Merge lp:~wgrant/launchpad/bprdc into lp:launchpad/db-devel

Proposed by William Grant
Status: Merged
Approved by: Henning Eggers
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~wgrant/launchpad/bprdc
Merge into: lp:launchpad/db-devel
Prerequisite: lp:~wgrant/launchpad/get-bpr-by-filename
Diff against target: 343 lines (+204/-7)
7 files modified
database/schema/patch-2207-36-0.sql (+15/-0)
database/schema/security.cfg (+1/-0)
lib/lp/soyuz/interfaces/archive.py (+14/-0)
lib/lp/soyuz/interfaces/binarypackagerelease.py (+23/-4)
lib/lp/soyuz/model/archive.py (+15/-0)
lib/lp/soyuz/model/binarypackagerelease.py (+33/-2)
lib/lp/soyuz/tests/test_archive.py (+103/-1)
To merge this branch: bzr merge lp:~wgrant/launchpad/bprdc
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve
Henning Eggers (community) code Approve
Björn Tillenius (community) db Approve
Stuart Bishop (community) db Approve
Review via email: mp+21213@code.launchpad.net

Commit message

Add the model for PPA download stats. Landed by henninge.

Description of the change

This branch adds the model for PPA binary download stats. BinaryPackageReleaseDownloadCount is the class and DB table, with a new Archive.updatePackageDownloadCount to create and update them. See bug #139855 for discussion on the issue -- the only thing with which everybody is agreed about collecting is counts for each binary package release in each archive.

BinaryPackageReleaseDownloadCounts will be managed by my next few branches, with the parse-ppa-apache-logs.py script. Otherwise very closely modeled on LibraryFileDownloadCount, it will store counts with an (archive, bpr) key rather than just (lfa,).

To post a comment you must log in.
Revision history for this message
Stuart Bishop (stub) wrote :

Looks good. DB patch approved by me as patch-2207-36-0.sql.

We might need an extra index or three depending on what reports we generate from this information. I think the reports I think we will generate will be fine with the index from the UNIQUE constraint so no worries for now.

review: Approve (db)
Revision history for this message
Björn Tillenius (bjornt) wrote :

On Fri, Mar 12, 2010 at 07:20:53AM -0000, William Grant wrote:
> William Grant has proposed merging lp:~wgrant/launchpad/bprdc into lp:launchpad with lp:~wgrant/launchpad/get-bpr-by-filename as a prerequisite.
>
> Requested reviews:
> Björn Tillenius (bjornt): db
> Stuart Bishop (stub): db
> Canonical Launchpad Engineering (launchpad)
>
>
> This branch adds the model for PPA binary download stats.
> BinaryPackageReleaseDownloadCount is the class and DB table, with a new
> Archive.updatePackageDownloadCount to create and update them. See bug
> #139855 for discussion on the issue -- the only thing with which
> everybody is agreed about collecting is counts for each binary package
> release in each archive.

I think this patch is ok, although I have a few questions (and a comment
on the patch itself further down). I'll be on vacation next week, so I
won't block a landing of the patch, waiting for the replies, as long as
my comments are considered, but I'm marking it as needsinfo so that I
can track the discussion more easily.

    vote needsinfo

Can you explain shortly how BinaryPackageRelease relates to archive and
series? As I understand it, this is only for PPAs, right, since we can't
track the downloads of other archives? Would it make sense to make the
name a bit more specific in that case? At the very least, comments.sql
should explain this. Or will this be used by other archives than PPA
ones?

I couldn't find where everybody agreed about collecting counts for each
binary package release. Can you point me to the right place?

What other things are we likely to want to track in the future, if any?

> === added file 'database/schema/patch-2207-99-0.sql'
> --- database/schema/patch-2207-99-0.sql 1970-01-01 00:00:00 +0000
> +++ database/schema/patch-2207-99-0.sql 2010-03-12 07:20:45 +0000
> @@ -0,0 +1,15 @@
> +SET client_min_messages=ERROR;
> +
> +CREATE TABLE BinaryPackageReleaseDownloadCount (
> + id serial PRIMARY KEY,
> + archive integer NOT NULL REFERENCES Archive,
> + binary_package_release integer NOT NULL REFERENCES BinaryPackageRelease,
> + day date NOT NULL,
> + country integer,
> + count integer NOT NULL
> +);
> +
> +ALTER TABLE BinaryPackageReleaseDownloadCount ADD CONSTRAINT binarypackagereleasedownloadcount__archive__binary_package_release__day__country__key
> + UNIQUE (archive, binary_package_release, day, country);
> +
> +INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 99, 0);

Shouldn't country be a foreign key to Country?

And looking at the tests, I didn't see any tests for not specifying the
country. That would be good to have.

--
Björn Tillenius | https://launchpad.net/~bjornt

review: Needs Information
Revision history for this message
William Grant (wgrant) wrote :
Download full text (3.6 KiB)

On Fri, 2010-03-12 at 09:42 +0000, Björn Tillenius wrote:
> Review: Needs Information
> On Fri, Mar 12, 2010 at 07:20:53AM -0000, William Grant wrote:
> > William Grant has proposed merging lp:~wgrant/launchpad/bprdc into lp:launchpad with lp:~wgrant/launchpad/get-bpr-by-filename as a prerequisite.
> >
> > Requested reviews:
> > Björn Tillenius (bjornt): db
> > Stuart Bishop (stub): db
> > Canonical Launchpad Engineering (launchpad)
> >
> >
> > This branch adds the model for PPA binary download stats.
> > BinaryPackageReleaseDownloadCount is the class and DB table, with a new
> > Archive.updatePackageDownloadCount to create and update them. See bug
> > #139855 for discussion on the issue -- the only thing with which
> > everybody is agreed about collecting is counts for each binary package
> > release in each archive.
>
> I think this patch is ok, although I have a few questions (and a comment
> on the patch itself further down). I'll be on vacation next week, so I
> won't block a landing of the patch, waiting for the replies, as long as
> my comments are considered, but I'm marking it as needsinfo so that I
> can track the discussion more easily.

Thanks.

> vote needsinfo
>
> Can you explain shortly how BinaryPackageRelease relates to archive and
> series? As I understand it, this is only for PPAs, right, since we can't
> track the downloads of other archives? Would it make sense to make the
> name a bit more specific in that case? At the very least, comments.sql
> should explain this. Or will this be used by other archives than PPA
> ones?

A BinaryPackageRelease can be published in any number of archives and
distribution series (linked by BinaryPackagePublishingHistory). There
was talk a couple of months ago about a desire to use this for the
partner archive too -- I'm not sure if that's still on the cards, but
this schema works fine for that too, and the subsequent branches would
need only slight extension.

The primarily archive is more impossible, since it is heavily mirrored
across hundreds of hosts.

> I couldn't find where everybody agreed about collecting counts for each
> binary package release. Can you point me to the right place?
>
> What other things are we likely to want to track in the future, if any?

The last few comments all speak of counting binaries and indices, but no
concrete method of usefully counting index downloads has yet been
mentioned, and it's much much harder to get right (it involves lots of
guessing). Binary counting is easy and a good first step.

>
> > === added file 'database/schema/patch-2207-99-0.sql'
> > --- database/schema/patch-2207-99-0.sql 1970-01-01 00:00:00 +0000
> > +++ database/schema/patch-2207-99-0.sql 2010-03-12 07:20:45 +0000
> > @@ -0,0 +1,15 @@
> > +SET client_min_messages=ERROR;
> > +
> > +CREATE TABLE BinaryPackageReleaseDownloadCount (
> > + id serial PRIMARY KEY,
> > + archive integer NOT NULL REFERENCES Archive,
> > + binary_package_release integer NOT NULL REFERENCES BinaryPackageRelease,
> > + day date NOT NULL,
> > + country integer,
> > + count integer NOT NULL
> > +);
> > +
> > +ALTER TABLE BinaryPackageReleaseDownloadCount ADD CONSTRAINT binar...

Read more...

Revision history for this message
Stuart Bishop (stub) wrote :

The FOREIGN KEY reference to Country is correct. Thanks.

review: Approve (db)
Revision history for this message
Björn Tillenius (bjornt) :
review: Approve (db)
Revision history for this message
Henning Eggers (henninge) wrote :

All is well. Thank you. ;-)

review: Approve (code)
Revision history for this message
Julian Edwards (julian-edwards) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'database/schema/patch-2207-36-0.sql'
--- database/schema/patch-2207-36-0.sql 1970-01-01 00:00:00 +0000
+++ database/schema/patch-2207-36-0.sql 2010-03-15 10:41:18 +0000
@@ -0,0 +1,15 @@
1SET client_min_messages=ERROR;
2
3CREATE TABLE BinaryPackageReleaseDownloadCount (
4 id serial PRIMARY KEY,
5 archive integer NOT NULL REFERENCES Archive,
6 binary_package_release integer NOT NULL REFERENCES BinaryPackageRelease,
7 day date NOT NULL,
8 country integer REFERENCES Country,
9 count integer NOT NULL
10);
11
12ALTER TABLE BinaryPackageReleaseDownloadCount ADD CONSTRAINT binarypackagereleasedownloadcount__archive__binary_package_release__day__country__key
13 UNIQUE (archive, binary_package_release, day, country);
14
15INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 36, 0);
016
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg 2010-03-15 06:23:18 +0000
+++ database/schema/security.cfg 2010-03-15 10:41:18 +0000
@@ -131,6 +131,7 @@
131public.authtoken = SELECT, INSERT, UPDATE, DELETE131public.authtoken = SELECT, INSERT, UPDATE, DELETE
132public.binaryandsourcepackagenameview = SELECT132public.binaryandsourcepackagenameview = SELECT
133public.binarypackagepublishinghistory = SELECT133public.binarypackagepublishinghistory = SELECT
134public.binarypackagereleasedownloadcount= SELECT, INSERT, UPDATE
134public.bountysubscription = SELECT, INSERT, UPDATE, DELETE135public.bountysubscription = SELECT, INSERT, UPDATE, DELETE
135public.branchrevision = SELECT, INSERT, UPDATE, DELETE136public.branchrevision = SELECT, INSERT, UPDATE, DELETE
136public.branch = SELECT, INSERT, UPDATE, DELETE137public.branch = SELECT, INSERT, UPDATE, DELETE
137138
=== modified file 'lib/lp/soyuz/interfaces/archive.py'
--- lib/lp/soyuz/interfaces/archive.py 2010-03-12 06:19:52 +0000
+++ lib/lp/soyuz/interfaces/archive.py 2010-03-15 10:41:18 +0000
@@ -647,6 +647,20 @@
647 archive.647 archive.
648 """648 """
649649
650 def updatePackageDownloadCount(bpr, day, country, count):
651 """Update the daily download count for a given package.
652
653 :param bpr: The `IBinaryPackageRelease` to update the count for.
654 :param day: The date to update the count for.
655 :param country: The `ICountry` to update the count for.
656 :param count: The new download count.
657
658 If there's no matching `IBinaryPackageReleaseDownloadCount` entry,
659 we create one with the given count. Otherwise we just increase the
660 count of the existing one by the given amount.
661 """
662
663
650class IArchiveView(IHasBuildRecords):664class IArchiveView(IHasBuildRecords):
651 """Archive interface for operations restricted by view privilege."""665 """Archive interface for operations restricted by view privilege."""
652666
653667
=== modified file 'lib/lp/soyuz/interfaces/binarypackagerelease.py'
--- lib/lp/soyuz/interfaces/binarypackagerelease.py 2009-06-25 04:06:00 +0000
+++ lib/lp/soyuz/interfaces/binarypackagerelease.py 2010-03-15 10:41:18 +0000
@@ -11,17 +11,18 @@
11 'BinaryPackageFileType',11 'BinaryPackageFileType',
12 'BinaryPackageFormat',12 'BinaryPackageFormat',
13 'IBinaryPackageRelease',13 'IBinaryPackageRelease',
14 'IBinaryPackageReleaseDownloadCount',
14 'IBinaryPackageReleaseSet',15 'IBinaryPackageReleaseSet',
15 ]16 ]
1617
17from zope.schema import Bool, Int, Text, TextLine, Datetime18from lazr.enum import DBEnumeratedType, DBItem
19from lazr.restful.fields import Reference
20from zope.schema import Bool, Choice, Date, Int, Text, TextLine, Datetime
18from zope.interface import Interface, Attribute21from zope.interface import Interface, Attribute
1922
20from canonical.launchpad import _23from canonical.launchpad import _
21
22from canonical.launchpad.validators.version import valid_debian_version24from canonical.launchpad.validators.version import valid_debian_version
2325from lp.soyuz.interfaces.archive import IArchive
24from lazr.enum import DBEnumeratedType, DBItem
2526
2627
27class IBinaryPackageRelease(Interface):28class IBinaryPackageRelease(Interface):
@@ -79,6 +80,7 @@
79 argument remains untouched.80 argument remains untouched.
80 """81 """
8182
83
82class IBinaryPackageReleaseSet(Interface):84class IBinaryPackageReleaseSet(Interface):
83 """A set of binary packages"""85 """A set of binary packages"""
8486
@@ -91,6 +93,23 @@
91 """Get an BinaryPackageRelease in a DistroSeries by its name"""93 """Get an BinaryPackageRelease in a DistroSeries by its name"""
9294
9395
96class IBinaryPackageReleaseDownloadCount(Interface):
97 """Daily download count of a binary package release in an archive."""
98
99 archive = Reference(
100 title=_('The archive'), schema=IArchive, required=True,
101 readonly=True)
102 binary_package_release = Reference(
103 title=_('The binary package release'), schema=IBinaryPackageRelease,
104 required=True, readonly=True)
105 day = Date(
106 title=_('The day of the downloads'), required=True, readonly=True)
107 count = Int(
108 title=_('The number of downloads'), required=True, readonly=False)
109 country = Choice(
110 title=_('Country'), required=False, vocabulary='CountryName')
111
112
94class BinaryPackageFileType(DBEnumeratedType):113class BinaryPackageFileType(DBEnumeratedType):
95 """Binary Package File Type114 """Binary Package File Type
96115
97116
=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py 2010-03-12 06:19:52 +0000
+++ lib/lp/soyuz/model/archive.py 2010-03-15 10:41:18 +0000
@@ -39,6 +39,8 @@
39from lp.soyuz.model.archivedependency import ArchiveDependency39from lp.soyuz.model.archivedependency import ArchiveDependency
40from lp.soyuz.model.archiveauthtoken import ArchiveAuthToken40from lp.soyuz.model.archiveauthtoken import ArchiveAuthToken
41from lp.soyuz.model.archivesubscriber import ArchiveSubscriber41from lp.soyuz.model.archivesubscriber import ArchiveSubscriber
42from lp.soyuz.model.binarypackagerelease import (
43 BinaryPackageReleaseDownloadCount)
42from lp.soyuz.model.build import Build44from lp.soyuz.model.build import Build
43from lp.soyuz.model.distributionsourcepackagecache import (45from lp.soyuz.model.distributionsourcepackagecache import (
44 DistributionSourcePackageCache)46 DistributionSourcePackageCache)
@@ -1327,6 +1329,19 @@
1327 result_set.config(distinct=True).order_by(SourcePackageRelease.id)1329 result_set.config(distinct=True).order_by(SourcePackageRelease.id)
1328 return result_set1330 return result_set
13291331
1332 def updatePackageDownloadCount(self, bpr, day, country, count):
1333 """See `IArchive`."""
1334 store = Store.of(self)
1335 entry = store.find(
1336 BinaryPackageReleaseDownloadCount, archive=self,
1337 binary_package_release=bpr, day=day, country=country).one()
1338 if entry is None:
1339 entry = BinaryPackageReleaseDownloadCount(
1340 archive=self, binary_package_release=bpr, day=day,
1341 country=country, count=count)
1342 else:
1343 entry.count += count
1344
1330 def _setBuildStatuses(self, status):1345 def _setBuildStatuses(self, status):
1331 """Update the pending Build Jobs' status for this archive."""1346 """Update the pending Build Jobs' status for this archive."""
13321347
13331348
=== modified file 'lib/lp/soyuz/model/binarypackagerelease.py'
--- lib/lp/soyuz/model/binarypackagerelease.py 2009-06-25 04:06:00 +0000
+++ lib/lp/soyuz/model/binarypackagerelease.py 2010-03-15 10:41:18 +0000
@@ -4,18 +4,23 @@
4# pylint: disable-msg=E0611,W02124# pylint: disable-msg=E0611,W0212
55
6__metaclass__ = type6__metaclass__ = type
7__all__ = ['BinaryPackageRelease', 'BinaryPackageReleaseSet']7__all__ = [
8 'BinaryPackageRelease',
9 'BinaryPackageReleaseDownloadCount',
10 'BinaryPackageReleaseSet'
11 ]
812
913
10from zope.interface import implements14from zope.interface import implements
1115
12from sqlobject import StringCol, ForeignKey, IntCol, SQLMultipleJoin, BoolCol16from sqlobject import StringCol, ForeignKey, IntCol, SQLMultipleJoin, BoolCol
17from storm.locals import Date, Int, Reference, Storm
1318
14from canonical.database.sqlbase import SQLBase, quote, sqlvalues, quote_like19from canonical.database.sqlbase import SQLBase, quote, sqlvalues, quote_like
1520
16from lp.soyuz.interfaces.binarypackagerelease import (21from lp.soyuz.interfaces.binarypackagerelease import (
17 BinaryPackageFileType, BinaryPackageFormat, IBinaryPackageRelease,22 BinaryPackageFileType, BinaryPackageFormat, IBinaryPackageRelease,
18 IBinaryPackageReleaseSet)23 IBinaryPackageReleaseDownloadCount, IBinaryPackageReleaseSet)
19from lp.soyuz.interfaces.publishing import (24from lp.soyuz.interfaces.publishing import (
20 PackagePublishingPriority, PackagePublishingStatus)25 PackagePublishingPriority, PackagePublishingStatus)
21from canonical.database.enumcol import EnumCol26from canonical.database.enumcol import EnumCol
@@ -199,3 +204,29 @@
199204
200 return query, clauseTables205 return query, clauseTables
201206
207
208class BinaryPackageReleaseDownloadCount(Storm):
209 """See `IBinaryPackageReleaseDownloadCount`."""
210
211 implements(IBinaryPackageReleaseDownloadCount)
212 __storm_table__ = 'BinaryPackageReleaseDownloadCount'
213
214 id = Int(primary=True)
215 archive_id = Int(name='archive', allow_none=False)
216 archive = Reference(archive_id, 'Archive.id')
217 binary_package_release_id = Int(
218 name='binary_package_release', allow_none=False)
219 binary_package_release = Reference(
220 binary_package_release_id, 'BinaryPackageRelease.id')
221 day = Date(allow_none=False)
222 country_id = Int(name='country', allow_none=True)
223 country = Reference(country_id, 'Country.id')
224 count = Int(allow_none=False)
225
226 def __init__(self, archive, binary_package_release, day, country, count):
227 super(BinaryPackageReleaseDownloadCount, self).__init__()
228 self.archive = archive
229 self.binary_package_release = binary_package_release
230 self.day = day
231 self.country = country
232 self.count = count
202233
=== modified file 'lib/lp/soyuz/tests/test_archive.py'
--- lib/lp/soyuz/tests/test_archive.py 2010-03-12 06:19:52 +0000
+++ lib/lp/soyuz/tests/test_archive.py 2010-03-15 10:41:18 +0000
@@ -3,7 +3,7 @@
33
4"""Test Archive features."""4"""Test Archive features."""
55
6from datetime import datetime, timedelta6from datetime import date, datetime, timedelta
7import pytz7import pytz
8import unittest8import unittest
99
@@ -19,6 +19,7 @@
19from lp.registry.interfaces.distribution import IDistributionSet19from lp.registry.interfaces.distribution import IDistributionSet
20from lp.registry.interfaces.person import IPersonSet20from lp.registry.interfaces.person import IPersonSet
21from lp.services.job.interfaces.job import JobStatus21from lp.services.job.interfaces.job import JobStatus
22from lp.services.worlddata.interfaces.country import ICountrySet
22from lp.soyuz.interfaces.archive import (23from lp.soyuz.interfaces.archive import (
23 IArchiveSet, ArchivePurpose, CannotSwitchPrivacy)24 IArchiveSet, ArchivePurpose, CannotSwitchPrivacy)
24from lp.soyuz.interfaces.archivearch import IArchiveArchSet25from lp.soyuz.interfaces.archivearch import IArchiveArchSet
@@ -26,6 +27,8 @@
26from lp.soyuz.interfaces.processor import IProcessorFamilySet27from lp.soyuz.interfaces.processor import IProcessorFamilySet
27from lp.soyuz.interfaces.publishing import PackagePublishingStatus28from lp.soyuz.interfaces.publishing import PackagePublishingStatus
28from lp.soyuz.model.build import Build29from lp.soyuz.model.build import Build
30from lp.soyuz.model.binarypackagerelease import (
31 BinaryPackageReleaseDownloadCount)
29from lp.soyuz.tests.test_publishing import SoyuzTestPublisher32from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
30from lp.testing import TestCaseWithFactory33from lp.testing import TestCaseWithFactory
3134
@@ -562,6 +565,105 @@
562 self.assertEqual('0.5.11~ppa1', pubs[0].source_package_version)565 self.assertEqual('0.5.11~ppa1', pubs[0].source_package_version)
563566
564567
568class TestUpdatePackageDownloadCount(TestCaseWithFactory):
569 """Ensure that updatePackageDownloadCount works as expected."""
570
571 layer = LaunchpadZopelessLayer
572
573 def setUp(self):
574 super(TestUpdatePackageDownloadCount, self).setUp()
575 self.publisher = SoyuzTestPublisher()
576 self.publisher.prepareBreezyAutotest()
577
578 self.store = getUtility(IStoreSelector).get(
579 MAIN_STORE, DEFAULT_FLAVOR)
580
581 self.archive = self.factory.makeArchive()
582 self.bpr_1 = self.publisher.getPubBinaries(
583 archive=self.archive)[0].binarypackagerelease
584 self.bpr_2 = self.publisher.getPubBinaries(
585 archive=self.archive)[0].binarypackagerelease
586
587 country_set = getUtility(ICountrySet)
588 self.australia = country_set['AU']
589 self.new_zealand = country_set['NZ']
590
591 def assertCount(self, count, archive, bpr, day, country):
592 self.assertEqual(count, self.store.find(
593 BinaryPackageReleaseDownloadCount,
594 archive=archive, binary_package_release=bpr,
595 day=day, country=country).one().count)
596
597 def test_creates_new_entry(self):
598 # The first update for a particular archive, package, day and
599 # country will create a new BinaryPackageReleaseDownloadCount
600 # entry.
601 day = date(2010, 2, 20)
602 self.assertIs(None, self.store.find(
603 BinaryPackageReleaseDownloadCount,
604 archive=self.archive, binary_package_release=self.bpr_1,
605 day=day, country=self.australia).one())
606 self.archive.updatePackageDownloadCount(
607 self.bpr_1, day, self.australia, 10)
608 self.assertCount(10, self.archive, self.bpr_1, day, self.australia)
609
610 def test_reuses_existing_entry(self):
611 # A second update will simply add to the count on the existing
612 # BPRDC.
613 day = date(2010, 2, 20)
614 self.archive.updatePackageDownloadCount(
615 self.bpr_1, day, self.australia, 10)
616 self.archive.updatePackageDownloadCount(
617 self.bpr_1, day, self.australia, 3)
618 self.assertCount(13, self.archive, self.bpr_1, day, self.australia)
619
620 def test_differentiates_between_countries(self):
621 # A different country will cause a new entry to be created.
622 day = date(2010, 2, 20)
623 self.archive.updatePackageDownloadCount(
624 self.bpr_1, day, self.australia, 10)
625 self.archive.updatePackageDownloadCount(
626 self.bpr_1, day, self.new_zealand, 3)
627
628 self.assertCount(10, self.archive, self.bpr_1, day, self.australia)
629 self.assertCount(3, self.archive, self.bpr_1, day, self.new_zealand)
630
631 def test_country_can_be_none(self):
632 # The country can be None, indicating that it is unknown.
633 day = date(2010, 2, 20)
634 self.archive.updatePackageDownloadCount(
635 self.bpr_1, day, self.australia, 10)
636 self.archive.updatePackageDownloadCount(
637 self.bpr_1, day, None, 3)
638
639 self.assertCount(10, self.archive, self.bpr_1, day, self.australia)
640 self.assertCount(3, self.archive, self.bpr_1, day, None)
641
642 def test_differentiates_between_days(self):
643 # A different date will also cause a new entry to be created.
644 day = date(2010, 2, 20)
645 another_day = date(2010, 2, 21)
646 self.archive.updatePackageDownloadCount(
647 self.bpr_1, day, self.australia, 10)
648 self.archive.updatePackageDownloadCount(
649 self.bpr_1, another_day, self.australia, 3)
650
651 self.assertCount(10, self.archive, self.bpr_1, day, self.australia)
652 self.assertCount(
653 3, self.archive, self.bpr_1, another_day, self.australia)
654
655 def test_differentiates_between_bprs(self):
656 # And even a different package will create a new entry.
657 day = date(2010, 2, 20)
658 self.archive.updatePackageDownloadCount(
659 self.bpr_1, day, self.australia, 10)
660 self.archive.updatePackageDownloadCount(
661 self.bpr_2, day, self.australia, 3)
662
663 self.assertCount(10, self.archive, self.bpr_1, day, self.australia)
664 self.assertCount(3, self.archive, self.bpr_2, day, self.australia)
665
666
565class TestARMBuildsAllowed(TestCaseWithFactory):667class TestARMBuildsAllowed(TestCaseWithFactory):
566 """Ensure that ARM builds can be allowed and disallowed correctly."""668 """Ensure that ARM builds can be allowed and disallowed correctly."""
567669

Subscribers

People subscribed via source and target branches

to status/vote changes: