コード例 #1
0
def test_from_example_template_makes_request(mocker):
    request_mock = mocker.patch('app.template_previews.requests.post')
    template = {}
    filename = 'geo'

    TemplatePreview.from_example_template(template, filename)

    request_mock.assert_called_once_with(
        'http://localhost:9999/preview.png',
        headers={'Authorization': 'Token my-secret-key'},
        json={'values': None,
              'template': template,
              'filename': filename,
              'letter_contact_block': None}
    )
コード例 #2
0
def letter_branding_preview_image(filename):
    template = {
        'subject':
        'An example letter',
        'content':
        ('Lorem Ipsum is simply dummy text of the printing and typesetting '
         'industry.\n\nLorem Ipsum has been the industry’s standard dummy '
         'text ever since the 1500s, when an unknown printer took a galley '
         'of type and scrambled it to make a type specimen book.\n\n'
         '# History\n\nIt has survived not only\n\n'
         '* five centuries\n'
         '* but also the leap into electronic typesetting\n\n'
         'It was popularised in the 1960s with the release of Letraset '
         'sheets containing Lorem Ipsum passages, and more recently with '
         'desktop publishing software like Aldus PageMaker including '
         'versions of Lorem Ipsum.\n\n'
         'The point of using Lorem Ipsum is that it has a more-or-less '
         'normal distribution of letters, as opposed to using ‘Content '
         'here, content here’, making it look like readable English.'),
        'template_type':
        'letter',
    }
    filename = None if filename == 'no-branding' else filename

    return TemplatePreview.from_example_template(template, filename)
コード例 #3
0
def test_from_example_template_makes_request(app_, mocker):
    request_mock = mocker.patch("app.template_previews.requests.post")
    template = {}
    filename = "geo"

    TemplatePreview.from_example_template(template, filename)

    request_mock.assert_called_once_with(
        "http://localhost:9999/preview.png",
        headers={"Authorization": "Token {}".format("dev-notify-secret-key")},
        json={
            "values": None,
            "template": template,
            "filename": filename,
            "letter_contact_block": None,
        },
    )
コード例 #4
0
def letter_branding_preview_image(filename):
    template = {
        "subject":
        "An example letter",
        "content":
        ("Lorem Ipsum is simply dummy text of the printing and typesetting "
         "industry.\n\nLorem Ipsum has been the industry’s standard dummy "
         "text ever since the 1500s, when an unknown printer took a galley "
         "of type and scrambled it to make a type specimen book.\n\n"
         "# History\n\nIt has survived not only\n\n"
         "* five centuries\n"
         "* but also the leap into electronic typesetting\n\n"
         "It was popularised in the 1960s with the release of Letraset "
         "sheets containing Lorem Ipsum passages, and more recently with "
         "desktop publishing software like Aldus PageMaker including "
         "versions of Lorem Ipsum.\n\n"
         "The point of using Lorem Ipsum is that it has a more-or-less "
         "normal distribution of letters, as opposed to using ‘Content "
         "here, content here’, making it look like readable English."),
    }
    filename = None if filename == "no-branding" else filename

    return TemplatePreview.from_example_template(template, filename)