<commit_before>from unittest.mock import Mock


from django.template.loader import render_to_string
from django.test import TestCase

from osmaxx.excerptexport.forms.order_options_mixin import available_format_choices


class MailtoUriTestCase(TestCase):
    def setUp(self):
        order = Mock(
            excerpt_name="Neverland",
        )
        files = [
            Mock(
                deleted_on_filesystem=False,
                content_type=format_choice[0],
                public_identifier='some-long-id',
            ) for format_choice in available_format_choices
        ]
        order.configure_mock(
            **{
                'output_files.all': files,
            }
        )
        self.context = dict(
            extraction_order=order,
            host_domain='example.com',
            protocol='http',
        )

    def test_send_all_links_link_has_expected_URI(self):
        actual_result_string = render_to_string('excerptexport/partials/send_all_links.html', context=self.context)<commit_msg>simplify mailto partials test setUp #381<commit_after>from unittest.mock import Mock


from django.template.loader import render_to_string
from django.test import TestCase

from osmaxx.excerptexport.forms.order_options_mixin import available_format_choices


class MailtoUriTestCase(TestCase):
    def setUp(self):
        files = [
            Mock(
                deleted_on_filesystem=False,
                content_type=format_choice[0],
                public_identifier='some-long-id',
            ) for format_choice in available_format_choices
        ]
        order = Mock(
            excerpt_name="Neverland",
            **{
                'output_files.all': files,
            }
        )
        self.context = dict(
            extraction_order=order,
            host_domain='example.com',
            protocol='http',
        )

    def test_send_all_links_link_has_expected_URI(self):
        actual_result_string = render_to_string('excerptexport/partials/send_all_links.html', context=self.context)
{'fraction_non_alphanumeric': 0.07778317938745746, 'fraction_numerical': 0.0024307243558580457, 'mean_word_length': 2.2928, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '532640', 'n_tokens_mistral': 591, 'n_tokens_neox': 564, 'n_words': 93}