Ejemplo n.º 1
0
 def test_wrong_key(self):
     token = create_token("foobar1234567890", "__test_user1",
                          "__test_user1", 1)
     request = create_dummy_request(params={"auth": token})
     policy = UrlAuthenticationPolicy("foobar1234567891",
                                      defaultgroupsfinder)
     userid = policy.unauthenticated_userid(request)
     self.assertIsNone(userid)
Ejemplo n.º 2
0
 def get_user(self, aeskey, user, password, valid, remember_mock):
     token = create_token(aeskey, user, password, valid)
     request = create_dummy_request(params={"auth": token})
     policy = UrlAuthenticationPolicy(aeskey, defaultgroupsfinder)
     userid = policy.unauthenticated_userid(request)
     if userid is not None:
         remember_mock.assert_called_once_with(request, userid)
     else:
         remember_mock.assert_not_called()
     return userid
Ejemplo n.º 3
0
 def test_wrong_key(self):
     token = create_token("foobar1234567890", "__test_user1", "__test_user1", 1)
     request = create_dummy_request({
         "urllogin": {
             "aes_key": "foobar1234567891"
         }
     }, params={"auth": token})
     get_user_from_request = create_get_user_from_request(request.registry.settings)
     get_user_from_request(request)
     self.assertIsNone(self.user)
Ejemplo n.º 4
0
 def get_user(self, aeskey, user, password, valid):
     token = create_token(aeskey, user, password, valid)
     request = create_dummy_request({
         "urllogin": {
             "aes_key": aeskey
         }
     }, params={"auth": token})
     get_user_from_request = create_get_user_from_request(request.registry.settings)
     get_user_from_request(request)
     return self.user
Ejemplo n.º 5
0
 def get_user(self, aeskey, user, password, valid):
     token = create_token(aeskey, user, password, valid)
     request = create_dummy_request({"urllogin": {
         "aes_key": aeskey
     }},
                                    params={"auth": token})
     get_user_from_request = create_get_user_from_request(
         request.registry.settings)
     get_user_from_request(request)
     return self.user
Ejemplo n.º 6
0
 def test_wrong_key(self):
     token = create_token("foobar1234567890", "__test_user1",
                          "__test_user1", 1)
     request = create_dummy_request(
         {"urllogin": {
             "aes_key": "foobar1234567891"
         }},
         params={"auth": token})
     get_user_from_request = create_get_user_from_request(
         request.registry.settings)
     get_user_from_request(request)
     self.assertIsNone(self.user)