Example #1
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, '*****@*****.**')
Example #2
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, "*****@*****.**")
Example #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, '*****@*****.**')
Example #4
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, "*****@*****.**")
Example #5
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, '*****@*****.**')
Example #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, '*****@*****.**')
Example #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)
Example #8
0
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)