def test_domainSpecified(self):
     """
     Test that L{usernameFromRequest} returns the username in the request
     if that username specifies a domain.
     """
     request = FakeRequest(headers={'host': 'divmod.com'})
     request.args = {'username': ['*****@*****.**']}
     username = usernameFromRequest(request)
     self.assertEqual(username, '*****@*****.**')
 def test_domainSpecified(self):
     """
     Test that L{usernameFromRequest} returns the username in the request
     if that username specifies a domain.
     """
     request = FakeRequest(headers={"host": "divmod.com"})
     request.args = {"username": ["*****@*****.**"]}
     username = usernameFromRequest(request)
     self.assertEqual(username, "*****@*****.**")
Exemple #3
0
 def test_domainSpecified(self):
     """
     Test that L{usernameFromRequest} returns the username in the request
     if that username specifies a domain.
     """
     request = FakeRequest(headers={'host': 'divmod.com'})
     request.args = {'username': ['*****@*****.**']}
     username = usernameFromRequest(request)
     self.assertEqual(username, '*****@*****.**')
 def test_domainUnspecified(self):
     """
     Test that L{usernameFromRequest} adds the value of host header to the
     username in the request if the username doesn't already specify a
     domain.
     """
     request = FakeRequest(headers={"host": "divmod.com"})
     request.args = {"username": ["joe"]}
     username = usernameFromRequest(request)
     self.assertEqual(username, "*****@*****.**")
 def test_domainUnspecified(self):
     """
     Test that L{usernameFromRequest} adds the value of host header to the
     username in the request if the username doesn't already specify a
     domain.
     """
     request = FakeRequest(headers={'host': 'divmod.com'})
     request.args = {'username': ['joe']}
     username = usernameFromRequest(request)
     self.assertEqual(username, '*****@*****.**')
Exemple #6
0
 def test_domainUnspecified(self):
     """
     Test that L{usernameFromRequest} adds the value of host header to the
     username in the request if the username doesn't already specify a
     domain.
     """
     request = FakeRequest(headers={'host': 'divmod.com'})
     request.args = {'username': ['joe']}
     username = usernameFromRequest(request)
     self.assertEqual(username, '*****@*****.**')
Exemple #7
0
 def test_rendering(self):
     """
     L{AddBlogPostDialogFragment} can be rendered as part of a Mantissa
     public Athena page.
     """
     page = PublicAthenaLivePage(self.store, self.fragment, None, None)
     request = FakeRequest()
     request.args = {'title': ['foo'],
                     'body': ['bar'],
                     'url': ['baz']}
     return renderLivePage(page, reqFactory=lambda: request)
def process(typed, data, configurable=None, ctx=None):
    if ctx is None:
        from nevow.testutil import FakeRequest
        from nevow import context
        fr = FakeRequest()
        if type(data) is dict:
            fr.args = data
        ctx = context.RequestContext(tag=fr)
        ctx.remember(fr, inevow.IRequest)
        ctx.remember(None, inevow.IData)

    try:
        return iformless.IInputProcessor(typed).process(ctx, configurable, data, autoConfigure=False)
    except TypeError:
        return iformless.IInputProcessor(typed).process(ctx, configurable, data)