示例#1
0
    def test_jinja_templates_render(self,
                                    pyramid_config,
                                    pyramid_request):
        """Ensure that the jinja templates don't contain syntax errors"""
        pyramid_config.include('pyramid_jinja2')

        generate(pyramid_request, '*****@*****.**')
示例#2
0
文件: test_test.py 项目: welhefna/h
    def test_jinja_templates_render(self,
                                    pyramid_config,
                                    pyramid_request):
        """Ensure that the jinja templates don't contain syntax errors"""
        pyramid_config.include('pyramid_jinja2')

        generate(pyramid_request, '*****@*****.**')
示例#3
0
    def test_calls_renderers_with_appropriate_context(self, pyramid_request,
                                                      html_renderer,
                                                      text_renderer):
        generate(pyramid_request, "*****@*****.**")

        expected_context = {
            "time": Any.string(),
            "hostname": Any.string(),
            "python_version": Any.string(),
            "version": __version__,
        }
        html_renderer.assert_(**expected_context)
        text_renderer.assert_(**expected_context)
示例#4
0
文件: test_test.py 项目: ziqizh/h
    def test_calls_renderers_with_appropriate_context(self, pyramid_request,
                                                      html_renderer,
                                                      text_renderer, matchers):
        generate(pyramid_request, '*****@*****.**')

        expected_context = {
            'time': matchers.InstanceOf(string_types),
            'hostname': matchers.InstanceOf(string_types),
            'python_version': matchers.InstanceOf(string_types),
            'version': __version__,
        }
        html_renderer.assert_(**expected_context)
        text_renderer.assert_(**expected_context)
示例#5
0
文件: test_test.py 项目: hypothesis/h
    def test_calls_renderers_with_appropriate_context(
        self, pyramid_request, html_renderer, text_renderer, matchers
    ):
        generate(pyramid_request, "*****@*****.**")

        expected_context = {
            "time": matchers.InstanceOf(string_types),
            "hostname": matchers.InstanceOf(string_types),
            "python_version": matchers.InstanceOf(string_types),
            "version": __version__,
        }
        html_renderer.assert_(**expected_context)
        text_renderer.assert_(**expected_context)
示例#6
0
文件: test_test.py 项目: gnott/h
    def test_calls_renderers_with_appropriate_context(self,
                                                      pyramid_request,
                                                      html_renderer,
                                                      text_renderer,
                                                      matchers):
        generate(pyramid_request, '*****@*****.**')

        expected_context = {
            'time': matchers.instance_of(string_types),
            'hostname': matchers.instance_of(string_types),
            'python_version': matchers.instance_of(string_types),
            'version': __version__,
        }
        html_renderer.assert_(**expected_context)
        text_renderer.assert_(**expected_context)
示例#7
0
文件: mailer.py 项目: hypothesis/h
def mailer_test(request):
    """Send a test email."""
    if "recipient" not in request.params:
        index = request.route_path("admin.mailer")
        return HTTPSeeOther(location=index)

    mail = test.generate(request, request.params["recipient"])
    result = mailer.send.delay(*mail)
    index = request.route_path("admin.mailer", _query={"taskid": result.task_id})
    return HTTPSeeOther(location=index)
示例#8
0
def mailer_test(request):
    """Send a test email."""
    if "recipient" not in request.params:
        index = request.route_path("admin.mailer")
        return HTTPSeeOther(location=index)

    mail = test.generate(request, request.params["recipient"])
    result = mailer.send.delay(*mail)
    index = request.route_path("admin.mailer", _query={"taskid": result.task_id})
    return HTTPSeeOther(location=index)
示例#9
0
文件: mailer.py 项目: wisdom-garden/h
def mailer_test(request):
    """Send a test email."""
    if 'recipient' not in request.params:
        index = request.route_path('admin.mailer')
        return HTTPSeeOther(location=index)

    mail = test.generate(request, request.params['recipient'])
    result = mailer.send.delay(*mail)
    index = request.route_path('admin.mailer',
                               _query={'taskid': result.task_id})
    return HTTPSeeOther(location=index)
示例#10
0
def mailer_test(request):
    """Send a test email."""
    if 'recipient' not in request.params:
        index = request.route_path('admin_mailer')
        return HTTPSeeOther(location=index)

    mail = test.generate(request, request.params['recipient'])
    result = mailer.send.delay(*mail)
    index = request.route_path('admin_mailer',
                               _query={'taskid': result.task_id})
    return HTTPSeeOther(location=index)
示例#11
0
    def test_appropriate_return_values(self, pyramid_request, html_renderer,
                                       text_renderer):

        html_renderer.string_response = "HTML output"
        text_renderer.string_response = "Text output"

        recipients, subject, text, html = generate(pyramid_request,
                                                   "*****@*****.**")

        assert recipients == ["*****@*****.**"]
        assert subject == "Test mail"
        assert html == "HTML output"
        assert text == "Text output"
示例#12
0
文件: test_test.py 项目: ziqizh/h
    def test_appropriate_return_values(self, pyramid_request, html_renderer,
                                       text_renderer):

        html_renderer.string_response = 'HTML output'
        text_renderer.string_response = 'Text output'

        recipients, subject, text, html = generate(pyramid_request,
                                                   '*****@*****.**')

        assert recipients == ['*****@*****.**']
        assert subject == 'Test mail'
        assert html == 'HTML output'
        assert text == 'Text output'
示例#13
0
    def test_appropriate_return_values(self,
                                       pyramid_request,
                                       html_renderer,
                                       text_renderer):

        html_renderer.string_response = 'HTML output'
        text_renderer.string_response = 'Text output'

        recipients, subject, text, html = generate(pyramid_request, '*****@*****.**')

        assert recipients == ['*****@*****.**']
        assert subject == 'Test mail'
        assert html == 'HTML output'
        assert text == 'Text output'
示例#14
0
文件: test_test.py 项目: hypothesis/h
    def test_appropriate_return_values(
        self, pyramid_request, html_renderer, text_renderer
    ):

        html_renderer.string_response = "HTML output"
        text_renderer.string_response = "Text output"

        recipients, subject, text, html = generate(
            pyramid_request, "*****@*****.**"
        )

        assert recipients == ["*****@*****.**"]
        assert subject == "Test mail"
        assert html == "HTML output"
        assert text == "Text output"