~jcsackett/charmworld/bac-tag-constraints

« back to all changes in this revision

Viewing changes to charmworld/tests/test_models.py

[r=abentley][bug=][author=adeuring] show downloads in past 7, 30, 180 days on the charm details page.

Show diffs side-by-side

added added

removed removed

Lines of Context:
252
252
        charm = Charm({})
253
253
        self.assertEquals(0, charm.downloads_in_past_30_days)
254
254
 
 
255
    def test_downloads_in_past_7_days(self):
 
256
        # The downloads_in_past_7_days property is an int.
 
257
        charm_data = {'downloads_in_past_7_days': 7}
 
258
        charm = Charm(charm_data)
 
259
        self.assertEqual(7, charm.downloads_in_past_7_days)
 
260
        # The default is zero.
 
261
        charm = Charm({})
 
262
        self.assertEquals(0, charm.downloads_in_past_7_days)
 
263
 
 
264
    def test_downloads_in_past_half_year(self):
 
265
        # The downloads_in_past_half_year property is an int.
 
266
        charm_data = {'downloads_in_past_half_year': 180}
 
267
        charm = Charm(charm_data)
 
268
        self.assertEqual(180, charm.downloads_in_past_half_year)
 
269
        # The default is zero.
 
270
        charm = Charm({})
 
271
        self.assertEquals(0, charm.downloads_in_past_half_year)
 
272
 
255
273
    def test_store_url(self):
256
274
        # The store_url property is a string.
257
275
        charm_data = {'store_url': 'cs:~owner/series/name-1'}