get servant-mock building with new GADT-based auth
This commit is contained in:
parent
10bc3be75c
commit
a154a2d1ec
1 changed files with 13 additions and 10 deletions
|
@ -143,21 +143,24 @@ instance (KnownSymbol s, HasMock rest) => HasMock (QueryFlag s :> rest) where
|
|||
instance (KnownSymbol h, FromHttpApiData a, HasMock rest) => HasMock (Header h a :> rest) where
|
||||
mock _ = \_ -> mock (Proxy :: Proxy rest)
|
||||
|
||||
instance (HasMock rest, AuthData authdata, Arbitrary usr)
|
||||
=> HasMock (AuthProtect authdata (usr :: *) 'Lax :> rest) where
|
||||
mock _ = laxProtect (\_ -> do { a <- generate arbitrary; return (Just a)})
|
||||
(\_ -> mock (Proxy :: Proxy rest))
|
||||
instance ( HasMock rest
|
||||
, AuthData authData mError
|
||||
, Arbitrary usr
|
||||
)
|
||||
=> HasMock (AuthProtect authData (usr :: *) 'Lax mError 'Lax uError :> rest) where
|
||||
mock _ = authProtect LaxMissing
|
||||
LaxUnauthenticated
|
||||
(\_ -> do { a <- generate arbitrary; return (Right a) })
|
||||
(\_ -> mock (Proxy :: Proxy rest))
|
||||
|
||||
instance (HasMock rest, Arbitrary usr, KnownSymbol realm)
|
||||
=> HasMock (AuthProtect (BasicAuth realm) (usr :: *) 'Strict :> rest) where
|
||||
=> HasMock (AuthProtect (BasicAuth realm) (usr :: *) 'Strict () 'Strict () :> rest) where
|
||||
mock _ = basicAuthStrict (\_ -> do { a <- generate arbitrary; return (Just a)})
|
||||
(\_ -> mock (Proxy :: Proxy rest))
|
||||
|
||||
instance (HasMock rest, Arbitrary usr)
|
||||
=> HasMock (AuthProtect JWTAuth (usr :: *) 'Strict :> rest) where
|
||||
mock _ = strictProtect (\_ -> do { a <- generate arbitrary; return (Just a)})
|
||||
jwtAuthHandlers
|
||||
(\_ -> mock (Proxy :: Proxy rest))
|
||||
instance (HasMock rest)
|
||||
=> HasMock (AuthProtect JWTAuth (JWT VerifiedJWT) 'Strict () 'Strict () :> rest) where
|
||||
mock _ = jwtAuthStrict (secret "secret") (\_ -> mock (Proxy :: Proxy rest))
|
||||
|
||||
instance (Arbitrary a, AllCTRender ctypes a) => HasMock (Delete ctypes a) where
|
||||
mock _ = mockArbitrary
|
||||
|
|
Loading…
Reference in a new issue