@cryptotaxi247 / kubo / commits / f8b17c68d

dag: sharness tests for dag-pb put

License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>

Łukasz Magiera committed Aug 12, 2017 at 19:58 UTC f8b17c68d99bdb62e28cee4602000d5bb42f22e2
1 file changed +25
test/sharness/t0053-dag.sh
+25
@@ -141,6 +141,31 @@ test_dag_cmd() {
141 EXPHASH="zBwWX8u9LYZdCWqaryJW8QsBstghHSPy41nfhhFLY9qw1Vu2BWqnMFtk1jL3qCtEdGd7Kqw1HNPZv5z8LxP2eHGGDCdRE"
142 test $EXPHASH = $IPLDHASH
143 '
144 +
145 + test_expect_success "prepare dag-pb object" '
146 + echo foo > test_file &&
147 + HASH=$(ipfs add -wq test_file | tail -n1)
148 + '
149 +
150 + test_expect_success "dag put with json dag-pb works" '
151 + ipfs dag get $HASH > pbjson &&
152 + cat pbjson | ipfs dag put --format=dag-pb --input-enc=json > dag_put_out
153 + '
154 +
155 + test_expect_success "dag put with dag-pb works output looks good" '
156 + printf $HASH > dag_put_exp &&
157 + test_cmp dag_put_exp dag_put_out
158 + '
159 +
160 + test_expect_success "dag put with raw dag-pb works" '
161 + ipfs block get $HASH > pbraw &&
162 + cat pbraw | ipfs dag put --format=dag-pb --input-enc=raw > dag_put_out
163 + '
164 +
165 + test_expect_success "dag put with dag-pb works output looks good" '
166 + printf $HASH > dag_put_exp &&
167 + test_cmp dag_put_exp dag_put_out
168 + '
169 }
170
171 # should work offline