SizeLimitExceeded isn't either
This commit is contained in:
parent
2013999e24
commit
86f256fbd8
@ -286,6 +286,7 @@ searchResult :: Response -> Either SearchError [SearchEntry]
|
|||||||
searchResult (Type.SearchResultDone (Type.LdapResult code _ _ _) :| xs)
|
searchResult (Type.SearchResultDone (Type.LdapResult code _ _ _) :| xs)
|
||||||
| Type.Success <- code = Right (mapMaybe g xs)
|
| Type.Success <- code = Right (mapMaybe g xs)
|
||||||
| Type.AdminLimitExceeded <- code = Right (mapMaybe g xs)
|
| Type.AdminLimitExceeded <- code = Right (mapMaybe g xs)
|
||||||
|
| Type.SizeLimitExceeded <- code = Right (mapMaybe g xs)
|
||||||
| otherwise = Left (SearchErrorCode code)
|
| otherwise = Left (SearchErrorCode code)
|
||||||
where
|
where
|
||||||
g (Type.SearchResultEntry (Type.LdapDn (Type.LdapString dn))
|
g (Type.SearchResultEntry (Type.LdapDn (Type.LdapString dn))
|
||||||
|
|||||||
@ -10,12 +10,24 @@ import qualified Ldap.Client as Ldap
|
|||||||
|
|
||||||
spec :: Spec
|
spec :: Spec
|
||||||
spec =
|
spec =
|
||||||
context "Example stolen from the LDAP package tests" $
|
context "Examples stolen from the LDAP package tests" $
|
||||||
it "searches the public LDAP server at MIT" $ do
|
|
||||||
res <- Ldap.with (Plain "scripts.mit.edu") 389 $ \l -> do
|
context "public LDAP server at MIT" $ do
|
||||||
res <- Ldap.search l (Dn "ou=People,dc=scripts,dc=mit,dc=edu")
|
|
||||||
(scope WholeSubtree <> typesOnly True)
|
it "searches the whole tree for the entries that have ‘uid’ attribute" $ do
|
||||||
(Present (Attr "uid"))
|
res <- Ldap.with (Plain "scripts.mit.edu") 389 $ \l -> do
|
||||||
[]
|
res <- Ldap.search l (Dn "ou=People,dc=scripts,dc=mit,dc=edu")
|
||||||
res `shouldSatisfy` (not . null)
|
(scope WholeSubtree <> typesOnly True)
|
||||||
res `shouldBe` Right ()
|
(Present (Attr "uid"))
|
||||||
|
[]
|
||||||
|
res `shouldSatisfy` (not . null)
|
||||||
|
res `shouldBe` Right ()
|
||||||
|
|
||||||
|
it "searches the single level for the first 10 entries that have ‘uid’ attribute" $ do
|
||||||
|
res <- Ldap.with (Plain "scripts.mit.edu") 389 $ \l -> do
|
||||||
|
res <- Ldap.search l (Dn "ou=People,dc=scripts,dc=mit,dc=edu")
|
||||||
|
(scope WholeSubtree <> typesOnly True <> size 10)
|
||||||
|
(Present (Attr "uid"))
|
||||||
|
[]
|
||||||
|
length res `shouldBe` 10
|
||||||
|
res `shouldBe` Right ()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user