mirror of
https://github.com/freckle/yesod-auth-oauth2.git
synced 2026-01-11 19:58:28 +01:00
Approach so far: The SpecHelper sets up an example App type which should (theoretically) be enough to get some fake requests and responses going, as in any yesod-test-based suite. The spec then tries to build an example plugin and make assertions on how it dispatches. This is currently falling down on subsite-related type errors (see commented attempts). Another potential direction is to define the YesodAuth instance for App to specify authPlugins built using the library. With that, we might be able to create specs using yesod-test that exercise aspects of the plugins in an indirect way, but enough to make useful assertions.
44 lines
870 B
Haskell
44 lines
870 B
Haskell
{-# LANGUAGE OverloadedStrings #-}
|
|
{-# LANGUAGE QuasiQuotes #-}
|
|
{-# LANGUAGE TemplateHaskell #-}
|
|
{-# LANGUAGE TypeFamilies #-}
|
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
module SpecHelper
|
|
( App(..)
|
|
, Widget
|
|
, resourcesApp
|
|
, module Test.Hspec
|
|
, module Yesod
|
|
, module Yesod.Auth
|
|
, module Yesod.Auth.OAuth2
|
|
) where
|
|
|
|
import Test.Hspec
|
|
|
|
import Data.Text (Text)
|
|
|
|
import Yesod
|
|
import Yesod.Auth
|
|
import Yesod.Auth.OAuth2
|
|
|
|
data App = App
|
|
|
|
mkYesod "App" [parseRoutes| / R GET |]
|
|
|
|
instance Yesod App
|
|
instance YesodAuth App where
|
|
type AuthId App = Text
|
|
|
|
authHttpManager = undefined
|
|
authPlugins = undefined
|
|
authenticate = undefined
|
|
loginDest = undefined
|
|
logoutDest = undefined
|
|
maybeAuthId = undefined
|
|
|
|
instance RenderMessage App FormMessage where
|
|
renderMessage _ _ = defaultFormMessage
|
|
|
|
getR :: Handler ()
|
|
getR = return ()
|