Skip to content

A peer-to-peer stack for code collaboration

rad-project: Wrong import fails 'rad project checkout'

Thomas Scholtes7811125ea258
diff --git a/bin/rad-project b/bin/rad-project
index 3b7608f..c576a02 100755
--- a/bin/rad-project
+++ b/bin/rad-project
@@ -17,7 +17,7 @@
(import monadic/issue '[create-issue-machine!] :unqualified)
(import monadic/project
- '[get-project-url! get-meta create-project! add-rsm! first-rsm-of-type!]
+ '[get-project-url! get-meta! create-project! add-rsm! first-rsm-of-type!]
:unqualified)
(def help
diff --git a/package.yaml b/package.yaml
index 5e172cd..4887942 100644
--- a/package.yaml
+++ b/package.yaml
@@ -125,6 +125,7 @@ tests:
- tasty-hunit
- temporary
- text
+ - unliftio
executables:
rad:
diff --git a/test/e2e/PatchAppTest.hs b/test/e2e/PatchAppTest.hs
index f3aa689..95b8a72 100644
--- a/test/e2e/PatchAppTest.hs
+++ b/test/e2e/PatchAppTest.hs
@@ -9,10 +9,8 @@ import Test.E2ESupport
test_patch_propose :: TestTree
test_patch_propose = testCaseSteps "patch propose" $ \step -> do
+ prepareRadicle
step "Init project"
- _ <- runTestCommand "rad-key" ["create"]
- _ <- runTestCommand "git" ["config", "--global", "user.name", "Alice"]
- _ <- runTestCommand "git" ["config", "--global", "user.email", "[email protected]"]
_ <- runTestCommand' "rad-project" ["init"] ["project-name", "project desc", "1"]
_ <- runTestCommand "git" ["checkout", "-b", "f/test"]
_ <- runTestCommand "touch" ["test"]
diff --git a/test/e2e/ProjectAppTest.hs b/test/e2e/ProjectAppTest.hs
index 81bc2a5..370a51b 100644
--- a/test/e2e/ProjectAppTest.hs
+++ b/test/e2e/ProjectAppTest.hs
@@ -1,17 +1,32 @@
module ProjectAppTest
( test_project_show_id
+ , test_project_checkout
) where
import Protolude
import Test.E2ESupport
+import UnliftIO.Directory
test_project_show_id :: TestTree
test_project_show_id = testCase "project show-id" $ do
- _ <- runTestCommand "rad-key" ["create"]
- _ <- runTestCommand "git" ["config", "--global", "user.name", "Alice"]
- _ <- runTestCommand "git" ["config", "--global", "user.email", "[email protected]"]
+ prepareRadicle
+
_ <- runTestCommand' "rad-project" ["init"] ["project-name", "project desc", "1"]
projectId <- runTestCommand "git" ["config", "--get" ,"radicle.project-id"]
showIdOut <- runTestCommand' "rad-project" ["show-id"] []
assertContains showIdOut projectId
+
+test_project_checkout :: TestTree
+test_project_checkout = testCase "project checkout" $ do
+ prepareRadicle
+
+ createDirectory "origin"
+ projectId <- withCurrentDirectory "origin" $ do
+ _ <- runTestCommand' "rad-project" ["init"] ["project-name", "project desc", "1"]
+ runTestCommand "git" ["config", "--get" ,"radicle.project-id"]
+
+ runTestCommand "rad-project" ["checkout", projectId]
+ withCurrentDirectory "project-name" $ do
+ showIdOut <- runTestCommand' "rad-project" ["show-id"] []
+ assertContains showIdOut projectId
diff --git a/test/e2e/Test/E2ESupport.hs b/test/e2e/Test/E2ESupport.hs
index 10308b4..d1df60f 100644
--- a/test/e2e/Test/E2ESupport.hs
+++ b/test/e2e/Test/E2ESupport.hs
@@ -10,6 +10,8 @@ module Test.E2ESupport
, testCaseSteps
, testCase
+ , prepareRadicle
+
, runTestCommand
, runTestCommand'
@@ -97,6 +99,15 @@ assertContains str substr =
then pure ()
else assertFailure $ "\"" <> substr <> "\" is not contained in \"" <> str <> "\""
+-- * Setup
+
+-- | Runs @rad key create@ and sets the Git user name and email.
+prepareRadicle :: TestM Text
+prepareRadicle = do
+ _ <- runTestCommand "rad-key" ["create"]
+ _ <- runTestCommand "git" ["config", "--global", "user.name", "Alice"]
+ runTestCommand "git" ["config", "--global", "user.email", "[email protected]"]
+
-- * Run commands
-- | Like 'runTestCommand'' but does not provide input to stdin.