forked from google/jsonapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tests for the REST endpoints exposed in our example. Added a sc…
…ript for running the example app. Split the example into multiple files.
- Loading branch information
Showing
6 changed files
with
326 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package main | ||
|
||
import "time" | ||
|
||
func fixtureBlogCreate(i int) *Blog { | ||
return &Blog{ | ||
ID: 1 * i, | ||
Title: "Title 1", | ||
CreatedAt: time.Now(), | ||
Posts: []*Post{ | ||
&Post{ | ||
ID: 1 * i, | ||
Title: "Foo", | ||
Body: "Bar", | ||
Comments: []*Comment{ | ||
&Comment{ | ||
ID: 1 * i, | ||
Body: "foo", | ||
}, | ||
&Comment{ | ||
ID: 2 * i, | ||
Body: "bar", | ||
}, | ||
}, | ||
}, | ||
&Post{ | ||
ID: 2 * i, | ||
Title: "Fuubar", | ||
Body: "Bas", | ||
Comments: []*Comment{ | ||
&Comment{ | ||
ID: 1 * i, | ||
Body: "foo", | ||
}, | ||
&Comment{ | ||
ID: 3 * i, | ||
Body: "bas", | ||
}, | ||
}, | ||
}, | ||
}, | ||
CurrentPost: &Post{ | ||
ID: 1 * i, | ||
Title: "Foo", | ||
Body: "Bar", | ||
Comments: []*Comment{ | ||
&Comment{ | ||
ID: 1 * i, | ||
Body: "foo", | ||
}, | ||
&Comment{ | ||
ID: 2 * i, | ||
Body: "bar", | ||
}, | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
func fixtureBlogsList() (blogs []interface{}) { | ||
for i := 0; i < 10; i++ { | ||
blogs = append(blogs, fixtureBlogCreate(i)) | ||
} | ||
|
||
return blogs | ||
} |
Oops, something went wrong.