github.com/rajatvaryani/mattermost-server@v5.11.1+incompatible/model/push_response_test.go (about)

     1  // Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package model
     5  
     6  import (
     7  	"strings"
     8  	"testing"
     9  )
    10  
    11  func TestNewOkPushResponse(t *testing.T) {
    12  	r := NewOkPushResponse()
    13  	CheckString(t, r["status"], "OK")
    14  }
    15  
    16  func TestNewRemovePushResponse(t *testing.T) {
    17  	r := NewRemovePushResponse()
    18  	CheckString(t, r["status"], "REMOVE")
    19  }
    20  
    21  func TestNewErrorPushResponse(t *testing.T) {
    22  	r := NewErrorPushResponse("error message")
    23  	CheckString(t, r["status"], "FAIL")
    24  	CheckString(t, r["error"], "error message")
    25  }
    26  
    27  func TestPushResponseToFromJson(t *testing.T) {
    28  	r := NewErrorPushResponse("error message")
    29  	j := r.ToJson()
    30  	r1 := PushResponseFromJson(strings.NewReader(j))
    31  
    32  	CheckString(t, r1["status"], r["status"])
    33  	CheckString(t, r1["error"], r["error"])
    34  }