From 32383006bd5bccb5abf63aeb5bac1740539a4986 Mon Sep 17 00:00:00 2001 From: James Crayne Date: Mon, 25 Apr 2016 21:56:37 -0400 Subject: add cokiki tests, pending for now --- testkiki/testkiki.hs | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'testkiki/testkiki.hs') diff --git a/testkiki/testkiki.hs b/testkiki/testkiki.hs index aa93e2c..0e4c70a 100644 --- a/testkiki/testkiki.hs +++ b/testkiki/testkiki.hs @@ -56,11 +56,14 @@ main = do doTests :: TestKikiSettings -> IO () doTests tkConfig = hspec $ do + {- + -- Example of shouldThrow describe "TODO: error" $ it "throws an exception" $ evaluate (error "TODO:testsuite") `shouldThrow` anyException + -} - describe "export-public" $ do + describe "kiki export-public" $ do it "does not modify mtime of GNUPGHOME keyrings" $ do pending it "creates external pem files which do not exist" $ do @@ -68,7 +71,7 @@ doTests tkConfig = hspec $ do it "does not leak secret data from GNUPGHOME keyrings" $ do pending - describe "export-secret" $ do + describe "kiki export-secret" $ do it "fails when public keys in existing PEM files do not match" $ do pending it "updates public pem files to private ones when told to" $ do @@ -76,7 +79,7 @@ doTests tkConfig = hspec $ do it "creates external pem files which do not exist" $ do pending - describe "init" $ do + describe "kiki init" $ do it "honors GNUPGHOME environment variable" $ do let kiki = kiki'Env tkConfig (isInfixOf "New packet" <$> kiki ["init"]) `shouldReturn` True @@ -101,12 +104,25 @@ doTests tkConfig = hspec $ do output <- kiki ["init"] b <- doesFileExist (chroot tkConfig "root" ".gnupg" "secring.gpg") (isInfixOf "New packet" output && b ) `shouldBe` True + + describe "cokiki ssh-client" $ do + it "does something" $ + pending + + describe "cokiki ssh-server" $ do + it "does something" $ + pending + + describe "cokiki strongswan" $ do + it "does something" $ + pending where kiki'Env config args = do setEnv "GNUPGHOME" (gnupghome config) let args' = args ++ ["--chroot=" ++ chroot config] - readProcess "./dist/build/kiki/kiki" args' "" + r <- readProcess "./dist/build/kiki/kiki" args' "" unsetEnv "GNUPGHOME" + return r kiki'No'Env'No'Home config args = do let args' = args ++ ["--chroot=" ++ chroot config] @@ -119,8 +135,9 @@ doTests tkConfig = hspec $ do kiki'Env'And'HomeArg config args = do setEnv "GNUPGHOME" (gnupghome config) let args' = args ++ ["--chroot=" ++ chroot config,"--home=" ++ gnupghome config] - readProcess "./dist/build/kiki/kiki" args' "" + r <- readProcess "./dist/build/kiki/kiki" args' "" unsetEnv "GNUPGHOME" + return r -- UTILS isInfixOf sub str = let (_,match) = B.breakSubstring (B.pack sub) (B.pack str) -- cgit v1.2.3