From ba92d3451f35a8ec4aa794920d0543612faa4c85 Mon Sep 17 00:00:00 2001 From: Johan McGwire Date: Sun, 8 May 2022 16:35:20 -0400 Subject: [PATCH] combine tests to handle http handler registration --- conversation_test.go | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/conversation_test.go b/conversation_test.go index 990f72f68..29f4b7742 100644 --- a/conversation_test.go +++ b/conversation_test.go @@ -411,24 +411,18 @@ func TestGetConversationInfo(t *testing.T) { t.Error("channel should not be nil") return } -} -func TestGetConversationInfoNilError(t *testing.T) { - http.HandleFunc("/conversations.info", okChannelJsonHandler) - once.Do(startServer) - api := New("testing-token", OptionAPIURL("http://"+serverAddr+"/")) - _, err := api.GetConversationInfo(nil) + // Nil Input Error + api = New("testing-token", OptionAPIURL("http://"+serverAddr+"/")) + _, err = api.GetConversationInfo(nil) if err == nil { t.Errorf("Unexpected pass where there should have been nil input error") return } -} -func TestGetConversationInfoMissingChannelError(t *testing.T) { - http.HandleFunc("/conversations.info", okChannelJsonHandler) - once.Do(startServer) - api := New("testing-token", OptionAPIURL("http://"+serverAddr+"/")) - _, err := api.GetConversationInfo(&GetConversationInfoInput{}) + // No Channel Error + api = New("testing-token", OptionAPIURL("http://"+serverAddr+"/")) + _, err = api.GetConversationInfo(&GetConversationInfoInput{}) if err == nil { t.Errorf("Unexpected pass where there should have been missing channel error") return