示例#1
0
 def test_used_media_get_usage(self):
     media = models.Media.objects.get(id=1)
     page = EventPage.objects.get(id=3)
     event_page_related_link = EventPageRelatedMedia()
     event_page_related_link.page = page
     event_page_related_link.link_media = media
     event_page_related_link.save()
     self.assertTrue(issubclass(Page, type(media.get_usage()[0])))
示例#2
0
 def test_used_media_usage_count(self):
     media = models.Media.objects.get(id=1)
     page = EventPage.objects.get(id=3)
     event_page_related_link = EventPageRelatedMedia()
     event_page_related_link.page = page
     event_page_related_link.link_media = media
     event_page_related_link.save()
     self.assertEqual(media.get_usage().count(), 1)
示例#3
0
 def test_usage_page(self):
     media = models.Media.objects.get(id=1)
     page = EventPage.objects.get(id=3)
     event_page_related_link = EventPageRelatedMedia()
     event_page_related_link.page = page
     event_page_related_link.link_media = media
     event_page_related_link.save()
     response = self.client.get(reverse('wagtailmedia:media_usage',
                                        args=(1,)))
     self.assertContains(response, 'Christmas')
示例#4
0
 def test_usage_count_appears(self):
     media = models.Media.objects.get(id=1)
     page = EventPage.objects.get(id=3)
     event_page_related_link = EventPageRelatedMedia()
     event_page_related_link.page = page
     event_page_related_link.link_media = media
     event_page_related_link.save()
     response = self.client.get(reverse('wagtailmedia:edit',
                                        args=(1,)))
     self.assertContains(response, 'Used 1 time')
示例#5
0
 def test_used_media_get_usage(self):
     media = models.Media.objects.get(id=1)
     page = EventPage.objects.get(id=3)
     event_page_related_link = EventPageRelatedMedia()
     event_page_related_link.page = page
     event_page_related_link.link_media = media
     event_page_related_link.save()
     self.assertTrue(issubclass(Page, type(media.get_usage()[0])))
示例#6
0
 def test_used_media_usage_count(self):
     media = models.Media.objects.get(id=1)
     page = EventPage.objects.get(id=3)
     event_page_related_link = EventPageRelatedMedia()
     event_page_related_link.page = page
     event_page_related_link.link_media = media
     event_page_related_link.save()
     self.assertEqual(media.get_usage().count(), 1)
示例#7
0
 def test_usage_count_appears(self):
     media = models.Media.objects.get(id=1)
     page = EventPage.objects.get(id=3)
     event_page_related_link = EventPageRelatedMedia()
     event_page_related_link.page = page
     event_page_related_link.link_media = media
     event_page_related_link.save()
     response = self.client.get(reverse('wagtailmedia:edit', args=(1, )))
     self.assertContains(response, 'Used 1 time')
示例#8
0
 def test_usage_page(self):
     media = models.Media.objects.get(id=1)
     page = EventPage.objects.get(id=3)
     event_page_related_link = EventPageRelatedMedia()
     event_page_related_link.page = page
     event_page_related_link.link_media = media
     event_page_related_link.save()
     response = self.client.get(
         reverse('wagtailmedia:media_usage', args=(1, )))
     self.assertContains(response, 'Christmas')