get servant-mock building with new GADT-based auth

This commit is contained in:
aaron levin 2015-12-25 12:45:10 +01:00
parent 10bc3be75c
commit a154a2d1ec

View file

@ -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