def test_searching_cards_resource_generation_missing_header_text_parameter( self): resource = self.test_data.create_resource( "searching-cards", "Searching Cards", "resources/searching-cards.html", "searching_cards.py", ) kwargs = { "resource_slug": resource.slug, } url = reverse("resources:generate", kwargs=kwargs) get_parameters = { "number_cards": "15", "max_number": "99", "help_sheet": True, "paper_size": "a4", } url += query_string(get_parameters) response = self.client.get(url) self.assertEqual(200, response.status_code) filename = "Resource Searching Cards (15 cards - 0 to 99 - with helper sheet - a4).pdf" self.assertEqual(response.get("Content-Disposition"), 'attachment; filename="{}"'.format(filename))
def test_binary_cards_resource_generation_no_numbers(self): resource = self.test_data.create_resource( "binary-cards", "Binary Cards", "resources/binary-cards.html", "binary_cards.py", ) kwargs = { "resource_slug": resource.slug, } url = reverse("resources:generate", kwargs=kwargs) get_parameters = { "display_numbers": "no", "black_back": "no", "paper_size": "a4", "header_text": "", } url += query_string(get_parameters) response = self.client.get(url) self.assertEqual(200, response.status_code) self.assertEqual( response.get("Content-Disposition"), 'attachment; filename="Resource Binary Cards (without numbers - without black back - a4).pdf"' )
def test_modulo_clock_resource_generation_2_a4_no_header_text(self): resource = self.test_data.create_resource( "modulo-clock", "Modulo Clock", "resources/modulo-clock.html", "modulo_clock.py", ) kwargs = { "resource_slug": resource.slug, } url = reverse("resources:generate", kwargs=kwargs) get_parameters = { "modulo_number": "2", "paper_size": "a4", "header_text": "" } url += query_string(get_parameters) response = self.client.get(url) self.assertEqual(200, response.status_code) filename = "Resource Modulo Clock (2 - a4).pdf" self.assertEqual( response.get("Content-Disposition"), 'attachment; filename="{}"'.format(filename) )