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)
|
||||
|
||||
// content type isn't actually returned when creating a
|
||||
// status, so we have to fetch from the database to check
|
||||
createdStatus, err := suite.state.DB.GetStatusByID(ctx, apiStatus.ID)
|
||||
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)
|
||||
// the test accounts don't have settings, so we're comparing to
|
||||
// the global default value instead of the requester's default
|
||||
suite.Equal(apimodel.StatusContentTypeDefault, apiStatus.ContentType)
|
||||
}
|
||||
|
||||
func TestStatusCreateTestSuite(t *testing.T) {
|
||||
|
|
|
@ -195,6 +195,11 @@ func (suite *StatusEditTestSuite) TestEditOnStatusWithNoContentType() {
|
|||
suite.Equal(form.Status, apiStatus.Text)
|
||||
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.
|
||||
latestStatus, err := suite.state.DB.GetStatusByID(ctx, status.ID)
|
||||
suite.NoError(err)
|
||||
|
@ -206,9 +211,8 @@ func (suite *StatusEditTestSuite) TestEditOnStatusWithNoContentType() {
|
|||
suite.Equal(len(status.EditIDs)+1, len(latestStatus.EditIDs))
|
||||
suite.NotEqual(status.UpdatedAt(), latestStatus.UpdatedAt())
|
||||
|
||||
// Check latest 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)
|
||||
// Check latest status against requester's default content
|
||||
// type (again, actually just checking for the global default)
|
||||
suite.Equal(gtsmodel.StatusContentTypeDefault, latestStatus.ContentType)
|
||||
|
||||
// Populate all historical edits for this status.
|
||||
|
|
Loading…
Reference in New Issue