diff options
author | Joey Hess <joey@kitenet.net> | 2014-04-17 18:03:39 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-04-17 18:03:39 -0400 |
commit | e9b6c350b15a93d82affadfabca18b3e95840cb1 (patch) | |
tree | 48230725260d92997b1fe58a698f57568f398475 /Test.hs | |
parent | c7c12e735b806eecd62048b822af2d8802671d3f (diff) |
replace (Key, Backend) with Key
Only fsck and reinject and the test suite used the Backend, and they can
look it up as needed from the Key. This simplifies the code and also speeds
it up.
There is a small behavior change here. Before, all commands would warn when
acting on an annexed file with an unknown backend. Now, only fsck and
reinject show that warning.
Diffstat (limited to 'Test.hs')
-rw-r--r-- | Test.hs | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -712,7 +712,7 @@ test_unused env = intmpclonerepoInDirect env $ do (sort expectedkeys) (sort unusedkeys) findkey f = do r <- Backend.lookupFile f - return $ fst $ fromJust r + return $ fromJust r test_describe :: TestEnv -> Assertion test_describe env = intmpclonerepo env $ do @@ -1233,7 +1233,7 @@ test_crypto env = do (c,k) <- annexeval $ do uuid <- Remote.nameToUUID "foo" rs <- Logs.Remote.readRemoteLog - Just (k,_) <- Backend.lookupFile annexedfile + Just k <- Backend.lookupFile annexedfile return (fromJust $ M.lookup uuid rs, k) let key = if scheme `elem` ["hybrid","pubkey"] then Just $ Utility.Gpg.KeyIds [Utility.Gpg.testKeyId] @@ -1500,7 +1500,7 @@ checklocationlog f expected = do thisuuid <- annexeval Annex.UUID.getUUID r <- annexeval $ Backend.lookupFile f case r of - Just (k, _) -> do + Just k -> do uuids <- annexeval $ Remote.keyLocations k assertEqual ("bad content in location log for " ++ f ++ " key " ++ Types.Key.key2file k ++ " uuid " ++ show thisuuid) expected (thisuuid `elem` uuids) @@ -1508,9 +1508,9 @@ checklocationlog f expected = do checkbackend :: FilePath -> Types.Backend -> Assertion checkbackend file expected = do - r <- annexeval $ Backend.lookupFile file - let b = snd $ fromJust r - assertEqual ("backend for " ++ file) expected b + b <- annexeval $ maybe (return Nothing) (Backend.getBackend file) + =<< Backend.lookupFile file + assertEqual ("backend for " ++ file) (Just expected) b inlocationlog :: FilePath -> Assertion inlocationlog f = checklocationlog f True |