Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
self.video = Video.objects.create(
title="Test Video",
file=create_test_video_file()
)
def setUp(self):
self.login()
# Create an video for running tests on
self.video = Video.objects.create(
title="Test video",
file=create_test_video_file(),
)
def setUp(self):
self.login()
self.video = Video.objects.create(
title="Test video",
file=create_test_video_file(),
)
def test_pagination_after_upload_form_error(self):
for i in range(0, 20):
Video.objects.create(
title="Test video %d" % i,
file=create_test_video_file(),
)
response = self.client.post(reverse('wagtailvideos:chooser_upload'), {
'title': "Test video",
})
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'wagtailvideos/chooser/chooser.html')
# The re-rendered video chooser listing should be paginated
self.assertContains(response, "Page 1 of ")
self.assertEqual(12, len(response.context['videos']))
def test_filter_by_tag(self):
for i in range(0, 10):
video = Video.objects.create(
title="Test video %d is even better than the last one" % i,
file=create_test_video_file(),
)
if i % 2 == 0:
video.tags.add('even')
response = self.get({'tag': "even"})
self.assertEqual(response.status_code, 200)
# Results should include videos tagged 'even'
self.assertContains(response, "Test video 2 is even better")
# Results should not include videos that just have 'even' in the title
self.assertNotContains(response, "Test video 3 is even better")