-
Notifications
You must be signed in to change notification settings - Fork 12
/
comment_test.go
41 lines (34 loc) · 1.09 KB
/
comment_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package reddit
import (
"fmt"
"github.com/jarcoal/httpmock"
"github.com/stretchr/testify/assert"
"testing"
)
func TestDeleteComment(t *testing.T) {
url := fmt.Sprintf("%s/api/del", baseAuthURL)
httpmock.Activate()
httpmock.RegisterResponder("POST", url, httpmock.NewStringResponder(200, "{}"))
defer httpmock.DeactivateAndReset()
client := NoAuthClient
err := client.DeleteComment("d9hthja")
assert.NoError(t, err)
}
func TestEditCommentText(t *testing.T) {
url := fmt.Sprintf("%s/api/editusertext", baseAuthURL)
httpmock.Activate()
httpmock.RegisterResponder("POST", url, httpmock.NewStringResponder(200, "{}"))
defer httpmock.DeactivateAndReset()
client := NoAuthClient
err := client.EditCommentText("d9hthja", "Hello World!")
assert.NoError(t, err)
}
func TestReplyToComment(t *testing.T) {
url := fmt.Sprintf("%s/api/comment", baseAuthURL)
httpmock.Activate()
httpmock.RegisterResponder("POST", url, httpmock.NewStringResponder(200, "{}"))
defer httpmock.DeactivateAndReset()
client := NoAuthClient
err := client.ReplyToComment("d9hthja", "Hello World!")
assert.NoError(t, err)
}