-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial support for identity hashes.
License: MIT Signed-off-by: Kevin Atkinson <[email protected]>
- Loading branch information
Showing
2 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env bash | ||
|
||
test_description="Test basic operations with identity hash" | ||
|
||
. lib/test-lib.sh | ||
|
||
test_init_ipfs | ||
|
||
ID_HASH0=z25RnHTQ7DveGAsV6YDSDR8EkWvD | ||
ID_HASH0_CONTENTS=jkD98jkD975hkD8 | ||
|
||
test_expect_success "can fetch random id hash" ' | ||
ipfs cat $ID_HASH0 > expected && | ||
echo $ID_HASH0_CONTENTS > actual && | ||
test_cmp expected actual | ||
' | ||
|
||
test_expect_success "can pin random id hash" ' | ||
ipfs pin add $ID_HASH0 | ||
' | ||
|
||
test_expect_success "ipfs add succeeds with id hash" ' | ||
echo "djkd7jdkd7jkHHG" > junk.txt && | ||
HASH=$(ipfs add -q --hash=id junk.txt) | ||
' | ||
|
||
test_expect_success "content not actually added" ' | ||
ipfs refs local | fgrep -q -v $HASH | ||
' | ||
|
||
test_expect_success "but can fetch it anyway" ' | ||
ipfs cat $HASH > actual && | ||
test_cmp junk.txt actual | ||
' | ||
|
||
test_expect_success "block rm does nothing" ' | ||
ipfs pin rm $HASH && | ||
ipfs block rm $HASH | ||
' | ||
|
||
test_expect_success "can still fetch it" ' | ||
ipfs cat $HASH > actual | ||
test_cmp junk.txt actual | ||
' | ||
|
||
test_done |