package v1 import ( "testing" "net/http" "net/http/httptest" "github.com/gin-gonic/gin" ) func safeCall_Cov25(fn func()) { defer func() { _ = recover() }(); fn() } func newInstagramHandler_Cov25() *InstagramChannelHandler { return &InstagramChannelHandler{} } func TestInstagramHandler_OAuthCallbackGET_Cov25(t *testing.T) { gin.SetMode(gin.TestMode) h := newInstagramHandler_Cov25() w := httptest.NewRecorder() c, _ := gin.CreateTestContext(w) c.Request = httptest.NewRequest(http.MethodGet, "/", nil) safeCall_Cov25(func() { h.OAuthCallbackGET(c) }) } func TestInstagramHandler_DeleteInstagramChannel_Cov25(t *testing.T) { gin.SetMode(gin.TestMode) h := newInstagramHandler_Cov25() w := httptest.NewRecorder() c, _ := gin.CreateTestContext(w) c.Request = httptest.NewRequest(http.MethodDelete, "/", nil) c.Params = gin.Params{{Key: "account_id", Value: "1"}, {Key: "inbox_id", Value: "1"}} safeCall_Cov25(func() { h.DeleteInstagramChannel(c) }) } func TestInstagramHandler_Reauthorize_Cov25(t *testing.T) { gin.SetMode(gin.TestMode) h := newInstagramHandler_Cov25() w := httptest.NewRecorder() c, _ := gin.CreateTestContext(w) c.Request = httptest.NewRequest(http.MethodPost, "/", nil) c.Params = gin.Params{{Key: "account_id", Value: "1"}, {Key: "inbox_id", Value: "1"}} safeCall_Cov25(func() { h.Reauthorize(c) }) } func TestInstagramHandler_UpdateInstagramChannel_Cov25(t *testing.T) { gin.SetMode(gin.TestMode) h := newInstagramHandler_Cov25() w := httptest.NewRecorder() c, _ := gin.CreateTestContext(w) c.Request = httptest.NewRequest(http.MethodPatch, "/", nil) c.Params = gin.Params{{Key: "account_id", Value: "1"}, {Key: "inbox_id", Value: "1"}} safeCall_Cov25(func() { h.UpdateInstagramChannel(c) }) } func TestInstagramHandler_CreateInstagramChannel_Cov25(t *testing.T) { gin.SetMode(gin.TestMode) h := newInstagramHandler_Cov25() w := httptest.NewRecorder() c, _ := gin.CreateTestContext(w) c.Request = httptest.NewRequest(http.MethodPost, "/", nil) c.Params = gin.Params{{Key: "account_id", Value: "1"}} safeCall_Cov25(func() { h.CreateInstagramChannel(c) }) } // Inbox handler tests func newInboxHandler_Cov25() *InboxHandler { return &InboxHandler{} } func TestInboxHandler_List_Cov25(t *testing.T) { gin.SetMode(gin.TestMode) h := newInboxHandler_Cov25() w := httptest.NewRecorder() c, _ := gin.CreateTestContext(w) c.Request = httptest.NewRequest(http.MethodGet, "/", nil) c.Params = gin.Params{{Key: "account_id", Value: "1"}} safeCall_Cov25(func() { h.List(c) }) } func TestInboxHandler_Create_Cov25(t *testing.T) { gin.SetMode(gin.TestMode) h := newInboxHandler_Cov25() w := httptest.NewRecorder() c, _ := gin.CreateTestContext(w) c.Request = httptest.NewRequest(http.MethodPost, "/", nil) c.Params = gin.Params{{Key: "account_id", Value: "1"}} safeCall_Cov25(func() { h.Create(c) }) } func TestInboxHandler_Update_Cov25(t *testing.T) { gin.SetMode(gin.TestMode) h := newInboxHandler_Cov25() w := httptest.NewRecorder() c, _ := gin.CreateTestContext(w) c.Request = httptest.NewRequest(http.MethodPatch, "/", nil) c.Params = gin.Params{{Key: "account_id", Value: "1"}, {Key: "id", Value: "1"}} safeCall_Cov25(func() { h.Update(c) }) } func TestInboxHandler_Delete_Cov25(t *testing.T) { gin.SetMode(gin.TestMode) h := newInboxHandler_Cov25() w := httptest.NewRecorder() c, _ := gin.CreateTestContext(w) c.Request = httptest.NewRequest(http.MethodDelete, "/", nil) c.Params = gin.Params{{Key: "account_id", Value: "1"}, {Key: "id", Value: "1"}} safeCall_Cov25(func() { h.Delete(c) }) } // Contact handler tests func newContactHandler_Cov25() *ContactHandler { return &ContactHandler{} } func TestContactHandler_List_Cov25(t *testing.T) { gin.SetMode(gin.TestMode) h := newContactHandler_Cov25() w := httptest.NewRecorder() c, _ := gin.CreateTestContext(w) c.Request = httptest.NewRequest(http.MethodGet, "/", nil) c.Params = gin.Params{{Key: "account_id", Value: "1"}} safeCall_Cov25(func() { h.List(c) }) } func TestContactHandler_Create_Cov25(t *testing.T) { gin.SetMode(gin.TestMode) h := newContactHandler_Cov25() w := httptest.NewRecorder() c, _ := gin.CreateTestContext(w) c.Request = httptest.NewRequest(http.MethodPost, "/", nil) c.Params = gin.Params{{Key: "account_id", Value: "1"}} safeCall_Cov25(func() { h.Create(c) }) } func TestContactHandler_Update_Cov25(t *testing.T) { gin.SetMode(gin.TestMode) h := newContactHandler_Cov25() w := httptest.NewRecorder() c, _ := gin.CreateTestContext(w) c.Request = httptest.NewRequest(http.MethodPut, "/", nil) c.Params = gin.Params{{Key: "account_id", Value: "1"}, {Key: "id", Value: "1"}} safeCall_Cov25(func() { h.Update(c) }) } func TestContactHandler_Delete_Cov25(t *testing.T) { gin.SetMode(gin.TestMode) h := newContactHandler_Cov25() w := httptest.NewRecorder() c, _ := gin.CreateTestContext(w) c.Request = httptest.NewRequest(http.MethodDelete, "/", nil) c.Params = gin.Params{{Key: "account_id", Value: "1"}, {Key: "id", Value: "1"}} safeCall_Cov25(func() { h.Delete(c) }) }