Кирилл Горбунов
7a302ce899
Co-authored-by: Gorbunov Kirill Andreevich <kgorbunov@mtsbank.ru> Reviewed-on: #8 Reviewed-by: Василий Толстов <v.tolstov@unistack.org> Co-authored-by: Кирилл Горбунов <kirya_gorbunov_2015@mail.ru> Co-committed-by: Кирилл Горбунов <kirya_gorbunov_2015@mail.ru>
34 lines
754 B
Go
34 lines
754 B
Go
package swaggerset
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestSwaggerSet_1(t *testing.T) {
|
|
s := NewSwaggerSet()
|
|
data, err := os.ReadFile("swagger.yaml")
|
|
assert.Nil(t, err)
|
|
|
|
err = s.AddSwaggerset("localhost:8080", "service", data)
|
|
assert.Nil(t, err)
|
|
|
|
msg, err := s.GetMessage(
|
|
"localhost:8080",
|
|
"service",
|
|
"/domain-service/v1/push_mail/enabled",
|
|
"GET")
|
|
assert.Nil(t, err)
|
|
assert.NotNil(t, msg)
|
|
req, err := json.Marshal(msg.Request)
|
|
assert.Nil(t, err)
|
|
rsp, err := json.Marshal(msg.Response)
|
|
assert.Nil(t, err)
|
|
fmt.Printf("JSON: type: %s, req: %s, rsp: %s \n", msg.Type, req, rsp)
|
|
fmt.Printf("Struct: type: %s, req: %+v, rsp: %+v \n", msg.Type, msg.Request, msg.Response)
|
|
}
|