package shell

import (
	"bytes"
	"fmt"
	"os"
	"testing"
)

func TestCat(t *testing.T) {
	myShell, err := NewShell()
	if err != nil {
		fmt.Fprintf(os.Stderr, "error: %s\n", err)
		os.Exit(1)
	}

	reader, err := myShell.Cat("QmYCvbfNbCwFR45HiNP45rwJgvatpiW38D961L5qAhUM5Y")
	if err != nil {
		fmt.Fprintf(os.Stderr, "error: %s\n", err)
		os.Exit(1)
	}

	buf := new(bytes.Buffer)
	buf.ReadFrom(reader)
	output := buf.String()

	expected := `Come hang out in our IRC chat room if you have any questions.

Contact the ipfs dev team:
- Bugs: https://github.com/ipfs/go-ipfs/issues
- Help: irc.freenode.org/#ipfs
- Email: dev@ipfs.io
`

	if output != expected {
		t.FailNow()
	}
}

package shell

import (
	"bytes"
	"fmt"
	"os"
	"testing"
)

func TestCat(t *testing.T) {
	myShell, err := NewShell()
	if err != nil {
		fmt.Fprintf(os.Stderr, "error: %s\n", err)
		os.Exit(1)
	}

	reader, err := myShell.Cat("QmQLBvJ3ur7U7mzbYDLid7WkaciY84SLpPYpGPHhDNps2Y")
	if err != nil {
		fmt.Fprintf(os.Stderr, "error: %s\n", err)
		os.Exit(1)
	}

	buf := new(bytes.Buffer)
	buf.ReadFrom(reader)
	output := buf.String()

	expected := "\"The man who makes no mistakes does not make anything.\" - Edward John Phelps\n"

	if output != expected {
		t.FailNow()
	}
}

--- 
+++ 
@@ -14,7 +14,7 @@
 		os.Exit(1)
 	}
 
-	reader, err := myShell.Cat("QmQLBvJ3ur7U7mzbYDLid7WkaciY84SLpPYpGPHhDNps2Y")
+	reader, err := myShell.Cat("QmYCvbfNbCwFR45HiNP45rwJgvatpiW38D961L5qAhUM5Y")
 	if err != nil {
 		fmt.Fprintf(os.Stderr, "error: %s\n", err)
 		os.Exit(1)
@@ -24,7 +24,13 @@
 	buf.ReadFrom(reader)
 	output := buf.String()
 
-	expected := "\"The man who makes no mistakes does not make anything.\" - Edward John Phelps\n"
+	expected := `Come hang out in our IRC chat room if you have any questions.
+
+Contact the ipfs dev team:
+- Bugs: https://github.com/ipfs/go-ipfs/issues
+- Help: irc.freenode.org/#ipfs
+- Email: dev@ipfs.io
+`
 
 	if output != expected {
 		t.FailNow()
Make getshell test more reliable.

This test now uses the 'contact' doc from the standard asset set. While
still not guaranteed to be present, this is a significant improvement
from the previous ad-hoc test document, which required it be manually
added to the local repo ahead of time.
