Skip to content

Commit 4d27ce7

Browse files
committed
test
1 parent a7be524 commit 4d27ce7

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

tests/AgentTests/FunctionalAPITests.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ module AgentTests.FunctionalAPITests
5454
pattern SENT,
5555
agentCfgVPrevPQ,
5656
agentCfgV7,
57+
testServerInformation,
5758
)
5859
where
5960

tests/XFTPAgent.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
module XFTPAgent where
1212

13-
import AgentTests.FunctionalAPITests (get, rfGet, runRight, runRight_, sfGet, withAgent)
13+
import AgentTests.FunctionalAPITests (get, rfGet, runRight, runRight_, sfGet, withAgent, testServerInformation)
1414

1515
import Control.Logger.Simple
1616
import Control.Monad
@@ -83,21 +83,21 @@ xftpAgentTests =
8383
it "if file is expired on server, should report error and continue receiving next file" testXFTPAgentExpiredOnServer
8484
it "should request additional recipient IDs when number of recipients exceeds maximum per request" testXFTPAgentRequestAdditionalRecipientIDs
8585
describe "XFTP server test via agent API" $ do
86-
it "should pass without basic auth" $ \_ -> testXFTPServerTest Nothing (noAuthSrv testXFTPServer2) `shouldReturn` Right Nothing
86+
it "should pass without basic auth" $ \_ -> testXFTPServerTest Nothing (noAuthSrv testXFTPServer2) `shouldReturn` Right (Just (Right testServerInformation))
8787
let srv1 = testXFTPServer2 {keyHash = "1234"}
8888
it "should fail with incorrect fingerprint" $ \_ -> do
8989
testXFTPServerTest Nothing (noAuthSrv srv1) `shouldReturn` Left (ProtocolTestFailure TSConnect $ BROKER (B.unpack $ strEncode srv1) $ NETWORK NEUnknownCAError)
9090
describe "server with password" $ do
9191
let auth = Just "abcd"
9292
srv = ProtoServerWithAuth testXFTPServer2
9393
authErr = ProtocolTestFailure TSCreateFile $ XFTP (B.unpack $ strEncode testXFTPServer2) AUTH
94-
it "should pass with correct password" $ \_ -> testXFTPServerTest auth (srv auth) `shouldReturn` Right Nothing
94+
it "should pass with correct password" $ \_ -> testXFTPServerTest auth (srv auth) `shouldReturn` Right (Just (Right testServerInformation))
9595
it "should fail without password" $ \_ -> testXFTPServerTest auth (srv Nothing) `shouldReturn` Left authErr
9696
it "should fail with incorrect password" $ \_ -> testXFTPServerTest auth (srv $ Just "wrong") `shouldReturn` Left authErr
9797

9898
testXFTPServerTest :: HasCallStack => Maybe BasicAuth -> XFTPServerWithAuth -> IO (Either ProtocolTestFailure (Maybe (Either String ServerPublicInfo)))
9999
testXFTPServerTest newFileBasicAuth srv =
100-
withXFTPServerCfg testXFTPServerConfig {newFileBasicAuth, xftpPort = xftpTestPort2} $ \_ ->
100+
withXFTPServerCfg testXFTPServerConfig {newFileBasicAuth, xftpPort = xftpTestPort2, information = Just testServerInformation} $ \_ ->
101101
-- initially passed server is not running
102102
withAgent 1 agentCfg initAgentServers testDB $ \a ->
103103
testProtocolServer a NRMInteractive 1 srv

0 commit comments

Comments
 (0)