package main

import (
	"bytes"
	// "net/http"
	// "strconv"
	"testing"
	// "time"
)

func TestReadUserHandler(t *testing.T) {
	app := newTestApplication(t)
	ts := newTestServer(t, app, routes(app))
	defer ts.Close()

	token := ts.registerAndLogin(t, uniqueEmail(), "pa$$word123", "viewer")

	code, _, body := ts.getWithToken(t, "/v1/users/1", token)

	if code != 200 {
		t.Errorf("want %d; got %d", 200, code)
	}

	if !bytes.Contains(body, []byte("An old silent pond...")) {
		t.Errorf("want body to contain %q; got %q", "", string(body))
	}
}
