Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(34)  |  Call(34)  |  Derive(0)  |  Import(0)

src/m/o/mozservices-HEAD/mozsvc/tests/test_user.py   mozservices(Download)
    def test_that_authn_policy_can_be_overridden(self):
        self.config.set_authentication_policy(StubAuthenticationPolicy())
        self.config.commit()
        # Good password => successful auth via request.user
        request = self.make_request(environ={
        self.assertEquals(request.user["x-was-ere"], True)
        # Bad password => request.user is empty
        request = self.make_request(environ={
            "HTTP_X_USERNAME": "user1",
            "HTTP_X_PASSWORD": "BAD PASSWORD",
        })
        self.assertFalse(request.user)
        # No username => request.user is empty
        request = self.make_request(environ={
        self.assertFalse(request.user)
        # No password => request.user is empty
        request = self.make_request(environ={
            "HTTP_X_USERNAME": "user1",
        })
        self.assertFalse(request.user)
 
    def test_that_hawkauth_is_used_by_default(self):
        # Generate signed request.
        req = self.make_request()

src/m/o/mozsvc-0.7/mozsvc/tests/test_user.py   mozsvc(Download)
    def test_that_authn_policy_can_be_overridden(self):
        self.config.set_authentication_policy(StubAuthenticationPolicy())
        self.config.commit()
        # Good password => successful auth via request.user
        request = self.make_request(environ={
        self.assertEquals(request.user["x-was-ere"], True)
        # Bad password => request.user is empty
        request = self.make_request(environ={
                    "HTTP_X_USERNAME": "user1",
                    "HTTP_X_PASSWORD": "BAD PASSWORD",
                  })
        self.assertFalse(request.user)
        # No username => request.user is empty
        request = self.make_request(environ={
        self.assertFalse(request.user)
        # No password => request.user is empty
        request = self.make_request(environ={
                    "HTTP_X_USERNAME": "user1",
                  })
        self.assertFalse(request.user)
 
    def test_that_macauth_is_used_by_default(self):
        # Generate signed request.
        req = self.make_request()