Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
09273e3
improve test reliability
marle3003 Sep 17, 2025
8caff81
Merge remote-tracking branch 'origin/develop' into develop
marle3003 Sep 17, 2025
ed683d6
add codecov config
marle3003 Sep 17, 2025
3f40f17
move codecov config to root
marle3003 Sep 17, 2025
c3078f5
add test
marle3003 Sep 17, 2025
55280f8
add test
marle3003 Sep 17, 2025
c4c53a8
fix security issues
marle3003 Sep 18, 2025
98fef33
fix table view
marle3003 Sep 18, 2025
8433490
Merge remote-tracking branch 'origin/develop' into develop
marle3003 Sep 18, 2025
585d2bb
add test
marle3003 Sep 18, 2025
1db0b87
refactor code
marle3003 Sep 18, 2025
27ec9f7
add tests
marle3003 Sep 18, 2025
444282d
add tests
marle3003 Sep 18, 2025
a3d6322
Merge remote-tracking branch 'origin/develop' into develop
marle3003 Sep 18, 2025
4a3cf98
add tests
marle3003 Sep 18, 2025
e2c2d32
add tests
marle3003 Sep 18, 2025
b754983
add tests
marle3003 Sep 18, 2025
07a5e7c
add tests
marle3003 Sep 19, 2025
9788130
Bump github.com/evanw/esbuild from 0.25.9 to 0.25.10
dependabot[bot] Sep 19, 2025
749ec87
Bump del-cli from 6.0.0 to 7.0.0 in /webui
dependabot[bot] Sep 19, 2025
ddb46a7
Merge pull request #681 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Sep 19, 2025
8f06351
Bump vue-tsc from 3.0.6 to 3.0.7 in /webui
dependabot[bot] Sep 19, 2025
5cec62f
Merge pull request #680 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Sep 19, 2025
ef9cc9c
Bump xml-formatter from 3.6.6 to 3.6.7 in /webui
dependabot[bot] Sep 19, 2025
7338f4e
Merge pull request #682 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Sep 19, 2025
adfb910
Bump @types/node from 24.3.1 to 24.5.2 in /webui
dependabot[bot] Sep 19, 2025
f2dfe21
Merge pull request #683 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Sep 19, 2025
16fd623
Bump vite from 7.1.5 to 7.1.6 in /webui
dependabot[bot] Sep 19, 2025
f3eb9eb
Merge pull request #679 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Sep 19, 2025
fa35107
Merge branch 'develop' into dependabot/go_modules/develop/github.com/…
marle3003 Sep 19, 2025
c65bfbe
Merge pull request #678 from marle3003/dependabot/go_modules/develop/…
github-actions[bot] Sep 19, 2025
50fb39a
remove unused code
marle3003 Sep 20, 2025
4f06bcf
add tests
marle3003 Sep 20, 2025
e0cf43d
Merge remote-tracking branch 'origin/develop' into develop
marle3003 Sep 20, 2025
cbd58ef
add tests
marle3003 Sep 20, 2025
76662de
add tests
marle3003 Sep 20, 2025
cb888cb
fix tests
marle3003 Sep 20, 2025
af84553
add test
marle3003 Sep 20, 2025
1c09dad
add test
marle3003 Sep 20, 2025
e7a1096
improve server for simplicity
marle3003 Sep 21, 2025
02df4fe
increase attempts
marle3003 Sep 21, 2025
1f84789
fix closing server
marle3003 Sep 21, 2025
402aa60
set debug log level
marle3003 Sep 21, 2025
bdf4836
remove log debug level
marle3003 Sep 21, 2025
ff2e793
fix test
marle3003 Sep 21, 2025
43fa42e
change Kafka segment creation to Lazy
marle3003 Sep 21, 2025
b29a12c
improve data generator when schema does not specify a type
marle3003 Sep 21, 2025
dcc9ca4
add tests
marle3003 Sep 21, 2025
17a8e39
improve data generator for arrays with prefixItems
marle3003 Sep 22, 2025
ad96957
fix configwatcher read explicit while implicit is still parsing
marle3003 Sep 22, 2025
ce85606
add support for additionalProperties in JavaScript faker module
marle3003 Sep 24, 2025
31c0453
fix data generator for patternProperties to get a predictable result
marle3003 Sep 24, 2025
78633b5
introduce new CLI parameter --data-gen-optionalProperties
marle3003 Sep 24, 2025
9bd1463
introduce new CLI parameter --data-gen-optionalProperties
marle3003 Sep 24, 2025
c04e4e2
update doc
marle3003 Sep 24, 2025
d24b85f
update doc
marle3003 Sep 24, 2025
0bf1441
add support dependentRequired in data generator
marle3003 Sep 25, 2025
067d8d1
add support dependentSchemas in data generator
marle3003 Sep 26, 2025
7d4108b
Bump vue-tsc from 3.0.7 to 3.0.8 in /webui
dependabot[bot] Sep 26, 2025
2b5658f
Merge pull request #687 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Sep 26, 2025
98438c5
Bump vue from 3.5.21 to 3.5.22 in /webui
dependabot[bot] Sep 26, 2025
49956b3
Merge pull request #688 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Sep 26, 2025
c8983c2
Bump @playwright/test from 1.55.0 to 1.55.1 in /webui
dependabot[bot] Sep 26, 2025
8aba4a0
Merge pull request #686 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Sep 26, 2025
c1ee8b4
Bump eslint-plugin-vue from 10.4.0 to 10.5.0 in /webui
dependabot[bot] Sep 26, 2025
7ab6a91
Merge pull request #684 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Sep 26, 2025
ecab219
Bump vite from 7.1.6 to 7.1.7 in /webui
dependabot[bot] Sep 26, 2025
0cbf72d
Merge pull request #685 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Sep 26, 2025
fc6fdf2
improve anyOf with object in data generator
marle3003 Sep 26, 2025
3cea636
Merge remote-tracking branch 'origin/develop' into develop
marle3003 Sep 26, 2025
e25b205
fix JSON pointer encoded slash and tilde
marle3003 Sep 27, 2025
7ed5750
improve anyOf, allOf and oneOff with object in data generator
marle3003 Sep 30, 2025
1ac96ac
Bump github.com/bradleyfalzon/ghinstallation/v2 from 2.16.0 to 2.17.0
dependabot[bot] Oct 3, 2025
c8246ee
Bump vite from 7.1.7 to 7.1.9 in /webui
dependabot[bot] Oct 3, 2025
9c9edd6
Merge pull request #693 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Oct 3, 2025
043e8f9
Bump eslint from 9.35.0 to 9.36.0 in /webui
dependabot[bot] Oct 3, 2025
e833b1f
Merge pull request #691 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Oct 3, 2025
6612280
Bump vue-tsc from 3.0.8 to 3.1.0 in /webui
dependabot[bot] Oct 3, 2025
c84e531
Merge pull request #692 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Oct 3, 2025
49e29d8
Bump @types/node from 24.5.2 to 24.6.2 in /webui
dependabot[bot] Oct 3, 2025
6e294fc
Merge pull request #695 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Oct 3, 2025
ded5c0c
Bump typescript from 5.9.2 to 5.9.3 in /webui
dependabot[bot] Oct 3, 2025
ac7da28
add support for OpenAPI 3.2:
marle3003 Oct 3, 2025
980bbb6
Merge remote-tracking branch 'origin/develop' into develop
marle3003 Oct 3, 2025
44ed7fa
enable OpenAPI version 3.2.0
marle3003 Oct 3, 2025
1dd96c9
Merge branch 'develop' into dependabot/npm_and_yarn/webui/develop/typ…
marle3003 Oct 3, 2025
f0be23b
Merge pull request #694 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Oct 3, 2025
79ceac2
Merge branch 'develop' into dependabot/go_modules/develop/github.com/…
marle3003 Oct 3, 2025
6b697d6
Merge pull request #690 from marle3003/dependabot/go_modules/develop/…
github-actions[bot] Oct 3, 2025
abfe487
Bump github.com/blevesearch/bleve_index_api from 1.2.9 to 1.2.10
dependabot[bot] Oct 3, 2025
1141687
Merge pull request #689 from marle3003/dependabot/go_modules/develop/…
github-actions[bot] Oct 3, 2025
b8eb9d5
add schema $id into paths when empty
marle3003 Oct 3, 2025
d9fea3f
Merge remote-tracking branch 'origin/develop' into develop
marle3003 Oct 3, 2025
592ff60
fix remove trailing slash in server urls
marle3003 Oct 6, 2025
90b3bb1
Merge remote-tracking branch 'origin/develop' into develop
marle3003 Oct 7, 2025
007a79b
fix null reference error
marle3003 Oct 8, 2025
e0b35c7
add OpenAPI tags and filter in webui
marle3003 Oct 9, 2025
6c19973
Merge remote-tracking branch 'origin/develop' into develop
marle3003 Oct 9, 2025
0c65222
add missed file in commit
marle3003 Oct 9, 2025
5f86992
add missed file in commit
marle3003 Oct 9, 2025
2a3e41a
fix test
marle3003 Oct 9, 2025
789084f
Merge branch 'main' into develop
marle3003 Oct 9, 2025
a7c9ec2
fix action table sizing
marle3003 Oct 9, 2025
e8844b3
add support for houseNumber in data generator
marle3003 Oct 9, 2025
49af4e9
Merge remote-tracking branch 'origin/develop' into develop
marle3003 Oct 9, 2025
fdaf1d5
Bump golang.org/x/text from 0.29.0 to 0.30.0
dependabot[bot] Oct 10, 2025
edee98b
Bump github.com/go-git/go-git/v5 from 5.16.2 to 5.16.3
dependabot[bot] Oct 10, 2025
cad9a9b
Bump @rushstack/eslint-patch from 1.12.0 to 1.13.0 in /webui
dependabot[bot] Oct 10, 2025
c069d5d
Merge pull request #702 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Oct 10, 2025
ed27830
Bump @playwright/test from 1.55.1 to 1.56.0 in /webui
dependabot[bot] Oct 10, 2025
f41ffc7
Merge pull request #704 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Oct 10, 2025
11b0e02
Bump @types/node from 24.6.2 to 24.7.1 in /webui
dependabot[bot] Oct 10, 2025
fd3a278
Merge pull request #705 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Oct 10, 2025
7a722a6
Bump vue-tsc from 3.1.0 to 3.1.1 in /webui
dependabot[bot] Oct 10, 2025
4d524c3
Merge pull request #700 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Oct 10, 2025
de4ff43
Bump eslint from 9.36.0 to 9.37.0 in /webui
dependabot[bot] Oct 10, 2025
d888efa
Merge branch 'develop' into dependabot/go_modules/develop/golang.org/…
marle3003 Oct 10, 2025
0dc77c7
Merge pull request #703 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Oct 10, 2025
4d195c2
Merge branch 'develop' into dependabot/go_modules/develop/golang.org/…
marle3003 Oct 10, 2025
375a996
Merge pull request #699 from marle3003/dependabot/go_modules/develop/…
github-actions[bot] Oct 10, 2025
9d537de
Merge branch 'develop' into dependabot/go_modules/develop/github.com/…
marle3003 Oct 10, 2025
73289a1
Merge pull request #701 from marle3003/dependabot/go_modules/develop/…
github-actions[bot] Oct 10, 2025
22fecd1
Bump golang.org/x/net from 0.44.0 to 0.46.0
dependabot[bot] Oct 10, 2025
a019622
Merge pull request #698 from marle3003/dependabot/go_modules/develop/…
github-actions[bot] Oct 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions acceptance/acceptance_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package acceptance

import (
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"io"
"mokapi/config/static"
"testing"
"time"

"github.com/sirupsen/logrus"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
)

func TestAcceptance(t *testing.T) {
Expand All @@ -21,15 +23,12 @@ type BaseSuite struct {
}

func (suite *BaseSuite) initCmd(cfg *static.Config) {
//logrus.SetOutput(io.Discard)
logrus.SetOutput(io.Discard)

suite.cfg = cfg
cmd, err := Start(cfg)
require.NoError(suite.T(), err)
suite.cmd = cmd

// wait for server start
time.Sleep(2 * time.Second)
}

func (suite *BaseSuite) TearDownSuite() {
Expand Down
13 changes: 8 additions & 5 deletions acceptance/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"mokapi/providers/swagger"
"mokapi/runtime"
"mokapi/safe"
"mokapi/schema/json/generator"
"mokapi/server"
"mokapi/server/cert"
"mokapi/version"
Expand All @@ -28,7 +29,6 @@ type Cmd struct {
App *runtime.App

server *server.Server
cancel context.CancelFunc
}

func Start(cfg *static.Config) (*Cmd, error) {
Expand All @@ -42,6 +42,7 @@ func Start(cfg *static.Config) (*Cmd, error) {

registerDynamicTypes()
app := runtime.New(cfg)
generator.SetConfig(cfg.DataGen)

watcher := server.NewConfigWatcher(cfg)

Expand Down Expand Up @@ -77,19 +78,21 @@ func Start(cfg *static.Config) (*Cmd, error) {
}

pool := safe.NewPool(context.Background())
ctx, cancel := context.WithCancel(context.Background())
s := server.NewServer(pool, app, watcher, kafka, http, mailManager, ldap, scriptEngine)
s.StartAsync(ctx)
go func() {
err := s.Start()
if err != nil {
panic(err)
}
}()

return &Cmd{
App: app,
server: s,
cancel: cancel,
}, nil
}

func (cmd *Cmd) Stop() {
cmd.cancel()
cmd.server.Close()
}

Expand Down
3 changes: 3 additions & 0 deletions acceptance/ldap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ type LdapSuite struct {

func (suite *LdapSuite) SetupSuite() {
cfg := static.NewConfig()
port := try.GetFreePort()
cfg.Api.Port = fmt.Sprintf("%v", port)
cfg.Providers.File.Directories = []string{"./ldap"}
suite.initCmd(cfg)
// ensure scripts are executed
Expand All @@ -29,6 +31,7 @@ func (suite *LdapSuite) SetupSuite() {

func (suite *LdapSuite) TearDownSuite() {
suite.Client.Close()
suite.BaseSuite.TearDownSuite()
}

func (suite *LdapSuite) AfterTest(_, _ string) {
Expand Down
71 changes: 41 additions & 30 deletions acceptance/mail_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"crypto/tls"
"encoding/json"
"fmt"
"github.com/stretchr/testify/require"
"mokapi/config/static"
"mokapi/server/cert"
"mokapi/smtp/smtptest"
Expand All @@ -14,6 +13,10 @@ import (
"os"
"path"
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

type MailSuite struct{ BaseSuite }
Expand Down Expand Up @@ -161,10 +164,10 @@ func (suite *MailSuite) TestSearch() {
try.AssertBody(func(t *testing.T, body string) {
var data map[string]any
err := json.Unmarshal([]byte(body), &data)
require.NoError(t, err)
require.NotNil(t, data)
assert.NoError(t, err)
assert.NotNil(t, data)

require.Equal(t, float64(5), data["total"])
assert.Equal(t, float64(5), data["total"])
}),
)
}
Expand Down Expand Up @@ -220,15 +223,15 @@ It can be any text data.
try.AssertBody(func(t *testing.T, body string) {
var v any
err = json.Unmarshal([]byte(body), &v)
require.NoError(suite.T(), err)
assert.NoError(suite.T(), err)
a := v.([]any)
m := a[0].(map[string]any)
require.Len(t, m, 5)
require.NotEmpty(t, m["messageId"])
require.NotEmpty(t, m["date"])
require.Equal(t, []any{map[string]any{"address": "[email protected]"}}, m["from"])
require.Equal(t, []any{map[string]any{"address": "[email protected]"}}, m["to"])
require.Equal(t, "Example multipart/mixed message", m["subject"])
assert.Len(t, m, 5)
assert.NotEmpty(t, m["messageId"])
assert.NotEmpty(t, m["date"])
assert.Equal(t, []any{map[string]any{"address": "[email protected]"}}, m["from"])
assert.Equal(t, []any{map[string]any{"address": "[email protected]"}}, m["to"])
assert.Equal(t, "Example multipart/mixed message", m["subject"])
messageId = m["messageId"].(string)
}),
)
Expand All @@ -237,38 +240,46 @@ It can be any text data.
try.AssertBody(func(t *testing.T, body string) {
var v any
err = json.Unmarshal([]byte(body), &v)
require.NoError(suite.T(), err)
assert.NoError(suite.T(), err)
m := v.(map[string]any)
m = m["data"].(map[string]any)
require.Len(t, m, 10)
require.Regexp(t, ".*:8030", m["server"])
require.Equal(t, []any{map[string]any{"address": "[email protected]"}}, m["from"])
require.Equal(t, []any{map[string]any{"address": "[email protected]"}}, m["to"])
require.Equal(t, []any{
assert.Len(t, m, 10)
assert.Regexp(t, ".*:8030", m["server"])
assert.Equal(t, []any{map[string]any{"address": "[email protected]"}}, m["from"])
assert.Equal(t, []any{map[string]any{"address": "[email protected]"}}, m["to"])
assert.Equal(t, []any{
map[string]any{
"contentType": "text/plain",
"name": "example.txt",
"size": float64(64),
},
}, m["attachments"])
require.NotContains(t, m, "sender")
require.NotContains(t, m, "replyTo")
require.NotContains(t, m, "cc")
require.NotContains(t, m, "bcc")
require.NotEmpty(t, m["messageId"])
require.NotContains(t, m, "inReplyTo")
require.NotEmpty(t, m["date"])
require.Equal(t, "Example multipart/mixed message", m["subject"])
require.Equal(t, "text/plain; charset=\"UTF-8\"", m["contentType"])
require.NotContains(t, m, "contentTransferEncoding")
require.Equal(t, "Hello Bob,\n\nThis is the plain text part of the email.\n", m["body"])
require.Greater(t, m["size"], float64(0))
assert.NotContains(t, m, "sender")
assert.NotContains(t, m, "replyTo")
assert.NotContains(t, m, "cc")
assert.NotContains(t, m, "bcc")
assert.NotEmpty(t, m["messageId"])
assert.NotContains(t, m, "inReplyTo")
assert.NotEmpty(t, m["date"])
assert.Equal(t, "Example multipart/mixed message", m["subject"])
assert.Equal(t, "text/plain; charset=\"UTF-8\"", m["contentType"])
assert.NotContains(t, m, "contentTransferEncoding")
assert.Equal(t, "Hello Bob,\n\nThis is the plain text part of the email.\n", m["body"])
assert.Greater(t, m["size"], float64(0))
}),
)
}

func (suite *MailSuite) TestCustomServerCertificate() {
conn, err := net.Dial("tcp", "localhost:8993")
var conn net.Conn
var err error
for attempt := 1; attempt <= 10; attempt++ {
conn, err = net.Dial("tcp", "localhost:8993")
if err == nil {
break
}
time.Sleep(200 * time.Millisecond)
}
require.NoError(suite.T(), err)
defer func() { _ = conn.Close() }()

Expand Down
68 changes: 40 additions & 28 deletions acceptance/petstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@ package acceptance
import (
"encoding/json"
"fmt"
"github.com/brianvoe/gofakeit/v6"
"github.com/stretchr/testify/require"
"mokapi/config/static"
"mokapi/kafka"
"mokapi/kafka/fetch"
"mokapi/kafka/kafkatest"
"mokapi/kafka/metaData"
"mokapi/kafka/produce"
"mokapi/schema/json/generator"
"mokapi/try"
"net/http"
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

type PetStoreSuite struct{ BaseSuite }
Expand All @@ -29,7 +31,7 @@ func (suite *PetStoreSuite) SetupSuite() {
}

func (suite *PetStoreSuite) SetupTest() {
gofakeit.Seed(11)
generator.Seed(11)
}

func (suite *PetStoreSuite) TestApi() {
Expand All @@ -50,9 +52,6 @@ func (suite *PetStoreSuite) TestApi() {
})

suite.T().Run("get AsyncAPI service", func(t *testing.T) {
// ensure scripts are executed
time.Sleep(5 * time.Second)

expected := map[string]interface{}{
"version": "1.0.0",
"name": "A sample AsyncApi Kafka streaming api",
Expand Down Expand Up @@ -128,11 +127,23 @@ func (suite *PetStoreSuite) TestApi() {
}},
}

try.GetRequest(t, fmt.Sprintf("http://127.0.0.1:%v/api/services/kafka/A%%20sample%%20AsyncApi%%20Kafka%%20streaming%%20api", suite.cfg.Api.Port),
nil,
try.HasStatusCode(http.StatusOK),
try.BodyContainsData(expected),
)
deadline := time.Now().Add(5 * time.Second)
for time.Now().Before(deadline) {
try.GetRequest(t, fmt.Sprintf("http://127.0.0.1:%v/api/services/kafka/A%%20sample%%20AsyncApi%%20Kafka%%20streaming%%20api", suite.cfg.Api.Port),
nil,
try.HasStatusCode(http.StatusOK),
try.BodyContainsData(expected),
)
if !t.Failed() {
break
}
if time.Now().After(deadline) {
t.FailNow()
}
// reset test failure state before retrying
t.Cleanup(func() {})
time.Sleep(100 * time.Millisecond)
}
})
}

Expand All @@ -158,7 +169,7 @@ func (suite *PetStoreSuite) TestJsHttpHandler() {
try.GetRequest(suite.T(), "http://127.0.0.1:18080/pet/5",
map[string]string{"Accept": "application/json", "api_key": "123"},
try.HasStatusCode(http.StatusOK),
try.BodyContains(`},"name":"Zoe","photoUrls":`))
try.BodyContains(`"name":"Zoe"`))

// test http metrics
try.GetRequest(suite.T(), fmt.Sprintf("http://127.0.0.1:%s/api/metrics/http?path=/pet/{petId}", suite.cfg.Api.Port), nil,
Expand All @@ -179,12 +190,13 @@ func (suite *PetStoreSuite) TestGetOrderById() {
try.GetRequest(suite.T(), "http://127.0.0.1:18080/store/order/1",
map[string]string{"Accept": "application/json"},
try.HasStatusCode(http.StatusOK),
try.HasBody(`{"id":98266,"petId":23377,"quantity":92,"shipDate":"2012-01-30T07:58:01Z","status":"approved","complete":false}`))
try.HasBody(`{"petId":23377,"quantity":92,"shipDate":"2012-01-30T07:58:01Z","complete":false}`))

try.GetRequest(suite.T(), "https://localhost:18443/store/order/10",
map[string]string{"Accept": "application/json"},
try.HasStatusCode(http.StatusOK),
try.HasBody(`{"id":12545,"petId":20895,"quantity":16,"shipDate":"2027-11-26T16:57:16Z","status":"approved","complete":true}`))
// properties like id or petId are optional
try.HasBody(`{"id":93761,"petId":83318,"quantity":27,"shipDate":"2014-02-04T10:00:17Z","status":"placed","complete":true}`))
}

func (suite *PetStoreSuite) TestTls() {
Expand Down Expand Up @@ -341,17 +353,17 @@ func (suite *PetStoreSuite) TestSearch_Paging() {
try.AssertBody(func(t *testing.T, body string) {
var data map[string]any
err := json.Unmarshal([]byte(body), &data)
require.NoError(t, err)
require.NotNil(t, data)
assert.NoError(t, err)
assert.NotNil(t, data)

require.Equal(t, float64(35), data["total"])
assert.Equal(t, float64(35), data["total"])

items := data["results"].([]any)
require.Len(t, items, 10)
assert.Len(t, items, 10)
evt := items[0].(map[string]interface{})
require.Equal(t, "HTTP", evt["type"])
require.Equal(t, "Swagger Petstore", evt["title"])
require.NotContains(t, evt, "domain")
assert.Equal(t, "HTTP", evt["type"])
assert.Equal(t, "Swagger Petstore", evt["title"])
assert.NotContains(t, evt, "domain")
}),
)

Expand All @@ -361,17 +373,17 @@ func (suite *PetStoreSuite) TestSearch_Paging() {
try.AssertBody(func(t *testing.T, body string) {
var data map[string]any
err := json.Unmarshal([]byte(body), &data)
require.NoError(t, err)
require.NotNil(t, data)
assert.NoError(t, err)
assert.NotNil(t, data)

require.Equal(t, float64(35), data["total"])
assert.Equal(t, float64(35), data["total"])

items := data["results"].([]any)
require.Len(t, items, 10)
assert.Len(t, items, 10)
evt := items[0].(map[string]interface{})
require.Equal(t, "HTTP", evt["type"])
require.Equal(t, "GET /pet/{petId}", evt["title"])
require.Equal(t, "Swagger Petstore", evt["domain"])
assert.Equal(t, "HTTP", evt["type"])
assert.Equal(t, "GET /pet/{petId}", evt["title"])
assert.Equal(t, "Swagger Petstore", evt["domain"])
}),
)
}
Loading