def testAlbumTotalActivity(self): # Create an album album = AlbumFactory() # Verify that an album without any tracks cannot have any activity self.assertEqual(album.total_downloads(), 0) self.assertEqual(album.total_streams(), 0) # Create 3 tracks for the album and create an activity estimate for one stream of the album for _ in range(3): TrackFactory(album=album) ActivityEstimateFactory(content_object=album, total=1) # Verify that the one stream of the album is considered 3 events self.assertEqual(album.total_streams(), 3)
def testActivityEstimatesRequireCampaigns(self): album = AlbumFactory() response = self.assertResponseRenders( '/admin/music/activityestimate/add/', method='POST', data={ 'date': timezone.now().date(), 'activity_type': ActivityEstimate.ACTIVITY_STREAM, 'content_type': ContentType.objects.get_for_model(album).id, 'object_id': album.id, 'total': 10, }, has_form_error=True) self.assertIn( b"You cannot create activity estimates without defining the revenue percentages", response.content)
def testActivityEstimatesRequireCampaigns(self): album = AlbumFactory() response = self.assertResponseRenders( "/admin/music/activityestimate/add/", method="POST", data={ "date": timezone.now().date(), "activity_type": ActivityEstimate.ACTIVITY_STREAM, "content_type": ContentType.objects.get_for_model(album).id, "object_id": album.id, "total": 10, }, has_form_error=True, ) self.assertIn( b"You cannot create activity estimates without defining the revenue percentages", response.content, )
def testUnicodeOfAlbumIsAlbumName(self): album = AlbumFactory() self.assertEqual(str(album), album.name)
def setUpTestData(cls): cls.album = AlbumFactory() cls.artist = cls.album.project.artist