Update new tests to check content type on API statuses
This commit is contained in:
parent
83de18aeba
commit
b6b0bd7ce7
|
@ -263,15 +263,9 @@ func (suite *StatusCreateTestSuite) TestProcessNoContentTypeUsesDefault() {
|
||||||
|
|
||||||
suite.Equal("<p>poopoo peepee</p>", apiStatus.Content)
|
suite.Equal("<p>poopoo peepee</p>", apiStatus.Content)
|
||||||
|
|
||||||
// content type isn't actually returned when creating a
|
// the test accounts don't have settings, so we're comparing to
|
||||||
// status, so we have to fetch from the database to check
|
// the global default value instead of the requester's default
|
||||||
createdStatus, err := suite.state.DB.GetStatusByID(ctx, apiStatus.ID)
|
suite.Equal(apimodel.StatusContentTypeDefault, apiStatus.ContentType)
|
||||||
suite.NoError(err)
|
|
||||||
|
|
||||||
// Check created status against requester's default content type
|
|
||||||
// setting (the test accounts don't actually have settings on them,
|
|
||||||
// so instead we check that the global default content type is used)
|
|
||||||
suite.Equal(gtsmodel.StatusContentTypeDefault, createdStatus.ContentType)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStatusCreateTestSuite(t *testing.T) {
|
func TestStatusCreateTestSuite(t *testing.T) {
|
||||||
|
|
|
@ -195,6 +195,11 @@ func (suite *StatusEditTestSuite) TestEditOnStatusWithNoContentType() {
|
||||||
suite.Equal(form.Status, apiStatus.Text)
|
suite.Equal(form.Status, apiStatus.Text)
|
||||||
suite.NotEqual(util.FormatISO8601(status.EditedAt), *apiStatus.EditedAt)
|
suite.NotEqual(util.FormatISO8601(status.EditedAt), *apiStatus.EditedAt)
|
||||||
|
|
||||||
|
// Check response against requester's default content type setting
|
||||||
|
// (the test accounts don't actually have settings on them, so
|
||||||
|
// instead we check that the global default content type is used)
|
||||||
|
suite.Equal(apimodel.StatusContentTypeDefault, apiStatus.ContentType)
|
||||||
|
|
||||||
// Fetched the latest version of edited status from the database.
|
// Fetched the latest version of edited status from the database.
|
||||||
latestStatus, err := suite.state.DB.GetStatusByID(ctx, status.ID)
|
latestStatus, err := suite.state.DB.GetStatusByID(ctx, status.ID)
|
||||||
suite.NoError(err)
|
suite.NoError(err)
|
||||||
|
@ -206,9 +211,8 @@ func (suite *StatusEditTestSuite) TestEditOnStatusWithNoContentType() {
|
||||||
suite.Equal(len(status.EditIDs)+1, len(latestStatus.EditIDs))
|
suite.Equal(len(status.EditIDs)+1, len(latestStatus.EditIDs))
|
||||||
suite.NotEqual(status.UpdatedAt(), latestStatus.UpdatedAt())
|
suite.NotEqual(status.UpdatedAt(), latestStatus.UpdatedAt())
|
||||||
|
|
||||||
// Check latest status against requester's default content type
|
// Check latest status against requester's default content
|
||||||
// setting (the test accounts don't actually have settings on them,
|
// type (again, actually just checking for the global default)
|
||||||
// so instead we check that the global default content type is used)
|
|
||||||
suite.Equal(gtsmodel.StatusContentTypeDefault, latestStatus.ContentType)
|
suite.Equal(gtsmodel.StatusContentTypeDefault, latestStatus.ContentType)
|
||||||
|
|
||||||
// Populate all historical edits for this status.
|
// Populate all historical edits for this status.
|
||||||
|
|
Loading…
Reference in New Issue