コード例 #1
0
ファイル: test_user_model.py プロジェクト: heynemann/wight
    def test_authenticate_using_token(self):
        user = UserFactory.create()

        exists, auth_user = User.authenticate(email=user.email, password=UserFactory.get_default_password())
        expect(auth_user).not_to_be_null()

        auth_user = User.authenticate_with_token(token=auth_user.token)
        expect(auth_user).not_to_be_null()
コード例 #2
0
ファイル: test_user_model.py プロジェクト: movermeyer/wight
    def test_authenticate_using_token(self):
        user = UserFactory.create()

        exists, auth_user = User.authenticate(
            email=user.email, password=UserFactory.get_default_password())
        expect(auth_user).not_to_be_null()

        auth_user = User.authenticate_with_token(token=auth_user.token)
        expect(auth_user).not_to_be_null()
コード例 #3
0
ファイル: authentication.py プロジェクト: heynemann/wight
    def get(self):
        token = self.request.headers.get("Token", None)

        if not token:
            self.set_status(400)
            self.finish()
            return

        user = User.authenticate_with_token(token, expiration=self.application.config.TOKEN_EXPIRATION_IN_MINUTES)

        if user is None:
            self.set_status(403)
            self.finish()
            return

        self.set_status(200)
        self.set_header("Token", user.token)
        self.set_header("Token-Expiration", user.token_expiration.isoformat())
        self.write("OK")
        self.finish()
コード例 #4
0
ファイル: authentication.py プロジェクト: movermeyer/wight
    def get(self):
        token = self.request.headers.get("Token", None)

        if not token:
            self.set_status(400)
            self.finish()
            return

        user = User.authenticate_with_token(
            token,
            expiration=self.application.config.TOKEN_EXPIRATION_IN_MINUTES)

        if user is None:
            self.set_status(403)
            self.finish()
            return

        self.set_status(200)
        self.set_header("Token", user.token)
        self.set_header("Token-Expiration", user.token_expiration.isoformat())
        self.write("OK")
        self.finish()
コード例 #5
0
ファイル: test_user_model.py プロジェクト: movermeyer/wight
 def test_authenticate_using_invalid_token(self):
     auth_user = User.authenticate_with_token(token="12312412414124")
     expect(auth_user).to_be_null()
コード例 #6
0
ファイル: test_user_model.py プロジェクト: heynemann/wight
 def test_authenticate_using_invalid_token(self):
     auth_user = User.authenticate_with_token(token="12312412414124")
     expect(auth_user).to_be_null()