Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Clean up output for Hardware CLI #43

Merged
merged 5 commits into from
Jan 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions builds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"net/http"
"net/http/httptest"
"testing"

"github.com/stretchr/testify/assert"
)

func TestBuildsGetAll(t *testing.T) {
Expand All @@ -28,7 +30,7 @@ func TestBuildsGetAll(t *testing.T) {

assertRequestCount(t, spy.requestCount, 1)
assertRequestPath(t, spy.requestPath, "/build")
assertData(t, got, buildList)
assert.Equal(t, got, buildList)
}

func TestBuildsGet(t *testing.T) {
Expand All @@ -49,7 +51,7 @@ func TestBuildsGet(t *testing.T) {
assertRequestMethod(t, spy.requestMethod, "GET")
assertRequestCount(t, spy.requestCount, 1)
assertRequestPath(t, spy.requestPath, fmt.Sprintf("/build/%s", build.ID))
assertData(t, got, build)
assert.Equal(t, got, build)
}

func TestBuildsGetByName(t *testing.T) {
Expand All @@ -70,7 +72,7 @@ func TestBuildsGetByName(t *testing.T) {
assertRequestMethod(t, spy.requestMethod, "GET")
assertRequestCount(t, spy.requestCount, 1)
assertRequestPath(t, spy.requestPath, fmt.Sprintf("/build/%s", build.Name))
assertData(t, got, build)
assert.Equal(t, got, build)
}

func TestBuildsCreate(t *testing.T) {
Expand Down Expand Up @@ -100,7 +102,7 @@ func TestBuildsCreate(t *testing.T) {
}

// now let's check what we made in the server is what we got in the client
assertData(t, got, want)
assert.Equal(t, got, want)
}

func TestBuildsGetUsers(t *testing.T) {
Expand All @@ -123,7 +125,7 @@ func TestBuildsGetUsers(t *testing.T) {
assertRequestMethod(t, spy.requestMethod, "GET")
assertRequestCount(t, spy.requestCount, 1)
assertRequestPath(t, spy.requestPath, fmt.Sprintf("/build/%s/user", build.ID))
assertData(t, got, list)
assert.Equal(t, got, list)
}

func TestBuildsAddUser(t *testing.T) {
Expand Down Expand Up @@ -191,7 +193,7 @@ func TestBuildsGetOrgs(t *testing.T) {
assertRequestMethod(t, spy.requestMethod, "GET")
assertRequestCount(t, spy.requestCount, 1)
assertRequestPath(t, spy.requestPath, fmt.Sprintf("/build/%s/organization", build.ID))
assertData(t, got, list)
assert.Equal(t, got, list)
}

func TestBuildsAddOrg(t *testing.T) {
Expand Down Expand Up @@ -259,7 +261,7 @@ func TestBuildsGetDevices(t *testing.T) {
assertRequestMethod(t, spy.requestMethod, "GET")
assertRequestCount(t, spy.requestCount, 1)
assertRequestPath(t, spy.requestPath, fmt.Sprintf("/build/%s/device", build.ID))
assertData(t, got, list)
assert.Equal(t, got, list)
}

func TestBuildsAddDevice(t *testing.T) {
Expand Down Expand Up @@ -327,7 +329,7 @@ func TestBuildsGetRacks(t *testing.T) {
assertRequestMethod(t, spy.requestMethod, "GET")
assertRequestCount(t, spy.requestCount, 1)
assertRequestPath(t, spy.requestPath, fmt.Sprintf("/build/%s/rack", build.ID))
assertData(t, got, list)
assert.Equal(t, got, list)
}

func TestBuildsAddRack(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ type DeviceLocation struct {
RackName string `json:"rack"`
RackUnitStart int `json:"rack_unit_start" faker:"rack_unit_start"`
TargetHardwareProduct struct {
ID uuid.UUID `json:"id" faker"uuid"`
ID uuid.UUID `json:"id" faker:"uuid"`
Name string `json:"name"`
Alias string `json:"alias"`
Vendor string `json:"hardware_vendor_id"`
Expand Down
2 changes: 1 addition & 1 deletion errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func errorHandler() {
fmt.Println(err)
}
fmt.Fprintf(os.Stderr,
"HTTP Request: %s",
"HTTP Request: %s\n\n",
reqDump,
)

Expand Down
Loading