|
10 | 10 |
|
11 | 11 | module XFTPAgent where |
12 | 12 |
|
13 | | -import AgentTests.FunctionalAPITests (get, rfGet, runRight, runRight_, sfGet, withAgent) |
| 13 | +import AgentTests.FunctionalAPITests (get, rfGet, runRight, runRight_, sfGet, withAgent, testServerInformation) |
14 | 14 |
|
15 | 15 | import Control.Logger.Simple |
16 | 16 | import Control.Monad |
@@ -83,21 +83,21 @@ xftpAgentTests = |
83 | 83 | it "if file is expired on server, should report error and continue receiving next file" testXFTPAgentExpiredOnServer |
84 | 84 | it "should request additional recipient IDs when number of recipients exceeds maximum per request" testXFTPAgentRequestAdditionalRecipientIDs |
85 | 85 | 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)) |
87 | 87 | let srv1 = testXFTPServer2 {keyHash = "1234"} |
88 | 88 | it "should fail with incorrect fingerprint" $ \_ -> do |
89 | 89 | testXFTPServerTest Nothing (noAuthSrv srv1) `shouldReturn` Left (ProtocolTestFailure TSConnect $ BROKER (B.unpack $ strEncode srv1) $ NETWORK NEUnknownCAError) |
90 | 90 | describe "server with password" $ do |
91 | 91 | let auth = Just "abcd" |
92 | 92 | srv = ProtoServerWithAuth testXFTPServer2 |
93 | 93 | 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)) |
95 | 95 | it "should fail without password" $ \_ -> testXFTPServerTest auth (srv Nothing) `shouldReturn` Left authErr |
96 | 96 | it "should fail with incorrect password" $ \_ -> testXFTPServerTest auth (srv $ Just "wrong") `shouldReturn` Left authErr |
97 | 97 |
|
98 | 98 | testXFTPServerTest :: HasCallStack => Maybe BasicAuth -> XFTPServerWithAuth -> IO (Either ProtocolTestFailure (Maybe (Either String ServerPublicInfo))) |
99 | 99 | testXFTPServerTest newFileBasicAuth srv = |
100 | | - withXFTPServerCfg testXFTPServerConfig {newFileBasicAuth, xftpPort = xftpTestPort2} $ \_ -> |
| 100 | + withXFTPServerCfg testXFTPServerConfig {newFileBasicAuth, xftpPort = xftpTestPort2, information = Just testServerInformation} $ \_ -> |
101 | 101 | -- initially passed server is not running |
102 | 102 | withAgent 1 agentCfg initAgentServers testDB $ \a -> |
103 | 103 | testProtocolServer a NRMInteractive 1 srv |
|
0 commit comments