2021-01-22 21:47:22 +00:00
|
|
|
// Package groupme defines a client capable of executing API commands for the GroupMe chat service
|
2020-07-30 02:20:57 +00:00
|
|
|
package groupme
|
|
|
|
|
|
|
|
import (
|
2021-01-22 21:47:22 +00:00
|
|
|
"context"
|
2020-07-30 02:20:57 +00:00
|
|
|
"net/http"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/gorilla/mux"
|
|
|
|
"github.com/stretchr/testify/suite"
|
|
|
|
)
|
|
|
|
|
|
|
|
type SMSModeAPISuite struct{ APISuite }
|
|
|
|
|
|
|
|
func (s *SMSModeAPISuite) SetupSuite() {
|
|
|
|
s.handler = smsModeTestRouter()
|
|
|
|
s.setupSuite()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *SMSModeAPISuite) TestSMSModeCreate() {
|
2021-01-22 21:47:22 +00:00
|
|
|
s.Assert().NoError(s.client.CreateSMSMode(context.Background(), 10, nil))
|
2020-07-30 02:20:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *SMSModeAPISuite) TestSMSModeDelete() {
|
2021-01-22 21:47:22 +00:00
|
|
|
s.Assert().NoError(s.client.DeleteSMSMode(context.Background()))
|
2020-07-30 02:20:57 +00:00
|
|
|
}
|
|
|
|
func TestSMSModeAPISuite(t *testing.T) {
|
|
|
|
suite.Run(t, new(SMSModeAPISuite))
|
|
|
|
}
|
|
|
|
|
2021-01-22 21:47:22 +00:00
|
|
|
// nolint // not duplicate code
|
2020-07-30 02:20:57 +00:00
|
|
|
func smsModeTestRouter() *mux.Router {
|
2020-07-31 11:29:08 +00:00
|
|
|
router := mux.NewRouter().Queries("token", "").Subrouter()
|
2020-07-30 02:20:57 +00:00
|
|
|
|
|
|
|
// Create
|
|
|
|
router.Path("/users/sms_mode").
|
|
|
|
Methods("POST").
|
|
|
|
Name("CreateSMSMode").
|
|
|
|
HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
|
|
|
w.WriteHeader(201)
|
|
|
|
})
|
|
|
|
|
|
|
|
// Delete
|
|
|
|
router.Path("/users/sms_mode/delete").
|
|
|
|
Methods("POST").
|
|
|
|
Name("DeleteSMSMode").
|
|
|
|
HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
|
|
|
w.WriteHeader(200)
|
|
|
|
})
|
|
|
|
|
|
|
|
/*// Return test router //*/
|
|
|
|
return router
|
|
|
|
}
|