From 5a0b6e593afadd4efba0c2c90684f9cbc1ce76ef Mon Sep 17 00:00:00 2001 From: Jeromy Date: Tue, 12 Apr 2016 11:06:03 -0700 Subject: [PATCH] small sharness test for promise failure checking License: MIT Signed-off-by: Jeromy --- test/sharness/t0090-get.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/sharness/t0090-get.sh b/test/sharness/t0090-get.sh index b678b5823..3b60a360f 100755 --- a/test/sharness/t0090-get.sh +++ b/test/sharness/t0090-get.sh @@ -113,9 +113,30 @@ test_get_cmd() { ' } +test_get_fail() { + test_expect_success "create an object that has unresolveable links" ' + cat <<-\EOF >bad_object && +{ "Links": [ { "Name": "foo", "Hash": "QmZzaC6ydNXiR65W8VjGA73ET9MZ6VFAqUT1ngYMXcpihn", "Size": 1897 }, { "Name": "bar", "Hash": "Qmd4mG6pDFDmDTn6p3hX1srP8qTbkyXKj5yjpEsiHDX3u8", "Size": 56 }, { "Name": "baz", "Hash": "QmUTjwRnG28dSrFFVTYgbr6LiDLsBmRr2SaUSTGheK2YqG", "Size": 24266 } ], "Data": "\b\u0001" } + EOF + cat bad_object | ipfs object put > put_out + ' + + test_expect_success "output looks good" ' + echo "added QmaGidyrnX8FMbWJoxp8HVwZ1uRKwCyxBJzABnR1S2FVUr" > put_exp && + test_cmp put_exp put_out + ' + + test_expect_success "ipfs get fails" ' + test_expect_code 1 ipfs get QmaGidyrnX8FMbWJoxp8HVwZ1uRKwCyxBJzABnR1S2FVUr + ' +} + # should work offline test_get_cmd +# only really works offline, will try and search network when online +test_get_fail + # should work online test_launch_ipfs_daemon test_get_cmd