summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe <joe@blackbird>2016-04-26 00:15:10 -0400
committerJames Crayne <jim.crayne@gmail.com>2016-04-26 06:04:05 -0400
commitd5e031656940e9cff4d4ca6023dea0fb4d2c4dc3 (patch)
tree0f9d66792637045b5996ec19da5664984ffc0143
parent65dcea26eb9cc44f321e219e65ee50ef7045b444 (diff)
testkiki fixes
-rw-r--r--testkiki/testkiki.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/testkiki/testkiki.hs b/testkiki/testkiki.hs
index 4215637..8b43068 100644
--- a/testkiki/testkiki.hs
+++ b/testkiki/testkiki.hs
@@ -53,7 +53,7 @@ main = do
53 exitFailure 53 exitFailure
54 else do 54 else do
55 let chrootdir = cwd </> tdir </> "chroot" 55 let chrootdir = cwd </> tdir </> "chroot"
56 gnupghomedir = cwd </> tdir </> "gnupghome" 56 gnupghomedir = "gnupghome"
57 createDirectoryIfMissing True chrootdir 57 createDirectoryIfMissing True chrootdir
58 createDirectoryIfMissing True gnupghomedir 58 createDirectoryIfMissing True gnupghomedir
59 let config = TKS { chroot = chrootdir , gnupghome = gnupghomedir } 59 let config = TKS { chroot = chrootdir , gnupghome = gnupghomedir }
@@ -86,7 +86,7 @@ doTests tkConfig = hspec $ do
86 it "creates new secring honoring GNUPGHOME" $ do 86 it "creates new secring honoring GNUPGHOME" $ do
87 let kiki = kiki'Env'And'HomeArg tkConfig 87 let kiki = kiki'Env'And'HomeArg tkConfig
88 output <- kiki ["init"] 88 output <- kiki ["init"]
89 b <- doesFileExist (gnupghome tkConfig </> "secring.gpg") 89 b <- doesFileExist (chroot tkConfig </> gnupghome tkConfig </> "secring.gpg")
90 (isInfixOf "New packet" output && b ) `shouldBe` True 90 (isInfixOf "New packet" output && b ) `shouldBe` True
91 91
92 it "creates new secring in /root/.gnupg" $ do 92 it "creates new secring in /root/.gnupg" $ do
@@ -94,7 +94,9 @@ doTests tkConfig = hspec $ do
94 unsetEnv "GNUPGHOME" 94 unsetEnv "GNUPGHOME"
95 createDirectoryIfMissing True (chroot tkConfig </> "root" </> ".gnupg") 95 createDirectoryIfMissing True (chroot tkConfig </> "root" </> ".gnupg")
96 output <- kiki ["init"] 96 output <- kiki ["init"]
97 b <- doesFileExist (chroot tkConfig </> "root" </> ".gnupg" </> "secring.gpg") 97 let p = (chroot tkConfig </> "root" </> ".gnupg" </> "secring.gpg")
98 putStrLn $ "Does exist? " ++ show p
99 b <- doesFileExist p
98 (isInfixOf "New packet" output && b ) `shouldBe` True 100 (isInfixOf "New packet" output && b ) `shouldBe` True
99 101
100 describe "kiki export-public" $ do 102 describe "kiki export-public" $ do
@@ -144,12 +146,12 @@ doTests tkConfig = hspec $ do
144 readProcess "./dist/build/kiki/kiki" args' "" 146 readProcess "./dist/build/kiki/kiki" args' ""
145 147
146 kiki'No'Env config args = do 148 kiki'No'Env config args = do
147 let args' = args ++ ["--chroot=" ++ chroot config,"--homedir", gnupghome config] 149 let args' = args ++ ["--chroot=" ++ chroot config,"--homedir=" ++ gnupghome config]
148 readProcess "./dist/build/kiki/kiki" args' "" 150 readProcess "./dist/build/kiki/kiki" args' ""
149 151
150 kiki'Env'And'HomeArg config args = do 152 kiki'Env'And'HomeArg config args = do
151 setEnv "GNUPGHOME" (gnupghome config) 153 setEnv "GNUPGHOME" (gnupghome config)
152 let args' = args ++ ["--chroot=" ++ chroot config,"--homedir", gnupghome config] 154 let args' = args ++ ["--chroot=" ++ chroot config,"--homedir=" ++ gnupghome config]
153 r <- readProcess "./dist/build/kiki/kiki" args' "" 155 r <- readProcess "./dist/build/kiki/kiki" args' ""
154 unsetEnv "GNUPGHOME" 156 unsetEnv "GNUPGHOME"
155 return r 157 return r