Fix the encoding of the `present' filter
This commit is contained in:
parent
7aa2703319
commit
c9d034f952
@ -41,3 +41,19 @@ library
|
|||||||
, semigroups >= 0.16
|
, semigroups >= 0.16
|
||||||
, stm
|
, stm
|
||||||
, text
|
, text
|
||||||
|
|
||||||
|
test-suite spec
|
||||||
|
default-language:
|
||||||
|
Haskell2010
|
||||||
|
type:
|
||||||
|
exitcode-stdio-1.0
|
||||||
|
hs-source-dirs:
|
||||||
|
test
|
||||||
|
main-is:
|
||||||
|
Spec.hs
|
||||||
|
other-modules:
|
||||||
|
Ldap.ClientSpec
|
||||||
|
build-depends:
|
||||||
|
base >= 4.7 && < 5
|
||||||
|
, hspec
|
||||||
|
, ldap-client
|
||||||
|
|||||||
@ -201,7 +201,8 @@ instance ToAsn1 Filter where
|
|||||||
Substrings x -> context 4 (toAsn1 x)
|
Substrings x -> context 4 (toAsn1 x)
|
||||||
GreaterOrEqual x -> context 5 (toAsn1 x)
|
GreaterOrEqual x -> context 5 (toAsn1 x)
|
||||||
LessOrEqual x -> context 6 (toAsn1 x)
|
LessOrEqual x -> context 6 (toAsn1 x)
|
||||||
Present x -> context 7 (toAsn1 x)
|
Present (AttributeDescription (LdapString x))
|
||||||
|
-> other Asn1.Context 7 (Text.encodeUtf8 x)
|
||||||
ApproxMatch x -> context 8 (toAsn1 x)
|
ApproxMatch x -> context 8 (toAsn1 x)
|
||||||
ExtensibleMatch x -> context 9 (toAsn1 x)
|
ExtensibleMatch x -> context 9 (toAsn1 x)
|
||||||
|
|
||||||
|
|||||||
21
test/Ldap/ClientSpec.hs
Normal file
21
test/Ldap/ClientSpec.hs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
module Ldap.ClientSpec (spec) where
|
||||||
|
|
||||||
|
import Data.Monoid ((<>))
|
||||||
|
import Test.Hspec
|
||||||
|
|
||||||
|
import Ldap.Client
|
||||||
|
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 ()
|
||||||
1
test/Spec.hs
Normal file
1
test/Spec.hs
Normal file
@ -0,0 +1 @@
|
|||||||
|
{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
|
||||||
Loading…
Reference in New Issue
Block a user