Change setup method signature for tests, no global vars
Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
+13
-13
@@ -71,7 +71,7 @@ var expectedCollections = []*Collection{
|
||||
}
|
||||
|
||||
func TestCollectionService_Get(t *testing.T) {
|
||||
setup()
|
||||
client, mux, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
blob, err := readFileContents("../testdata/collection/collection.json")
|
||||
@@ -97,7 +97,7 @@ func TestCollectionService_Get(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCollectionService_FromSubreddit(t *testing.T) {
|
||||
setup()
|
||||
client, mux, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
blob, err := readFileContents("../testdata/collection/collections.json")
|
||||
@@ -122,7 +122,7 @@ func TestCollectionService_FromSubreddit(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCollectionService_Create(t *testing.T) {
|
||||
setup()
|
||||
client, mux, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
blob, err := readFileContents("../testdata/collection/collection.json")
|
||||
@@ -156,7 +156,7 @@ func TestCollectionService_Create(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCollectionService_Delete(t *testing.T) {
|
||||
setup()
|
||||
client, mux, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/api/v1/collections/delete_collection", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -175,7 +175,7 @@ func TestCollectionService_Delete(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCollectionService_AddPost(t *testing.T) {
|
||||
setup()
|
||||
client, mux, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/api/v1/collections/add_post_to_collection", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -195,7 +195,7 @@ func TestCollectionService_AddPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCollectionService_RemovePost(t *testing.T) {
|
||||
setup()
|
||||
client, mux, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/api/v1/collections/remove_post_in_collection", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -215,7 +215,7 @@ func TestCollectionService_RemovePost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCollectionService_ReorderPosts(t *testing.T) {
|
||||
setup()
|
||||
client, mux, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/api/v1/collections/reorder_collection", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -235,7 +235,7 @@ func TestCollectionService_ReorderPosts(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCollectionService_UpdateTitle(t *testing.T) {
|
||||
setup()
|
||||
client, mux, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/api/v1/collections/update_collection_title", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -255,7 +255,7 @@ func TestCollectionService_UpdateTitle(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCollectionService_UpdateDescription(t *testing.T) {
|
||||
setup()
|
||||
client, mux, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/api/v1/collections/update_collection_description", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -275,7 +275,7 @@ func TestCollectionService_UpdateDescription(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCollectionService_UpdateLayoutTimeline(t *testing.T) {
|
||||
setup()
|
||||
client, mux, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/api/v1/collections/update_collection_display_layout", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -295,7 +295,7 @@ func TestCollectionService_UpdateLayoutTimeline(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCollectionService_UpdateLayoutGallery(t *testing.T) {
|
||||
setup()
|
||||
client, mux, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/api/v1/collections/update_collection_display_layout", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -315,7 +315,7 @@ func TestCollectionService_UpdateLayoutGallery(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCollectionService_Follow(t *testing.T) {
|
||||
setup()
|
||||
client, mux, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/api/v1/collections/follow_collection", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -335,7 +335,7 @@ func TestCollectionService_Follow(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCollectionService_Unfollow(t *testing.T) {
|
||||
setup()
|
||||
client, mux, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/api/v1/collections/follow_collection", func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user