Reuse common service struct

Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
Vartan Benohanian
2020-06-27 23:53:59 -04:00
parent c8d7abf216
commit 33294aa036
18 changed files with 172 additions and 339 deletions
+3 -9
View File
@@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/assert"
)
func TestVoteServiceOp_Up(t *testing.T) {
func TestVoteService_Up(t *testing.T) {
setup()
defer teardown()
@@ -24,8 +24,6 @@ func TestVoteServiceOp_Up(t *testing.T) {
err := r.ParseForm()
assert.NoError(t, err)
assert.Equal(t, form, r.PostForm)
fmt.Fprint(w, `{}`)
})
res, err := client.Vote.Up(ctx, "t3_test")
@@ -33,7 +31,7 @@ func TestVoteServiceOp_Up(t *testing.T) {
assert.Equal(t, http.StatusOK, res.StatusCode)
}
func TestVoteServiceOp_Down(t *testing.T) {
func TestVoteService_Down(t *testing.T) {
setup()
defer teardown()
@@ -48,8 +46,6 @@ func TestVoteServiceOp_Down(t *testing.T) {
err := r.ParseForm()
assert.NoError(t, err)
assert.Equal(t, form, r.PostForm)
fmt.Fprint(w, `{}`)
})
res, err := client.Vote.Down(ctx, "t3_test")
@@ -57,7 +53,7 @@ func TestVoteServiceOp_Down(t *testing.T) {
assert.Equal(t, http.StatusOK, res.StatusCode)
}
func TestVoteServiceOp_Remove(t *testing.T) {
func TestVoteService_Remove(t *testing.T) {
setup()
defer teardown()
@@ -72,8 +68,6 @@ func TestVoteServiceOp_Remove(t *testing.T) {
err := r.ParseForm()
assert.NoError(t, err)
assert.Equal(t, form, r.PostForm)
fmt.Fprint(w, `{}`)
})
res, err := client.Vote.Remove(ctx, "t3_test")