3
0

Fix broken integration tests

This commit is contained in:
Tomaž Jerman 2023-04-07 15:43:00 +02:00
parent f1f7ff7d8f
commit bcc80497ff
2 changed files with 8 additions and 8 deletions

View File

@ -56,7 +56,7 @@ func TestPageLayoutRead(t *testing.T) {
Expect(t). Expect(t).
Status(http.StatusOK). Status(http.StatusOK).
Assert(helpers.AssertNoErrors). Assert(helpers.AssertNoErrors).
Assert(jsonpath.Equal(`$.response.meta.name`, ly.Meta.Title)). Assert(jsonpath.Equal(`$.response.meta.title`, ly.Meta.Title)).
Assert(jsonpath.Equal(`$.response.pageLayoutID`, fmt.Sprintf("%d", ly.ID))). Assert(jsonpath.Equal(`$.response.pageLayoutID`, fmt.Sprintf("%d", ly.ID))).
End() End()
} }
@ -81,7 +81,7 @@ func TestPageLayoutList_filterForbidden(t *testing.T) {
Expect(t). Expect(t).
Status(http.StatusOK). Status(http.StatusOK).
Assert(helpers.AssertNoErrors). Assert(helpers.AssertNoErrors).
Assert(jsonpath.NotPresent(`$.response.set[? @.meta.name=="page-layout_forbidden"]`)). Assert(jsonpath.NotPresent(`$.response.set[? @.meta.title=="page-layout_forbidden"]`)).
End() End()
} }
@ -96,7 +96,7 @@ func TestPageLayoutCreateForbidden(t *testing.T) {
Post(fmt.Sprintf("/namespace/%d/page/%d/layout/", ns.ID, pg.ID)). Post(fmt.Sprintf("/namespace/%d/page/%d/layout/", ns.ID, pg.ID)).
Header("Accept", "application/json"). Header("Accept", "application/json").
JSON(fmt.Sprintf(`{ JSON(fmt.Sprintf(`{
"meta": {"name": "some-page-layout"} "meta": {"title": "some-page-layout"}
}`)). }`)).
Expect(t). Expect(t).
Status(http.StatusOK). Status(http.StatusOK).
@ -122,7 +122,7 @@ func TestPageLayoutCreate(t *testing.T) {
Post(fmt.Sprintf("/namespace/%d/page/%d/layout/", ns.ID, pg.ID)). Post(fmt.Sprintf("/namespace/%d/page/%d/layout/", ns.ID, pg.ID)).
Header("Accept", "application/json"). Header("Accept", "application/json").
JSON(fmt.Sprintf(`{ JSON(fmt.Sprintf(`{
"meta": {"name": "some-page-layout"} "meta": {"title": "some-page-layout"}
}`)). }`)).
Expect(t). Expect(t).
Status(http.StatusOK). Status(http.StatusOK).
@ -148,7 +148,7 @@ func TestPageLayoutUpdateForbidden(t *testing.T) {
Post(fmt.Sprintf("/namespace/%d/page/%d/layout/%d", ns.ID, pg.ID, ly.ID)). Post(fmt.Sprintf("/namespace/%d/page/%d/layout/%d", ns.ID, pg.ID, ly.ID)).
Header("Accept", "application/json"). Header("Accept", "application/json").
JSON(fmt.Sprintf(`{ JSON(fmt.Sprintf(`{
"meta": {"name": "changed-name"} "meta": {"title": "changed-name"}
}`)). }`)).
Expect(t). Expect(t).
Status(http.StatusOK). Status(http.StatusOK).
@ -169,7 +169,7 @@ func TestPageLayoutUpdate(t *testing.T) {
h.apiInit(). h.apiInit().
Post(fmt.Sprintf("/namespace/%d/page/%d/layout/%d", ns.ID, pg.ID, ly.ID)). Post(fmt.Sprintf("/namespace/%d/page/%d/layout/%d", ns.ID, pg.ID, ly.ID)).
JSON(fmt.Sprintf(`{ JSON(fmt.Sprintf(`{
"meta": {"name": "changed-name"} "meta": {"title": "changed-name"}
}`)). }`)).
Expect(t). Expect(t).
Status(http.StatusOK). Status(http.StatusOK).

View File

@ -29,7 +29,7 @@ func (h helper) repoMakePage(ns *types.Namespace, name string) *types.Page {
res := &types.Page{ res := &types.Page{
ID: id.Next(), ID: id.Next(),
CreatedAt: time.Now(), CreatedAt: time.Now(),
Meta: &types.PageMeta{}, Meta: types.PageMeta{},
Title: name, Title: name,
NamespaceID: ns.ID, NamespaceID: ns.ID,
} }
@ -53,7 +53,7 @@ func (h helper) repoMakeWeightedPage(ns *types.Namespace, name string, weight in
res := &types.Page{ res := &types.Page{
ID: id.Next(), ID: id.Next(),
CreatedAt: time.Now(), CreatedAt: time.Now(),
Meta: &types.PageMeta{}, Meta: types.PageMeta{},
Title: name, Title: name,
NamespaceID: ns.ID, NamespaceID: ns.ID,
Weight: weight, Weight: weight,