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)
|
||||
| Type.Success <- code = Right (mapMaybe g xs)
|
||||
| Type.AdminLimitExceeded <- code = Right (mapMaybe g xs)
|
||||
| Type.SizeLimitExceeded <- code = Right (mapMaybe g xs)
|
||||
| otherwise = Left (SearchErrorCode code)
|
||||
where
|
||||
g (Type.SearchResultEntry (Type.LdapDn (Type.LdapString dn))
|
||||
|
||||
@ -10,12 +10,24 @@ import qualified Ldap.Client as Ldap
|
||||
|
||||
spec :: Spec
|
||||
spec =
|
||||
context "Example 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
|
||||
res <- Ldap.search l (Dn "ou=People,dc=scripts,dc=mit,dc=edu")
|
||||
(scope WholeSubtree <> typesOnly True)
|
||||
(Present (Attr "uid"))
|
||||
[]
|
||||
res `shouldSatisfy` (not . null)
|
||||
res `shouldBe` Right ()
|
||||
context "Examples stolen from the LDAP package tests" $
|
||||
|
||||
context "public LDAP server at MIT" $ do
|
||||
|
||||
it "searches the whole tree for the 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)
|
||||
(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