cli/tests: Add test for `rad clone --scope`
This commit is contained in:
parent
eea3617781
commit
281f92e9ff
|
|
@ -0,0 +1,63 @@
|
|||
By default `rad clone` should add a seeding policy with the `followed` scope:
|
||||
|
||||
```
|
||||
$ rad clone rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
||||
✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'followed'
|
||||
✓ Creating checkout in ./heartwood..
|
||||
✓ Repository successfully cloned under [..]/heartwood/
|
||||
╭────────────────────────────────────╮
|
||||
│ heartwood │
|
||||
│ Radicle Heartwood Protocol & Stack │
|
||||
│ 0 issues · 0 patches │
|
||||
╰────────────────────────────────────╯
|
||||
Run `cd ./heartwood` to go to the repository directory.
|
||||
$ rad seed
|
||||
╭───────────────────────────────────────────────────────────────────╮
|
||||
│ Repository Name Policy Scope │
|
||||
├───────────────────────────────────────────────────────────────────┤
|
||||
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji heartwood allow followed │
|
||||
╰───────────────────────────────────────────────────────────────────╯
|
||||
$ rm -rf heartwood
|
||||
```
|
||||
|
||||
Specifying a different scope explicitly should update the policy:
|
||||
|
||||
```
|
||||
$ rad clone rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --scope all
|
||||
✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'all'
|
||||
✓ Creating checkout in ./heartwood..
|
||||
✓ Repository successfully cloned under [..]/heartwood/
|
||||
╭────────────────────────────────────╮
|
||||
│ heartwood │
|
||||
│ Radicle Heartwood Protocol & Stack │
|
||||
│ 0 issues · 0 patches │
|
||||
╰────────────────────────────────────╯
|
||||
Run `cd ./heartwood` to go to the repository directory.
|
||||
$ rad seed
|
||||
╭────────────────────────────────────────────────────────────────╮
|
||||
│ Repository Name Policy Scope │
|
||||
├────────────────────────────────────────────────────────────────┤
|
||||
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji heartwood allow all │
|
||||
╰────────────────────────────────────────────────────────────────╯
|
||||
$ rm -rf heartwood
|
||||
```
|
||||
|
||||
Running `rad clone` again without an explicit scope parameter should not change the existing policy:
|
||||
|
||||
```
|
||||
$ rad clone rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
||||
✓ Creating checkout in ./heartwood..
|
||||
✓ Repository successfully cloned under [..]/heartwood/
|
||||
╭────────────────────────────────────╮
|
||||
│ heartwood │
|
||||
│ Radicle Heartwood Protocol & Stack │
|
||||
│ 0 issues · 0 patches │
|
||||
╰────────────────────────────────────╯
|
||||
Run `cd ./heartwood` to go to the repository directory.
|
||||
$ rad seed
|
||||
╭────────────────────────────────────────────────────────────────╮
|
||||
│ Repository Name Policy Scope │
|
||||
├────────────────────────────────────────────────────────────────┤
|
||||
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji heartwood allow all │
|
||||
╰────────────────────────────────────────────────────────────────╯
|
||||
```
|
||||
|
|
@ -295,3 +295,23 @@ fn test_clone_without_seeds() {
|
|||
.rad("inspect", &[], working.join("heartwood").as_path())
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rad_clone_scope() {
|
||||
let mut environment = Environment::new();
|
||||
let mut alice = environment.node("alice");
|
||||
let working = environment.tempdir().join("working");
|
||||
|
||||
let rid = alice.project("heartwood", "Radicle Heartwood Protocol & Stack");
|
||||
|
||||
let mut alice = alice.spawn();
|
||||
alice.handle.unseed(rid).unwrap();
|
||||
|
||||
test(
|
||||
"examples/rad-clone-scope.md",
|
||||
working,
|
||||
Some(&alice.home),
|
||||
[],
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue